Method and apparatus for enhancing an executable is disclosed herein. In one embodiment, the method includes instrumenting an executable with additional program code to detect run-time errors, and while running the instrumented executable within a debug environment generating the run-time errors detected by the additional program code, upon reaching a breakpoint, identifying any of the run-time errors which occurred while executing a function in which the breakpoint is located, and transmitting an indication of the identified run-time errors to the debugging environment.
|
1. A method for enhancing debugging of an executable, comprising:
instrumenting an executable with additional program code to detect a plurality of predefined run-time errors defined by a plurality of analysis parameters; and
while running the instrumented executable within a debug environment:
generating the plurality of predefined run-time errors comprising a first predefined run-time error and a second predefined run-time error detected by the additional program code;
generating a record of the first predefined run-time error, the record associating the first predefined run-time error with a stack frame of a first function that was being executed when the first predefined run-time error occurred, wherein the first function was invoked by a second function associated with the second predefined run-time error;
upon reaching a breakpoint in the second function, identifying any of the predefined run-time errors which occurred while executing the second function, wherein the stack frame of the first function is removed from the stack prior to reaching the breakpoint;
transmitting the record of the first predefined run-time error to the debugging environment; and
outputting an indication of the record of the first predefined run-time error for display within the debug environment.
2. The method of
creating a log;
responsive to the first predefined run-time error of the plurality of predefined run-time errors occurring, updating a record of the first predefined run-time error in the log; and
continuing to run the instrumented executable until the breakpoint is hit.
3. The method of
scanning parameters passed to a routine in the instrumented executable to detect the first predefined run-time error.
4. The method of
using data flow analysis to detect the plurality of predefined run-time errors defined by the plurality of analysis parameters in the instrumented executable by associating each detected predefined run-time error with a respective record in a debug log, wherein each record associates the detected predefined run-time error with a respective stack frame of a respective function being executed when the respective predefined run-time error is detected.
5. The method of
6. The method of
defining the plurality of analysis parameters for the executable.
|
This application is a continuation of co-pending U.S. patent application Ser. No. 14/818,181, filed Aug. 4, 2015. The aforementioned related application is herein incorporated by reference in its entirety.
The present invention relates to debugging an executable at runtime to provide additional data to a debugger and a dynamic analysis tool, and more specifically, to generating dynamic analysis errors in an executable in the context of a debugger.
An issue in developing software is that the quality of code is dependent on many factors, such as the skill level of the developers, the quality of testing, and the sufficient time to test every path of code. In today's competitive market, the time to design, generate, and test code is constantly shrinking, while the time to fix problems within the code is becoming increasingly more critical. There is a need to provide better tools for developers to help speed the diagnostic process and help developers become more proactive at looking for potential problem areas before issues arise in the field.
Dynamic analysis tools, such as PurifyPlus™, available from UNICOM Systems, Inc., provide a toolset that improves the reliability of software applications by identifying difficult to find memory errors, such as uninitialized memory access, buffer overflow, and improper freeing of memory. A limitation of dynamic analysis tools, however, is when the dynamic analysis tools are used on existing executables for the first time. In such cases, the dynamic analysis tools may detect numerous errors that have been in the code for a long time. Depending on the size of the code, and the number of revisions, versions, or related systems, the dynamic analysis tool may detect hundreds, if not thousands, of issues. Many of the errors identified by the dynamic analysis tools may be harmless or very unlikely to disrupt overall program operation or result in incorrect computing results, and thus, may not worth the time to fix. In any case, the sheer number of errors can overwhelm a developer. More importantly, the sheer number of errors can make it very difficult for a developer to determine which errors are related to the particular problem the developer is trying to fix address, especially when the developer is under pressure to fix the problem quickly.
According to one embodiment of the present invention, a method for enhancing debugging of an executable is disclosed herein. The method includes instrumenting an executable with additional program code to detect run-time errors, and while running the instrumented executable within a debug environment generating the run-time errors detected by the additional program code, upon reaching a breakpoint, identifying any of the run-time errors which occurred while executing a function in which the breakpoint is located, and transmitting an indication of the identified run-time errors to the debugging environment.
According to one embodiment of the present invention, a system is disclosed herein. The system includes a processor and a memory storing program code, which, when executed on the processor, performs an operation of enhancing the debugging of an executable. The operation includes instrumenting an executable with additional program code to detect run-time errors, and while running the instrumented executable within a debug environment generating the run-time errors detected by the additional program code, upon reaching a breakpoint, identifying any of the run-time errors which occurred while executing a function in which the breakpoint is located, and transmitting an indication of the identified run-time errors to the debugging environment.
According to one embodiment of the present invention, a computer program product for enhancing debugging of an executable is disclosed herein. The computer program product includes a computer-readable storage medium having computer-readable program code embodied therewith. The computer-readable program code includes computer-readable program code configured to instrument an executable with additional program code to detect run-time errors and while running the instrumented executable within a debug environment, computer-readable program code configured to generate the run-time errors detected by the additional program code, computer-readable program code configured to identify any of the run-time errors which occurred while executing a function in which a breakpoint is located upon reaching the breakpoint, and computer-readable program code configured to transmit an indication of the identified run-time errors to the debugging environment.
So that the manner in which the above recited features of the present disclosure can be understood in detail, a more particular description of the disclosure, briefly summarized above, may be referenced by embodiments, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only typical embodiments of this disclosure and are therefore not to be considered limiting of its scope, for the disclosure may admit to other equally effective embodiments.
For clarity, identical reference numerals have been used, where applicable, to designate identical elements that are common between figures. Additionally, elements of one embodiment may be adapted for use with other embodiments.
Embodiments presented herein describe techniques for enhancing the debugging of an executable using dynamic analysis tool and a debugger. In one embodiment, the dynamic analysis tool instruments an executable with additional program code to obtain information about the executable at run-time. The instrumented executable is then run in a debug environment. A debugger presents the errors detected by the instrumented code in context of a given debug session state.
In one embodiment, the dynamic analysis tool instruments the executable with additional executable code that detects certain run-time errors when the instrumented code is executed. The dynamic analysis tool may have dynamic analysis parameters set before the analysis begins. For example, the dynamic analysis tool may be configured to detect only certain errors, such as memory leaks. Breakpoints may be set so that the developer can halt the executable at certain points during the analysis. The dynamic analysis tool instruments the executable with additional executable code to detect errors in the executable.
In one embodiment, the debugger provides the run-time errors generated during run-time in the context of a debug environment. The debugger may have parameters set before debugging of the instrumented executable begins. For example, the debugger may only provide certain dynamic analysis errors in the context of a debug environment. The debugger selects an instrumented executable for debugging. The developer may set breakpoints within the code to halt execution of the program at specified locations. For example, the developer may want to set breakpoints after a certain call sequence in the instrumented executable. The instrumented executable is then executed in the debug environment. In one embodiment, debugging of the executable may include advanced data flow analysis to provide a more detailed analysis of the run-time errors.
While the current level of integration between dynamic analysis tools and a debugger is helpful, it does not adequately help the user determine which errors detected by the dynamic analysis tool are related to a particular issue. Embodiments presented herein provide techniques for better integrating a dynamic analysis tool and a debugger. More specifically, embodiments presented herein integrate certain capabilities of the dynamic analysis tool with a debugger to assist developers in identifying specific issues that may be causing the problem they are trying to debug.
The disclosure tracks issues by instrumenting debuggable code with a dynamic analysis tool. Once a program under test (PUT) is instrumented, the debugger will detect errors in the PUT at execution. For this disclosure, errors occurring within a particular function and stack frame are tracked and associated with that routine and stack frame. When an error is detected, the stack display in a debugging interface is updated to show the developer what calling routines had problems detected by the instrumented code, prior to execution reaching the current breakpoint. Doing so allows developers to quickly determine what errors detected by the instrumentation may be related to the problem they are seeing.
The dynamic analysis tool 115 is an application generally configured to instrument executables, such as one of the project file 125 in database 130. The dynamic analysis tool 115 provides a toolset that improves the reliability of executables by identifying difficult to find memory errors, such as uninitialized memory access, buffer overflow, and improper freeing of memory. To do so, the analysis tool 115 instruments an executable program with additional code that, while generally transparent to the operations of the executable, detects and reports on certain errors or problems identified at runtime. The dynamic analysis tool 115 may be used while building an executable or on an existing executable.
The debugger 110 is an application generally configured to test and/or debug other executables, such as one of the project files 125 in database 130. The debugger 110 allows the developer to diagnose and correct problems that occur during runtime. For example, a developer can use the debugger 110 to insert breakpoints at locations in a program where the program crashes or where the program does not produce the correct results.
In the computing environment 100, the dynamic analysis tool 115 works with the debugger 110 to assist developers in zeroing in on potential issues that may be causing a problem the developer is trying to debug. To do this, the dynamic analysis tool 115 instruments the executable with additional executable code to detect errors at runtime. The debugger 110 will provide the errors found by the instrumented code in the context of a debug environment.
Referring to
The CPU 1004 retrieves and executes programming instructions stored in the memory 1006 as well as stores and retrieves application data residing in the memory 1006. The bus 1014 is used to transmit programming instructions and application data between the CPU 1004, memory 1006, storage 1008, network interface 1012, and I/O device 1016. Note, CPU 1004 is included to be representative of a single CPU, multiple CPUs, a single CPU having multiple processing cores, and the like. The memory 1006 is generally included to be representative of a random access memory. The storage 1008 may be a disk drive storage device. Although shown as a single unit, the storage 1008 may be a combination of a fixed and/or removable storage devices, such as fixed disc drives, removable memory cards, optical storage, network attached storage (NAS), or storage-area-network (SAN). The storage 1008 may include settings 1024. The network interface 1012 may be any type of network communications allowing the computer 1002 to communicate with other computers via the network 1022.
The memory 1006 further includes a debugger 1018 and a dynamic analysis tool 1020. The debugger 1018 is an application generally configured to test and/or debug other executables. The debugger 1018 allows the developer to pinpoint anomalies that occur during runtime. For example, the debugger 110 can insert breakpoints at instances where a given processing element crashes, sends data to an unintended target processing element, etc.
The dynamic analysis tool 1020 is an application generally configured to test executables. The dynamic analysis tool 1020 provides a toolset that improves the reliability of executables by identifying difficult to find memory errors, such as uninitialized memory access, buffer overflow, and improper freeing of memory. An example of a dynamic analysis tool 1020 is PurifyPlus™ offered by UNICOM. The dynamic analysis tool 1020 may be used in runtime or on an existing executable.
The descriptions of the various embodiments of the present invention have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application, or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method, or computer program product. Accordingly, aspects of the present 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 present invention may take the form of a computer program product embodied in one or more computer readable medium(s) having computer readable program code embodied thereon.
Any combination of one or more computer readable medium(s) 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 one or more wires, 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, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, 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, 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 present invention are described below 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.
Embodiments of the invention may be provided to end users through a cloud computing infrastructure. Cloud computing generally refers to the provision of scalable computing resources as a service over a network. More formally, cloud computing may be defined as a computing capability that provides an abstraction between the computing resource and its underlying technical architecture (e.g., servers, storage, networks), enabling convenient, on-demand network access to a shared pool of configurable computing resources that can be rapidly provisioned and released with minimal management effort or service provider interaction. Thus, cloud computing allows a user to access virtual computing resources (e.g., storage, data, applications, and even complete virtualized computing systems) in “the cloud,” without regard for the underlying physical systems (or locations of those systems) used to provide the computing resources.
Typically, cloud computing resources are provided to a user on a pay-per-use basis, where users are charged only for the computing resources actually used (e.g. an amount of storage space consumed by a user or a number of virtualized systems instantiated by the user). A user can access any of the resources that reside in the cloud at any time, and from anywhere across the Internet. In context of the present invention, a user may access applications (e.g., debugger or dynamic analysis tool) or related data available in the cloud. For example, the debugger and dynamic analysis tool could execute on a computing system in the cloud, detect runtime errors, and provide those errors in a runtime environment in the cloud. In such a case, the dynamic analysis tool could instrument an existing executable with additional program code to detect dynamic analysis errors and store the instrumented executable in the cloud so that the instrumented executable can later be run in a debug environment provide the runtime errors in the context of a debug environment location in the cloud. Doing so allows a user to access this information from any computing system attached to a network connected to the cloud (e.g., the Internet).
The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: 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), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, 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 computer readable program instructions may execute entirely on the user's computer, 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). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present 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 readable program instructions.
These computer readable 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 readable program instructions may also be stored in a computer readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). 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 carry out combinations of special purpose hardware and computer instructions.
While the foregoing is directed to embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow.
Bates, Cary L., Helgeson, Lee, King, Justin K., Schlicht, Michelle A.
Patent | Priority | Assignee | Title |
Patent | Priority | Assignee | Title |
6085029, | May 09 1995 | Parasoft Corporation | Method using a computer for automatically instrumenting a computer program for dynamic debugging |
8719791, | May 31 2012 | GOOGLE LLC | Display of aggregated stack traces in a source code viewer |
8789023, | Jul 23 2004 | Green Hills Software, Inc. | Backward post-execution software debugger |
9542300, | Mar 15 2013 | Twitter, Inc. | System and method for tracking callback functions for error identification |
20040054991, | |||
20050028145, | |||
20050071820, | |||
20080127119, | |||
20080256519, | |||
20090100413, | |||
20110107307, | |||
20130074045, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Aug 03 2015 | KING, JUSTIN K | International Business Machines Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 036587 | /0424 | |
Aug 03 2015 | SCHLICHT, MICHELLE A | International Business Machines Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 036587 | /0424 | |
Aug 04 2015 | BATES, CARY L | International Business Machines Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 036587 | /0424 | |
Aug 04 2015 | HELGESON, LEE | International Business Machines Corporation | ASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS | 036587 | /0424 | |
Aug 25 2015 | International Business Machines Corporation | (assignment on the face of the patent) | / |
Date | Maintenance Fee Events |
Mar 28 2022 | REM: Maintenance Fee Reminder Mailed. |
Sep 12 2022 | EXP: Patent Expired for Failure to Pay Maintenance Fees. |
Date | Maintenance Schedule |
Aug 07 2021 | 4 years fee payment window open |
Feb 07 2022 | 6 months grace period start (w surcharge) |
Aug 07 2022 | patent expiry (for year 4) |
Aug 07 2024 | 2 years to revive unintentionally abandoned end. (for year 4) |
Aug 07 2025 | 8 years fee payment window open |
Feb 07 2026 | 6 months grace period start (w surcharge) |
Aug 07 2026 | patent expiry (for year 8) |
Aug 07 2028 | 2 years to revive unintentionally abandoned end. (for year 8) |
Aug 07 2029 | 12 years fee payment window open |
Feb 07 2030 | 6 months grace period start (w surcharge) |
Aug 07 2030 | patent expiry (for year 12) |
Aug 07 2032 | 2 years to revive unintentionally abandoned end. (for year 12) |