Run to end of an execution pattern in a software debugger

Techniques are described for a run to end of execution pattern in a software debugger. In one example, a method includes identifying a pattern of stop events in a program. The method further includes executing the program in a debugger, wherein executing the program includes encountering a stop event, determining if the stop event is part of the pattern of stop events, and ignoring the stop event in response to determining that the stop event is part of the pattern of stop events.

TECHNICAL FIELD

This disclosure relates to debuggers.

BACKGROUND

Programs written in compiled programming languages typically require debugging. A debugger is a computer software program used to test and debug programs. A user generally steps through the program from stopping point to stopping point (e.g., breakpoints) and stops the execution of a program at each of these stop events.

SUMMARY

In one aspect of the invention, a method includes identifying a pattern of stop events in a program. The method further includes executing the program in a debugger and with one or more processing devices, wherein executing the program includes encountering a stop event; determining if the stop event is part of the pattern of stop events; and ignoring the stop event in response to determining that the stop event is part of the pattern of stop events.

In another aspect, a computer system includes one or more processors and one or more computer-readable memories. The computer system also includes program instructions, stored on at least one of the one or more storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, to identify a pattern of stop events in a program. The computer system also includes instructions to encounter a stop event. The computer system also includes instructions to determine if the stop event is part of the pattern of stop events. The computer system also includes instructions to ignore the stop event in response to determining that the stop event is part of the pattern of stop events.

In another aspect, a computer program product includes a computer-readable storage medium having program code embodied therewith, the program code executable by a processor to identify a pattern of stop events in a program. The computer program product further includes program code to encounter a stop event. The computer program product also includes program code to determine if the stop event is part of the pattern of stop events. The computer program product also includes program code to ignore the stop event in response to determining that the stop event is part of the pattern of stop events.

DETAILED DESCRIPTION

A debugger is a computer software program used to test and debug programs. The debugging process can be time-consuming, especially when the program has long-running loops such that it can be difficult to move quickly through the program to arrive at a desired stopping point. Often, when debugging a program, where the user is stepping through the program code from stopping point to stopping point (e.g., breakpoints), the user may notice patterns in the program. For example, this might occur when the program code is in long-running loops. In many of these situations, the user knows that the desired stopping point in an execution of a program occurs after the pattern completes, but the user is unable to establish or reestablish breakpoints to avoid the pattern, keeping the program in execution, and getting the program closer to a desired stopping point without interruption.

Allowing the program to run to the completion of a pattern may provide a powerful feature for a debugger and may greatly enhance a user's productivity. Techniques of this disclosure may enable debugging of such code while keeping track of and avoiding known breakpoints within patterns such as long-running loops, thus speeding up the executing of the program to a desired stopping point or to identifying unknown breakpoints. Systems and methods for a run to end of an execution pattern in a debugger are described below.

FIG. 1depicts a block diagram of a debugger22that may perform, with one or more processors, a run to end of an execution pattern of a program code12, in one aspect of the disclosure.FIG. 1illustrates an example context in which debugger22may execute a program code12on a computing device80for debugging the program code12and may further perform a run to end of an execution pattern of the program code12. A pattern identifying unit24of debugger22may identify a pattern of stop events through the determination of current stop events and previous occurrences of the current stop event. Debugger22may determine if next occurrences of stop events are part of the pattern of stop events. A pattern operation unit26of debugger22may ignore the next occurrence of the stop event if the stop event is part of the identified pattern of stop events and may stop the execution of program code12if the next occurrence of the stop event is not a part of the identified pattern of stop events.

FIG. 2depicts a block diagram of an ordered list of stop events200, in one aspect of this disclosure. Debugger22may stop execution of program code12in response to hitting a stop event. Stop events may include a step completed, a breakpoint hit, a location, or a file and line number. In the present disclosure, debugger22may generate an ordered list200of stop events. For example,FIG. 2depicts one example of an ordered list200of nine stop events including a current stop event212, a previous occurrence214of the current stop event, one or more unrelated stop events218A-218F (collectively “unrelated stop events218”), and one or more next occurrences216-216C (collectively “next occurrences216”) of the current stop event. Debugger22may stop at a breakpoint at line fifty of program code12, which may be the current stop event212in the ordered list200of stop events. The ordered list200of debugger22may also list a previous occurrence214of the current stop event212. For example, previous occurrence214may have occurred at another breakpoint related to the breakpoint found at line fifty of program code12(the current stop event212), and is located in ordered list200before the current stop event212. In another example, the previous occurrence214may be the nearest past occurrence to the current stop event212among multiple past occurrences214. The ordered list200may further list one or more next occurrences216related to the current stop event212, and located after the current stop event212in the ordered list200. For example, one of the next occurrences216may occur at another, subsequent breakpoint related to the breakpoint found at line fifty of the program code12(the current stop event212), which may be located after the current stop event12. The ordered list200may also list a counter220to enter a sequence of one or more stop events associated with program code12. The ordered list200in this disclosure is not limited to the illustrative order depicted inFIG. 2and may include variations of current stop events212, one or more previous occurrences214, one or more next occurrences216, and one or more unrelated stop events218.

FIG. 3depicts a flowchart of an example debugging method300, in one aspect of this disclosure. More specifically,FIG. 3illustrates an example context in which a method of a run to end of an execution pattern in debugger22as inFIG. 1may resume an execution of program code12of debugger22in response to identifying a pattern. For example, debugger22may receive a pattern end command (302), which may be an execution command informing debugger22to run a debugging process without stopping debugger22during execution of program code having a particular pattern of stop events. After debugger22receives the pattern end command, debugger22may identify a current stop event212in a running program code12(304), which may be a latest entry in an ordered list200of stop events. Debugger22may track the stop events as they come in along with the corresponding line numbers in program code12. In the present disclosure, one or more stop events may be listed in an ordered list200of stop events detailing the order in which the stop events occur, such as is shown inFIG. 2.

After debugger22identifies the current stop event212in a running program code12, debugger22identifies a previous occurrence214related to the current stop event212from the ordered list200(306). For example, if debugger22stopped at line fifty in a program code12due to a breakpoint being hit, debugger22may start looking backwards, or other direction representing a previous instance, on the list200for the previous occurrence214of a breakpoint being hit. Debugger22identifies a pattern of stop events if the current stop event212and previous occurrence214match.

Debugger22determines one or more next occurrences216in the ordered list200(308). For example, in the previous example, if another previous occurrence of a breakpoint is hit at line fifty of program code12, debugger22may look for one or more next occurrences216of a breakpoint at the next occurrence of line fifty of program code12.

In response to finding one or more next occurrences216, debugger22may begin determining if the one or more next occurrences216in the ordered list200are part of the pattern. The pattern is further developed by entering a sequence of one or more stop events associated with program code12. For example, counter220may be advanced in the ordered list200for each match event (310). More specifically, debugger22may compare one or more next occurrences216to the current stop event212. When the one or more next occurrences216match the current stop event212, the counter220in the ordered list200is advanced to indicate the current stop event212is part of the pattern. Along with the advancement of the counter212in the ordered list200, the programming execution of debugger22ignores the current stop event216and continues execution of program code12(312). Thus, with each match, the stop event may be ignored, a sequence of the one or more stop events is entered, and debugger22may resume execution of program code12. Debugger22may repeat the process to determine a next occurrence in the ordered list200(308), advance counter220in the ordered list200for each match event (310), and resume the execution of program code12executed by debugger22(312) with each match event, for example.

If there is no match between the next occurrence216and the current stop event212, the pattern is broken. For example, if the next occurrence216does not match the current stop event212, debugger22may end the sequence (e.g., clearing the counter220in the ordered list220) and may stop the program execution from resuming (314).

FIG. 4depicts a flowchart of another example debugging method400, in one aspect of this disclosure. Debugging method400ofFIG. 4is analogous to debugging method300ofFIG. 3, except as described below. More specifically, debugging method400ofFIG. 4also illustrates an example context in which debugger22developing a pattern further includes debugger22defining one or more conditional statements, such as one or more additional stop events, to add to the pattern (402), and determining the existence of an additional stop event based on the defined additional stop event (404). For example, additional stop events would allow the user to add conditional logic so that a stop event at line five or seven of a program code such as program code12may also continue the pattern and not stop the program execution.

FIG. 5depicts a flowchart of another example debugging method500, in one aspect of this disclosure. Debugging method500ofFIG. 5is analogous to debugging method300ofFIG. 3, except as described below. More specifically, debugging method500ofFIG. 5also illustrates an example context in which debugger22determining a next occurrence216in the ordered list200further includes debugger22defining one or more conditional statements, such as a multiple occurrence criteria (502), and determining if the next occurrence216occurs in a multiple occurrence defined by the multiple occurrence criteria (504). For example, debugger22may respond to receiving a pattern end command such as “Patternend 3” by looking for at least three of the last three next occurrences216of the current stop event212. A multiple occurrence criteria may require debugger22to match three different execution patterns. For example, defining a multiple occurrence would allow the program to continue execution and would only stop if an incoming stop event does not match any of the three patterns.

FIG. 6shows a flowchart of another example debugging method, in one aspect of this disclosure. Debugging method600ofFIG. 6is analogous to debugging method300ofFIG. 3, except as described below. More specifically, debugging method600ofFIG. 6also illustrates an example context in which debugger22developing a pattern further includes debugger22defining one or more conditional statements, such as one or more exclusion criteria, to exclude from the pattern (602), and determining whether an exclusion exists for the next occurrence216based on the defined exclusion criteria (604). For example, a pattern end command in debugger22may include the command, “patternend*exclude foo.c:24” that would cause debugger22to exclude from the pattern any event located at foo.c:24 such that this event may not be checked by the debugger22.

FIG. 7shows a flowchart of another example debugging method, in one aspect of this disclosure. Debugging method700ofFIG. 7is analogous to debugging method300ofFIG. 3, except as described below. More specifically, debugging method700ofFIG. 7also illustrates an example context in which debugger22developing a pattern further includes debugger22defining one or more conditional statements, such as a loop function, for learning a pattern while running the loop, and stopping the program execution when the code strays from the pattern (702), and determining a loop pattern and determining a deviation from the loop pattern (704). For example, the loop function may be invoked by a user before a loop within the program, which would learn the pattern in the following loop iteration, and break when deviating from the pattern. Thus, debugger22would run the loop several times, learn the pattern of which program line numbers are common, and then only stop when the code strays from the learned pattern.

FIG. 8shows a flowchart of an example debugging method, in one aspect of this disclosure. Debugger22may execute program code12on a computing device80. When debugger22debugs program code12, debugger22may identify a pattern of stop events in the program code12(802) as detailed below. For example, the identification of the pattern of stop events from the pattern identifying unit24may include the determination of current stop events212, previous occurrences214of a current stop event, and next occurrences216of the current stop event. In response to a pattern being identified, debugger22may additionally execute program code12(804) to determine whether the next stop events are part of the pattern (e.g., debugger22performing block308and one of blocks404,504,604, or704as inFIGS. 3-7). For example, debugger22may execute program code12and may encounter a stop event (806). Debugger22may also determine from program code12if the encountered stop event is part of the identified pattern of the stop events (808).

Debugger22may further ignore the stop event in response to determining that the stop event is part of the identified pattern of stop events (810) (e.g., pattern operation unit26of debugger22performing ignoring310and312as inFIGS. 3-7). In some examples, debugger22may optionally further stop the execution of program code12if the stop event is not part of the identified pattern of stop events (812) (e.g., pattern operation unit26of debugger22performing stopping314inFIGS. 3-7).

FIG. 9is a block diagram of a computing device80that may be used to implement debugger22, in one aspect of this disclosure. Computing device80may be a server such as one of web servers or application servers. Computing device80may also be any server for providing an enterprise business intelligence application in various examples, including a virtual server that may be run from or incorporate any number of computing devices. A computing device may operate as all or part of a real or virtual server, and may be or incorporate a workstation, server, mainframe computer, notebook or laptop computer, desktop computer, tablet, smartphone, feature phone, or other programmable data processing apparatus of any kind. Other implementations of a computing device80may include a computer having capabilities or formats other than or beyond those described herein.

In the illustrative example ofFIG. 9, computing device80includes communications fabric82, which provides communications between processor unit84, memory86, persistent data storage88, communications unit90, and input/output (I/O) unit92. Communications fabric82may include a dedicated system bus, a general system bus, multiple buses arranged in hierarchical form, any other type of bus, bus network, switch fabric, or other interconnection technology. Communications fabric82supports transfer of data, commands, and other information between various subsystems of computing device80.

Processor unit84may be a programmable central processing unit (CPU) configured for executing programmed instructions stored in memory86. In another illustrative example, processor unit84may be implemented using one or more heterogeneous processor systems in which a main processor is present with secondary processors on a single chip. In yet another illustrative example, processor unit84may be a symmetric multi-processor system containing multiple processors of the same type. Processor unit84may be a reduced instruction set computing (RISC) microprocessor such as a PowerPC® processor from IBM® Corporation, an x86 compatible processor such as a Pentium® processor from Intel® Corporation, an Athlon® processor from Advanced Micro Devices® Corporation, or any other suitable processor. In various examples, processor unit84may include a multi-core processor, such as a dual core or quad core processor, for example. Processor unit84may include multiple processing chips on one die, and/or multiple dies on one package or substrate, for example. Processor unit84may also include one or more levels of integrated cache memory, for example. In various examples, processor unit84may comprise one or more CPUs distributed across one or more locations.

Data storage96includes memory86and persistent data storage88, which are in communication with processor unit84through communications fabric82. Memory86can include a random access semiconductor memory (RAM) for storing application data, i.e., computer program data, for processing. While memory86is depicted conceptually as a single monolithic entity, in various examples, memory86may be arranged in a hierarchy of caches and in other memory devices, in a single physical location, or distributed across a plurality of physical systems in various forms. While memory86is depicted physically separated from processor unit84and other elements of computing device80, memory86may refer equivalently to any intermediate or cache memory at any location throughout computing device80, including cache memory proximate to or integrated with processor unit84or individual cores of processor unit84.

Persistent data storage88may include one or more hard disc drives, solid state drives, flash drives, rewritable optical disc drives, magnetic tape drives, or any combination of these or other data storage mediums. Persistent data storage88may store computer-executable instructions or computer-readable program code for an operating system, application files including program code, data structures or data files, and any other type of data. These computer-executable instructions may be loaded from persistent data storage88into memory86to be read and executed by processor unit84or other processors. Data storage96may also include any other hardware elements capable of storing information, such as, for example and without limitation, data, program code in functional form, and/or other suitable information, either on a temporary basis and/or a permanent basis.

Persistent data storage88and memory86are examples of physical, computer-readable data storage devices. Data storage96may include any of various forms of volatile memory that may require being periodically electrically refreshed to maintain data in memory, while those skilled in the art will recognize that this also constitutes an example of a physical computer-readable data storage device. Executable instructions may be stored on a medium when program code is loaded, stored, relayed, buffered, or cached on a physical medium or device, including if only for only a short duration or only in a volatile memory format.

Processor unit84can also be suitably programmed to read, load, and execute computer-executable instructions or computer-readable program code for a debugger22, as described in greater detail above. This program code may be stored on memory86, persistent data storage88, or elsewhere in computing device80. This program code may also take the form of program code104stored on computer-readable medium102comprised in computer program product100, and may be transferred or communicated, through any of a variety of local or remote means, from computer program product100to computing device80to be enabled to be executed by processor unit84, as further explained below. In other embodiments, program code104need not include all of the program code for debugger22, but includes at least program code of pattern identifying unit24and pattern operation unit26

The operating system may provide functions such as device interface management, memory management, and multiple task management. The operating system can be a Unix based operating system such as the AIX® operating system from IBM® Corporation, a non-Unix based operating system such as the Windows® family of operating systems from Microsoft® Corporation, a network operating system such as JavaOS® from Oracle® Corporation, or any other suitable operating system. Processor unit84can be suitably programmed to read, load, and execute instructions of the operating system.

Communications unit90, in this example, provides for communications with other computing or communications systems or devices. Communications unit90may provide communications through the use of physical and/or wireless communications links. Communications unit90may include a network interface card for interfacing with a LAN, an Ethernet adapter, a Token Ring adapter, a modem for connecting to a transmission system such as a telephone line, or any other type of communication interface. Communications unit90can be used for operationally connecting many types of peripheral computing devices to computing device80, such as printers, bus adapters, and other computers. Communications unit90may be implemented as an expansion card or be built into a motherboard, for example.

The input/output unit92can support devices suited for input and output of data with other devices that may be connected to computing device80, such as keyboard, a mouse or other pointer, a touchscreen interface, an interface for a printer or any other peripheral device, a removable magnetic or optical disc drive (including CD-ROM, DVD-ROM, or Blu-Ray), a universal serial bus (USB) receptacle, or any other type of input and/or output device. Input/output unit92may also include any type of interface for video output in any type of video output protocol and any type of monitor or other video display technology, in various examples. It will be understood that some of these examples may overlap with each other, or with example components of communications unit90or data storage96. Input/output unit92may also include appropriate device drivers for any type of external device, or such device drivers may reside elsewhere on computing device80as appropriate.

Computing device80also includes a display adapter94in this illustrative example, which provides one or more connections for one or more display devices, such as display device98, which may include any of a variety of types of display devices. It will be understood that some of these examples may overlap with example components of communications unit90or input/output unit92. Input/output unit92may also include appropriate device drivers for any type of external device, or such device drivers may reside elsewhere on computing device80as appropriate. Display adapter94may include one or more video cards, one or more graphics processing units (GPUs), one or more video-capable connection ports, or any other type of data connector capable of communicating video data, in various examples. Display device98may be any kind of video display device, such as a monitor, a television, or a projector, in various examples.

Input/output unit92may include a drive, socket, or outlet for receiving computer program product100, which includes a computer-readable medium102having computer program code104stored thereon. For example, computer program product100may be a CD-ROM, a DVD-ROM, a Blu-Ray disc, a magnetic disc, a USB stick, a flash drive, or an external hard disc drive, as illustrative examples, or any other suitable data storage technology.

Computer-readable medium102may include any type of optical, magnetic, or other physical medium that physically encodes program code104as a binary series of different physical states in each unit of memory that, when read by computing device80, induces a physical signal that is read by processor84that corresponds to the physical states of the basic data storage elements of storage medium102, and that induces corresponding changes in the physical state of processor unit84. That physical program code signal may be modeled or conceptualized as computer-readable instructions at any of various levels of abstraction, such as a high-level programming language, assembly language, or machine language, but ultimately constitutes a series of physical electrical and/or magnetic interactions that physically induce a change in the physical state of processor unit84, thereby physically causing or configuring processor unit84to generate physical outputs that correspond to the computer-executable instructions, in a way that causes computing device80to physically assume new capabilities that it did not have until its physical state was changed by loading the executable instructions comprised in program code104.

In some illustrative examples, program code104may be downloaded over a network to data storage96from another device or computer system for use within computing device80. Program code104including computer-executable instructions may be communicated or transferred to computing device80from computer-readable medium102through a hard-line or wireless communications link to communications unit90and/or through a connection to input/output unit92. Computer-readable medium102including program code104may be located at a separate or remote location from computing device80, and may be located anywhere, including at any remote geographical location anywhere in the world, and may relay program code104to computing device80over any type of one or more communication links, such as the Internet and/or other packet data networks. The program code104may be transmitted over a wireless Internet connection, or over a shorter-range direct wireless connection such as wireless LAN, Bluetooth, Wi-Fi™, or an infrared connection, for example. Any other wireless or remote communication protocol may also be used in other implementations.

The communications link and/or the connection may include wired and/or wireless connections in various illustrative examples, and program code104may be transmitted from a source computer-readable medium102over non-tangible mediums, such as communications links or wireless transmissions containing the program code104. Program code104may be more or less temporarily or durably stored on any number of intermediate, physical computer-readable devices and mediums, such as any number of physical buffers, caches, main memory, or data storage components of servers, gateways, network nodes, mobility management entities, or other network assets, en route from its original source medium to computing device80.