Bug resolution is an important activity in any software maintenance project. Bug resolution for problems reported on applications already in use (or in production) has two main implications. First, a client may discover a bug in the field, whereupon it needs to be fixed urgently. Therefore, it is important to have good tool support that can help the programmer debug the program as quickly as possible, especially when the person who is debugging the code is not the programmer who originally wrote the code. Secondly, a bug can surface despite the fact that the code has been tested and has probably been running in the field for some time. That means it is likely to be an unanticipated corner case in otherwise correct code, and automated tools can focus their effort on identifying such corner cases. To date, conventional arrangements have been far from adequate in addressing these considerations.
In summary, one aspect of the invention provides a method comprising: assimilating a program, the program comprising statements; modeling output behavior of the statements; annotating statement occurrences; differencing passing and failing spectra to yield a difference; and locating a fault via employing the difference.
Another aspect of the invention provides an apparatus comprising: computer readable program code configured to assimilate a program, the program comprising statements; computer readable program code configured to model output behavior of the statements; computer readable program code configured to annotate statement occurrences; computer readable program code configured to difference passing and failing spectra to yield a difference; and computer readable program code configured to locate a fault via employing the difference.
An additional aspect of the invention provides a computer program product comprising: a computer readable storage medium having computer readable program code embodied therewith, the computer readable program code comprising: computer readable program code configured to assimilate a program, the program comprising statements; computer readable program code configured to model output behavior of the statements; computer readable program code configured to annotate statement occurrences; computer readable program code configured to difference passing and failing spectra to yield a difference; and computer readable program code configured to locate a fault via employing the difference.
For a better understanding of exemplary embodiments of the invention, together with other and further features and advantages thereof, reference is made to the following description, taken in conjunction with the accompanying drawings, and the scope of the claimed embodiments of the invention will be pointed out in the appended claims.
It will be readily understood that the components of the embodiments of the invention, as generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations in addition to the described exemplary embodiments. Thus, the following more detailed description of the embodiments of the invention, as represented in the figures, is not intended to limit the scope of the embodiments of the invention, as claimed, but is merely representative of exemplary embodiments of the invention.
Reference throughout this specification to “one embodiment” or “an embodiment” (or the like) means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention. Thus, appearances of the phrases “in one embodiment” or “in an embodiment” or the like in various places throughout this specification are not necessarily all referring to the same embodiment.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in at least one embodiment. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the various embodiments of the invention can be practiced without at least one of the specific details, or with other methods, components, materials, et cetera. In other instances, well-known structures, materials, or operations are not shown or described in detail to avoid obscuring aspects of the invention.
The description now turns to the figures. The illustrated embodiments of the invention will be best understood by reference to the figures. The following description is intended only by way of example and simply illustrates certain selected exemplary embodiments of the invention as claimed herein.
It should be noted that the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, apparatuses, methods and computer program products according to various embodiments of the invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises at least one executable instruction for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The disclosure now turns to
In accordance with at least one embodiment of the invention, techniques broadly contemplated herein can address a wide variety of programs and programming errors, and can especially be applied to aid in faster resolution of programming errors reported for ABAP (Advanced Business Application Programming) programs. ABAP is a widely used proprietary language used in SAP-ERP systems (which use ERP, or enterprise resource planning software as manufactured by SAP AG of Waldorf, Germany), and is heavily data-centric in the tradition of PL/SQL and COBOL. Data-centric programs process large collections of data that typically originate from a database. ABAP contains both imperative and declarative syntax. The declarative syntax is similar to SQL and allows developer to do complex operations on collections of data. Henceforth, declarative SQL-like commands in ABAP are referred to variously herein as database statements. As the discussion proceeds, it should be understood that, to the extent that ABAP is set forth by way of example, it is discussed non-restrictively and merely by way of illustration and, indeed, embodiments of the invention can apply to a very wide variety of data-centric programs.
In accordance with at least one embodiment of the invention,
In accordance with at least one embodiment of the invention,
In accordance with at least one embodiment of the invention, at the code level, the program 102 first reads the input data from OrderTab and DiscountTab (in data set 106) into internal tables itab, stab (lines 1,2), sorts table itab (line 4) and deletes records older than year 2010 (line 5). The CurrentYear variable is a parameter to the program and has value 2011. The program then loops over the contents of itab (line 6), sums up the Price (line 10), subtracts any relevant Discount (line 13) and prints out the total (line 16). One output entry is generated for each unique CstId present in the input OrderTab.
In accordance with at least one embodiment of the invention,
In accordance with at least one embodiment of the invention, a semantic differencing algorithm identifies such statements in the execution trace where different behavior of the command/statement have been exercised in the correct and incorrect slices and highlights them as potential faults. In the current, non-restrictive example, the fix is to change the READ (line 11) as READ stab INTO fa WHERE CstId=wa.CstId and Year=wa. Year such that appropriate year-wise discount is availed.
Generally, it can be appreciated that conventional efforts tend just to take into account whether a statement appears in one slice but not in another one, not the manner in which it appears in a slice. As such, semantic differencing can contribute yet another attribute of statement execution, where the behavior of statement execution on specific input data is taken into account.
In terms of one conventional effort, sequence-based differencing aims to identify statements that contribute towards computation of the incorrect result and do not contribute to the computation of at least one correct result. To realize the presence of such statements there is a two step process involving: grouping correct and incorrect slices into equivalence classes; and performing pair-wise differencing between the representative elements of the correct and incorrect equivalence classes.
In data-centric programs it is common to find the slices containing traces of same set of statements, but differing in the number of iterations of the some loops. Thus, while creating equivalence classes in correct and incorrect slices, in accordance with at least one embodiment of the invention there is broadly contemplated the combination of two slices into the same class if they are exactly same or if they have different number of iterations of the same statements in a loop. Generating equivalence classes in correct and incorrect slices reduces the number of pair-wise comparisons required to find differences between slices. Also, while undertaking sequence-based differencing of two slices, one from a correct equivalence class and another from an incorrect equivalence class, any difference of statements executed in the sequences of statement occurrences is noted. However, due to the common nature of loop-iteration differences (such as, different number of loop iterations), these differences are given lower priority among all sets of pair wise differences.
When considering sequence-based differencing, and as discussed above, an incorrect slice may not show any important difference compared to correct slices. This is possible if a statement exhibits different “behaviors” in two slices due to the nature of input data to the statement. Such difference in behavior can be referred to as a semantic difference, and such differences (along with measures for their detection) are illustrated herebelow, with continued reference to the present illustrative example.
By way of illustrating the functioning and effects of sequence-based differencing, one can consider the sample program 102 presented in
As such, in accordance with at least one embodiment of the invention, in employing semantic differencing, it can be assumed that there must exist a faulty statement in the program that appears both in the correct and incorrect slices, such that it fortuitously exhibits the intended semantics in the correct slices, but deviates from the intended semantics (based on programmer intent) in the incorrect slice (keeping in mind that the fortuitous correct behavior in the correct slices is specific to the particular input data). Thus, an objective becomes to ascertain whether a statement has deviated from its intended semantics.
In accordance with at least one embodiment of the invention, corner-case differencing is contemplated broadly for carrying out semantic differencing. As such, the semantics of some of the statements of program 102 can be classified into two separate categories: a normal case, and one or more corner cases. (It should be understood here that only those statements with composite behavior are modeled.) For example, in a READ statement, the WHERE condition could match multiple rows, or just one row. Since the first matching row is returned by the READ, the matching of just one row among several candidates is a corner case. A table 110 of corner and non-corner cases for several statements (of program 102 of
In accordance with at least one embodiment of the invention, in the present example with program 102 (
From the foregoing, it can be appreciated that generally, in accordance with at least one embodiment of the invention, statement output behavior is modeled as a set of possible disjoint outcome categories. In a dynamic slice, statements are annotated with the actual outcome category applicable. Passing and failing executions are then differenced by comparing annotated dynamic slices, whereupon the fault is localized.
Framed another way, in accordance with at least one embodiment of the invention, there are broadly contemplated herein systems and methods for localizing program faults by modeling statement output behaviors, annotating statement occurrences by characterizing the observed behavior, and leveraging the annotations in differencing passing and failing spectra. A system, as schematically illustrated in
Also included, in accordance with at least one embodiment of the invention, is a behavior classifier 116 which retrieves the set of classification rules for a specified statement occurrence, or trace statement (118) from the repository 114. The behavior classifier 116 then executes the classification rules, to obtain the applicable behavior classes for the statement occurrence 118. Thence, the behavior classifier annotates (120) the statement occurrence with the behavior classes. As a result, in statement output behavior classification (126), passing (122) and failing (124) input spectra are annotated (128 and 130, respectively), to permit differencing 132 and thus precise comparison between the annotated passing (128) and failing (130) slices of execution, to yield a difference 134 which localizes the fault 136.
In accordance with at least one embodiment of the invention,
As shown in
Referring now to
In cloud computing node 10′ there is a computer system/server 12′, which is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing systems, environments, and/or configurations that may be suitable for use with computer system/server 12′ include, but are not limited to, personal computer systems, server computer systems, thin clients, thick clients, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputer systems, mainframe computer systems, and distributed cloud computing environments that include any of the above systems or devices, and the like.
Computer system/server 12′ may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, and so on that perform particular tasks or implement particular abstract data types. Computer system/server 12′ may be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computer system storage media including memory storage devices.
As shown in
Bus 18′ represents at least one of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA (EISA) bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnects (PCI) bus.
Computer system/server 12′ typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer system/server 12′, and it includes both volatile and non-volatile media, removable and non-removable media.
System memory 28′ can include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30′ and/or cache memory 32′. Computer system/server 12′ may further include other removable/non-removable, volatile/non-volatile computer system storage media. By way of example only, storage system 34′ can be provided for reading from and writing to a non-removable, non-volatile magnetic media (not shown and typically called a “hard drive”). Although not shown, a magnetic disk drive for reading from and writing to a removable, non-volatile magnetic disk (e.g., a “floppy disk”), and an optical disk drive for reading from or writing to a removable, non-volatile optical disk such as a CD-ROM, DVD-ROM or other optical media can be provided. In such instances, each can be connected to bus 18′ by at least one data media interface. As will be further depicted and described below, memory 28′ may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
Program/utility 40′, having a set (at least one) of program modules 42′, may be stored in memory 28′ by way of example, and not limitation, as well as an operating system, at least one application program, other program modules, and program data. Each of the operating system, at least one application program, other program modules, and program data or some combination thereof, may include an implementation of a networking environment. Program modules 42′ generally carry out the functions and/or methodologies of embodiments of the invention as described herein.
Computer system/server 12′ may also communicate with at least one external device 14′ such as a keyboard, a pointing device, a display 24′, etc.; at least one device that enable a user to interact with computer system/server 12; and/or any devices (e.g., network card, modem, etc.) that enable computer system/server 12′ to communicate with at least one other computing device. Such communication can occur via I/O interfaces 22′. Still yet, computer system/server 12′ can communicate with at least one network such as a local area network (LAN), a general wide area network (WAN), and/or a public network (e.g., the Internet) via network adapter 20′. As depicted, network adapter 20′ communicates with the other components of computer system/server 12′ via bus 18′. It should be understood that although not shown, other hardware and/or software components could be used in conjunction with computer system/server 12′. Examples, include, but are not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data archival storage systems, etc.
It should be noted that aspects of the invention may be embodied as a system, method or computer program product. Accordingly, aspects of the invention may take the form of an entirely hardware embodiment, an entirely software embodiment (including firmware, resident software, micro-code, etc.) or an embodiment combining software and hardware aspects that may all generally be referred to herein as a “circuit,” “module” or “system.” Furthermore, aspects of the invention may take the form of a computer program product embodied in at least one computer readable medium having computer readable program code embodied thereon.
Any combination of at least one computer readable medium may be utilized. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having at least one wire, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wire line, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the invention may be written in any combination of at least one programming language, including an object oriented programming language such as Java®, Smalltalk, C++ or the like and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The program code may execute entirely on the user's computer (device), partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider).
Aspects of the invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer readable medium that can direct a computer, other programmable data processing apparatus, or other devices to function in a particular manner, such that the instructions stored in the computer readable medium produce an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks.
This disclosure has been presented for purposes of illustration and description but is not intended to be exhaustive or limiting. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiments were chosen and described in order to explain principles and practical application, and to enable others of ordinary skill in the art to understand the disclosure for various embodiments with various modifications as are suited to the particular use contemplated.
Although illustrative embodiments of the invention have been described herein with reference to the accompanying drawings, it is to be understood that the embodiments of the invention are not limited to those precise embodiments, and that various other changes and modifications may be affected therein by one skilled in the art without departing from the scope or spirit of the disclosure.