This disclosure relates generally to the field of software development, and more particularly to breakpoints that are used for debugging program source code during software development.
A breakpoint is a stopping or pausing place that is inserted into program source code for debugging purposes. Breakpoints are used to stop a program at a desired location so that the state of a program can be observed at that location, to enhance understanding of the program's design and behavior, or to investigate a particular bug in the program's flow. During execution of the program by a debugger, when the debugger encounters a breakpoint, the debugger pauses at the point in the program source code at which the breakpoint is located. This pause allows the developer to inspect the test environment (for example, the contents of general purpose registers, memory, logs, files, variable values, and the like) at the breakpoint to find out whether the program is functioning as expected at that point.
Breakpoints may be added to program source code either before or during a debugging session, and may be associated with a particular line number in the file containing the program source code. However, if the program source code is modified, the line that was used set the breakpoint may be removed or repositioned in the source code file. This may render the breakpoint meaningless, as the debugger will pause at an incorrect point in the program during further debugging, due to the incorrect line number associated with the breakpoint. Therefore, breakpoints may be discarded when the program source code is modified, forcing the programmer to re-create the breakpoints whenever the program source code is modified, which may be time consuming. Also, while a customized editor may update the breakpoint line numbers as the user modifies the source, modifying the program source code in a different editor may not update the breakpoints, potentially causing breakpoints to become invalid. Therefore, a programmer may be forced to use the customized editor in order to maintain the breakpoint.
In one aspect, a method for breakpoint synchronization in program source code includes in response to creation of a breakpoint in the program source code, storing by a computer, in a breakpoint store, a line number of the breakpoint and line contents corresponding to text located at the stored line number in the program source code; in the event the program source code is modified, synchronizing the breakpoint with the modified program source code, wherein synchronizing the breakpoint with the modified program source code comprises: searching the modified program source code for the stored line contents; identifying an updated line number for the breakpoint; inserting the breakpoint at the updated line number in the modified program source code; and updating the breakpoint store with the updated line number.
In another aspect, a computer program product comprising a computer readable storage medium containing computer code that, when executed by a computer, implements a method for breakpoint synchronization in program source code, wherein the method includes in response to creation of a breakpoint in the program source code, storing, in a breakpoint store, a line number of the breakpoint and line contents corresponding to text located at the stored line number in the program source code; in the event the program source code is modified, synchronizing the breakpoint with the modified program source code, wherein synchronizing the breakpoint with the modified program source code comprises: searching the modified program source code for the stored line contents; identifying an updated line number for the breakpoint; inserting the breakpoint at the updated line number in the modified program source code; and updating the breakpoint store with the updated line number.
In another aspect, a system for breakpoint synchronization in program source code includes a synchronization module comprising a computer configured to: in response to creation of a breakpoint in the program source code, store, in a breakpoint store, a line number of the breakpoint and line contents corresponding to text located at the stored line number in the program source code; in the event the program source code is modified, synchronize the breakpoint with the modified program source code, wherein synchronizing the breakpoint with the modified program source code comprises: searching the modified program source code for the stored line contents; identifying an updated line number for the breakpoint; inserting the breakpoint at the updated line number in the modified program source code; and updating the breakpoint store with the updated line number.
Additional features are realized through the techniques of the present exemplary embodiment. Other embodiments are described in detail herein and are considered a part of what is claimed. For a better understanding of the features of the exemplary embodiment, refer to the description and to the drawings.
Referring now to the drawings wherein like elements are numbered alike in the several FIGURES:
Embodiments of systems and methods for breakpoint synchronization for modified program source code are provided, with exemplary embodiments being discussed below in detail. To avoid invalidation of breakpoints in program source code when the program source code is modified, the breakpoint and associated line number may be stored separately from the program source code in a central repository referred to as a breakpoint store, with additional information including the contents (i.e., the text) of a line or lines with which the breakpoint is associated. The breakpoints may then be synchronized with the modified program source code when it is opened in a debugger by searching for the stored line contents in the modified program source code. Programmers are therefore not tied to a specific debugger or editor in order to manage the breakpoints, as the line contents stored in the breakpoint store may synchronize with program source code in any debugger or editor that supports externally stored breakpoints. This is particularly beneficial for team-based software development where many different programmers may edit a program source code file.
Some types of program source code may be changed each time the program is built, such as program source code processed by SQL, macro pre-processors or debugging from a compiler listing. Breakpoints may be invalidated each time the program is built in such types of program source code. However, separate storage of breakpoint line contents information allows synchronization of the breakpoints with the program source code each time it is changed. Breakpoint synchronization may also be used for program listings, disassembly, and any other view of a program.
Then, flow proceeds to block 104, in which the breakpoints in the program source code are synchronized with the modified program source code. Synchronization may be triggered by, for example, opening the program source code in a debugger. Synchronization is discussed in further detail with respect to
Turning to method 200 of
An example of execution of
The computer 700 includes, but is not limited to, PCs, workstations, laptops, PDAs, palm devices, servers, storages, and the like. Generally, in terms of hardware architecture, the computer 700 may include one or more processors 710, memory 720, and one or more input and/or output (I/O) devices 770 that are communicatively coupled via a local interface (not shown). The local interface can be, for example but not limited to, one or more buses or other wired or wireless connections, as is known in the art. The local interface may have additional elements, such as controllers, buffers (caches), drivers, repeaters, and receivers, to enable communications. Further, the local interface may include address, control, and/or data connections to enable appropriate communications among the aforementioned components.
The processor 710 is a hardware device for executing software that can be stored in the memory 720. The processor 710 can be virtually any custom made or commercially available processor, a central processing unit (CPU), a digital signal processor (DSP), or an auxiliary processor among several processors associated with the computer 700, and the processor 710 may be a semiconductor based microprocessor (in the form of a microchip) or a macroprocessor.
The memory 720 can include any one or combination of volatile memory elements (e.g., random access memory (RAM), such as dynamic random access memory (DRAM), static random access memory (SRAM), etc.) and nonvolatile memory elements (e.g., ROM, erasable programmable read only memory (EPROM), electronically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), tape, compact disc read only memory (CD-ROM), disk, diskette, cartridge, cassette or the like, etc.). Moreover, the memory 720 may incorporate electronic, magnetic, optical, and/or other types of storage media. Note that the memory 720 can have a distributed architecture, where various components are situated remote from one another, but can be accessed by the processor 710.
The software in the memory 720 may include one or more separate programs, each of which comprises an ordered listing of executable instructions for implementing logical functions. The software in the memory 720 includes a suitable operating system (O/S) 750, compiler 740, source code 730, and one or more applications 760 in accordance with exemplary embodiments. As illustrated, the application 760 comprises numerous functional components for implementing the features and operations of the exemplary embodiments. The application 760 of the computer 700 may represent various applications, computational units, logic, functional units, processes, operations, virtual entities, and/or modules in accordance with exemplary embodiments, but the application 760 is not meant to be a limitation.
The operating system 750 controls the execution of other computer programs, and provides scheduling, input-output control, file and data management, memory management, and communication control and related services. It is contemplated by the inventors that the application 760 for implementing exemplary embodiments may be applicable on all commercially available operating systems.
Application 760 may be a source program, executable program (object code), script, or any other entity comprising a set of instructions to be performed. When a source program, then the program is usually translated via a compiler (such as the compiler 740), assembler, interpreter, or the like, which may or may not be included within the memory 720, so as to operate properly in connection with the O/S 750. Furthermore, the application 760 can be written as an object oriented programming language, which has classes of data and methods, or a procedure programming language, which has routines, subroutines, and/or functions, for example but not limited to, C, C++, C#, Pascal, BASIC, API calls, HTML, XHTML, XML, ASP scripts, FORTRAN, COBOL, Perl, Java, ADA, .NET, and the like.
The I/O devices 770 may include input devices such as, for example but not limited to, a mouse, keyboard, scanner, microphone, camera, etc. Furthermore, the I/O devices 770 may also include output devices, for example but not limited to a printer, display, etc. Finally, the I/O devices 770 may further include devices that communicate both inputs and outputs, for instance but not limited to, a NIC or modulator/demodulator (for accessing remote devices, other files, devices, systems, or a network), a radio frequency (RF) or other transceiver, a telephonic interface, a bridge, a router, etc. The I/O devices 770 also include components for communicating over various networks, such as the Internet or intranet.
If the computer 700 is a PC, workstation, intelligent device or the like, the software in the memory 720 may further include a basic input output system (BIOS) (omitted for simplicity). The BIOS is a set of essential software routines that initialize and test hardware at startup, start the O/S 750, and support the transfer of data among the hardware devices. The BIOS is stored in some type of read-only-memory, such as ROM, PROM, EPROM, EEPROM or the like, so that the BIOS can be executed when the computer 700 is activated.
When the computer 700 is in operation, the processor 710 is configured to execute software stored within the memory 720, to communicate data to and from the memory 720, and to generally control operations of the computer 700 pursuant to the software. The application 760 and the O/S 750 are read, in whole or in part, by the processor 710, perhaps buffered within the processor 710, and then executed.
When the application 760 is implemented in software it should be noted that the application 760 can be stored on virtually any computer readable medium for use by or in connection with any computer related system or method. In the context of this document, a computer readable medium may be an electronic, magnetic, optical, or other physical device or means that can contain or store a computer program for use by or in connection with a computer related system or method.
The application 760 can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. In the context of this document, a “computer-readable medium” can be any means that can store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. The computer readable medium can be, for example but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, device, or propagation medium.
More specific examples (a nonexhaustive list) of the computer-readable medium may include the following: an electrical connection (electronic) having one or more wires, a portable computer diskette (magnetic or optical), a random access memory (RAM) (electronic), a read-only memory (ROM) (electronic), an erasable programmable read-only memory (EPROM, EEPROM, or Flash memory) (electronic), an optical fiber (optical), and a portable compact disc memory (CDROM, CD R/W) (optical). Note that the computer-readable medium could even be paper or another suitable medium, upon which the program is printed or punched, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
In exemplary embodiments, where the application 760 is implemented in hardware, the application 760 can be implemented with any one or a combination of the following technologies, which are well known in the art: a discrete logic circuit(s) having logic gates for implementing logic functions upon data signals, an application specific integrated circuit (ASIC) having appropriate combinational logic gates, a programmable gate array(s) (PGA), a field programmable gate array (FPGA), etc.
The technical effects and benefits of exemplary embodiments include preserving of breakpoints in program source code after modification and across different editors.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used herein, the singular forms “a”, “an”, and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “comprises” and/or “comprising,” when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
The corresponding structures, materials, acts, and equivalents of all means or step plus function elements in the claims below are intended to include any structure, material, or act for performing the function in combination with other claimed elements as specifically claimed. The description of the present invention has been presented for purposes of illustration and description, but is not intended to be exhaustive or limited to the invention in the form 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 invention. The embodiment was chosen and described in order to best explain the principles of the invention and the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.