1. Technical Field
The present disclosure relates to computers, and particularly to a computer and a method for debugging programs in the computer.
2. Description of Related Art
When debugging a program step by step, if a programmer presses a button (e.g., F10) of a keyboard too soon, which can easily occur when the programmer has been stepping through hundreds of lines, the programmer may miss debugging information of the currently examined line of the program. If this occurs, it is known that current debugging programs do not allow return to a previous step, so the programmer must start the debugging processor again and step through to the line he missed, which decreases the work efficiency.
Many aspects of the present disclosure should be better understood with reference to the following drawings. The units in the drawings are not necessarily drawn to scale, the emphasis instead being placed upon clearly illustrating the principles of the present disclosure. Moreover, in the drawings, like reference numerals designate corresponding portions throughout the several views.
Embodiments of the present disclosure are described in detail, with reference to the accompanying drawings.
Referring to
Referring to
In step S301, the debugging module 51 responds to user input to debug a program step by step.
In step S302, the storing module 52 temporarily stores the debugging information of each line of the program to the storage unit 10. In this embodiment, when n line of the program is debugged, the storing module 52 deletes the debugging information of n−2 line of code of the program, wherein n is equal to or greater than three. That is, the storing module 52 stores the debugging information of the currently examined line of the program and the debugging information of the previous line, so as not to use too much memory. In alternative embodiments, if desired, the storing module 52 may store the debugging information of more than two lines of the program (e. g. ten lines of the program or all lines of the program) to the storage unit 10.
In step S303, the outputting module 53 responds to user input to display requested available debugging information stored in the storage unit 10 on the display unit 30. During debugging the program, when a programmer wants to look up the still available debugging information of a previously debugged line of the program, he/she can depress a button (e.g. a direction button) of the keyboard to call the stored debugging information, stepping through lines in reverse order until the debugging information of a desired line appears. The outputting module 53 outputs an information interface to display the stored debugging information. Thus, while debugging the program, the user can look up the stored debugging information at any time, without debugging the program again.
In step S304, the storing module 52 deletes any stored debugging information when the debugging module 51 finishes debugging the program.
Although the present disclosure has been specifically described on the basis of the exemplary embodiment thereof, the disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the embodiment without departing from the scope and spirit of the disclosure.
Number | Date | Country | Kind |
---|---|---|---|
2013101599398 | May 2013 | CN | national |