Abstract:
Apparatus and method for illustrating an order of execution of software code. At least portions of software code are presented on a display device with the software code representing instructions for operation of a computer under control of a program. A visual indication of an order of execution of the displayed instructions is also presented. In a preferred embodiment, the apparatus and method present the instructions in a plurality of colors, with the colors corresponding to the order of execution of the software code.

Description:
FIELD OF THE INVENTION 
     The present invention relates to an apparatus and method for presenting software code, and in particular, providing a visual indication of an order of execution of displayed software code. 
     BACKGROUND OF THE INVENTION 
     Software programmers work with systems which display software code so that the programmers may, for example, edit and debug the code. While viewing such software code trace, it can be difficult to identify the instructions within the code that have been executed prior to a currently-executed instruction. The advent of trace facilities, and source-code debuggers, may make the task of code debugging easier; however, the complexity of software code is likewise increasing. In addition, software code is not typically executed in a straight sequential path. Unless the code is simple, it tends to have numerous control instructions distributed throughout (for example, FOR loops, WHILE loops, DO loops, IF constructs, and at the lowest level, branch instructions). With the increase in the complexity of software functionality, software modules are becoming more complex as well. Moreover, object-oriented programming compounds the problem; the increase in “jumping” in and out of object-oriented methods makes remembering which instructions had been executed more difficult. 
     Software trace analysis tools typically provide the programmer/analyst with a “singular view” of the code being executed. For example, only the currently-executed code instruction is usually highlighted with these tools. The task of remembering which instruction was executed just prior to the currently-executed instruction is left to the memory of the programmer/analyst. Accordingly, it can be difficult for a programmer/analyst to remember and identify the sequence in which the instructions were executed, which makes it difficult to trace execution of software code. 
     SUMMARY OF THE INVENTION 
     The present invention relates to an apparatus and method for illustrating an order of execution of software code. It presents at least portions of software code on a display device with the software code representing instructions for operation of a computer under control of a program. It then presents with the displayed instructions of the software code a visual indication of an order of execution of the displayed instructions. In a preferred embodiment, the system and method present the instructions in a plurality of colors, with the colors corresponding to the order of execution of the code. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of a computer-based system for implementing the present invention. 
     FIG. 2 is a block diagram of preferred set-up and control options available to a user when using the present invention. 
     FIG. 3 is a block diagram of data structures used for implementing the present invention. 
     FIG. 4 is a flow chart of a preferred process for implementing the present invention. 
     FIG. 5 is a flow chart of a preferred process for initializing trace mechanism. 
     FIG. 6 is a flow chart of a preferred process for updating trace history. 
     FIG. 7 is a flow chart of a preferred process for updating display of trace statements. 
     FIG. 8 is a diagram showing an order of execution of exemplary software code. 
     FIG. 9 is a diagram illustrating how the order of execution may be illustrated with different shading. 
     FIG. 10 is a diagram illustrating how the order of execution may be illustrated with different sized fonts. 
     FIG. 11 is a diagram showing the order of execution by way of numerals presented with the code. 
    
    
     DETAILED DESCRIPTION 
     Overview 
     The present invention, in a preferred embodiment, provides a color-coded view of software code trace that identifies the instructions that were executed prior to the most recently executed instruction. Each instruction of the module is displayed in a color representing its order of execution in relation to other instructions. For example, consider each of the colors of the spectrum as representing temperature (white is the hottest—“white hot”, red next, orange, . . . violet, black—the coldest temperature). Also consider that instructions “take on heat” as they are being executed, and “cooled” subsequent to being executed. 
     Table 1 provides an example of a view of a module as five instructions are executed in the following order: instruction  1 , instruction  2 , instruction  3 , instruction  4 , and instruction  1  again. Note the color changes to each instruction indicating order of execution. Table 1 shows the colors of the displayed instructions in this example and how those colors may change as the instructions are executed in order to provide a visual indication of the order of execution. While the instructions are indicated as being “colored,” they could alternatively be presented with background colors. In addition, a different color scheme (sequence of colors), or even color shading, could be used for indicating the order of execution. As shown in Table 1, the colors change as the instructions are executed. Even though this example shows instructions executed in the sequence in which they appear, software code is typically not linearly executed and, therefore, the coloring assists in providing a user with an indication of such order of execution. 
     
       
         
               
             
               
               
               
             
               
               
               
               
             
           
               
                 TABLE 1 
               
             
             
               
                   
               
               
                 Prior to beginning the source-level trace, all 
               
               
                 instructions are usually displayed in the same color 
               
               
                 (for example, black on a grey background). 
               
             
          
           
               
                   
                 color of instructions 
                 operation 
               
               
                   
                   
               
             
          
           
               
                   
                 (1) 
                 instruction 1 (black) 
                 prior to execution 
               
               
                   
                   
                 instruction 2 (black) 
               
               
                   
                   
                 instruction 3 (black) 
               
               
                   
                   
                 instruction 4 (black) 
               
               
                   
                 (2) 
                 instruction 1 (white) 
                 instruction 1 executed 
               
               
                   
                   
                 instruction 2 (black) 
               
               
                   
                   
                 instruction 3 (black) 
               
               
                   
                   
                 instruction 4 (black) 
               
               
                   
                 (3) 
                 instruction 1 (red) 
                 instruction 2 executed 
               
               
                   
                   
                 instruction 2 (white) 
               
               
                   
                   
                 instruction 3 (black) 
               
               
                   
                   
                 instruction 4 (black) 
               
               
                   
                 (4) 
                 instruction 1 (orange) 
                 instruction 3 executed 
               
               
                   
                   
                 instruction 2 (red) 
               
               
                   
                   
                 instruction 3 (white) 
               
               
                   
                   
                 instruction 4 (black) 
               
               
                   
                 (5) 
                 instruction 1 (yellow) 
                 instruction 4 executed 
               
               
                   
                   
                 instruction 2 (orange) 
               
               
                   
                   
                 instruction 3 (red) 
               
               
                   
                   
                 instruction 4 (white) 
               
               
                   
                 (6) 
                 instruction 1 (white) 
                 instruction 1 executed 
               
               
                   
                   
                 instruction 2 (yellow) 
               
               
                   
                   
                 instruction 3 (orange) 
               
               
                   
                   
                 instruction 4 (red) 
               
               
                   
                   
               
             
          
         
       
     
     Appendix B shows how the order of execution may be. 
     System Operation 
     FIG. 1 is a block diagram of a system for implementing the present invention within a computer  10 . The computer  10  may be implemented with a typical personal computer or the like, such as an IBM-compatible personal computer. The computer  10  includes a processor  13  coupled to a ROM  12 , which may store a software program for implementing the present invention. The computer  10  further includes a random access memory  14  for temporary storage of data. A display device  11  is coupled to the computer  10  for displaying, for example, software code. The display device  11  may be implemented with a typical computer monitor. 
     FIG. 2 is a diagram of set-up and control options for a user when working with an implementation of the present invention. A user may select a highlight mode  15  and history length  16 . The highlight mode  15  includes options for displaying an order of execution of software code. These options may include, for example, displaying the order of execution using varying colors, grey scales, font sizes, or numerals, as described above. The history length  16  allows the user to specify the number of instructions which are displayed with the indication of the order of execution. 
     FIG. 3 is a diagram of data structures used for implementing the present invention within a computer. These data structures preferably include a history length  17  and highlight mode  18 , both of which are determined by parameters entered by a user, as explained above. The data structures also include a statement history array  19  for including and managing the instructions which are displayed with the indication of the order of execution. 
     FIG. 4 is a flow chart of a preferred process for implementing the present invention within a computer software debugger. For implementing the present invention, the processor  13  is suitably programmed as shown in FIGS. 4-7. The system first initializes the normal software code debugger ( 20 ) and then initializes the trace mechanism ( 21 ). The system then executes the normal software code debugger logic ( 22 ) and determines if it is at a breakpoint within the code ( 23 ). If it is at a breakpoint, the system updates the trace history ( 24 ) and returns to the normal debugger logic ( 22 ). Otherwise, the system determines if display update is required ( 25 ). If display update is required, the system updates the normal debugger display ( 26 ) and updates display of trace statements ( 28 ). The system then determines if it is at the end of the debugger process for the software code ( 27 ). If more software code is remaining for the debugger, the system returns to the normal debugger logic ( 22 ). 
     FIG. 5 is a flow chart of a preferred process for implementing the initialized trace mechanism step ( 21 ). The system first determines if a defaults file exists ( 29 ). If it does, the system loads the highlighting mode and history length from the defaults file ( 30 ). Otherwise, the system chooses arbitrary defaults for highlighting mode and history length ( 31 ). The system then allocates history array of specified length and initializes entries to statement number zero ( 32 ). 
     FIG. 6 is a flow chart of a preferred process for implementing the update trace history step ( 24 ). The system first retrieves the current statement number ( 33 ), slides all entries in statement history array down one element ( 34 ), and then sets the top entry of the statement history array equal to the current statement number ( 35 ). 
     FIG. 7 is a flow chart of a preferred process for implementing the update display of trace statements step ( 28 ). The system obtains the last entry from the statement history array ( 36 ) and determines if the entry statement number is zero ( 37 ). If it is not zero, the system determines if the statement number is on the display ( 38 ), and if so, it updates the statement on the display using specified highlight option ( 39 ). Otherwise, the system determines if it is at the top entry of the history array ( 40 ), it then obtains the previous entry from the history array ( 41 ) and returns to step ( 36 ). Otherwise, the process is finished. 
     FIGS. 8-11 show how the order of execution may be illustrated in alternate embodiments. FIG. 8 shows an order of execution of exemplary software code, shown consecutively as stages  51 - 58 . FIG. 9 shows how the order of execution for stages  51 - 58  may be illustrated with different shading with the currently-executed instruction presented in, for example, the darkest shading and the previously-executed instructions displayed in progressively lighter shading. While the instructions are displayed in background shading, the instructions themselves could alternatively be shaded. FIG. 10 shows how the order of execution may be illustrated with different sized fonts with, for example, the currently-executed instruction  60  in the largest font and the previously-executed instructions  61 ,  62  and  63  displayed in progressively smaller fonts. FIG. 11 shows how the order of execution may be illustrated with numerals  65  presented with the code, the numerals  65  corresponding to the order of execution. 
     While the present invention has been described in connection with a preferred embodiment thereof, it will be understood that many modifications will be readily apparent to those skilled in the art, and this application is intended to cover any adaptations or variations thereof. For example, either a software or hardware embodiment may be used without departing from the scope of the invention. It is manifestly intended that this invention be limited only by the claims and equivalents thereof.