Simple Stepping
Here, we’ll use the commands Step, Run To, Next and Out, and then note process and thread status.
1. Step
— Select
Step (
) in the toolbar. TotalView stops the program just before the first executable statement, the call to
setjmp().
Note the yellow highlight and arrow show the current location of the Program Counter, or
PC, in the Source pane.
The process and thread status are displayed in the Processes & Threads pane:
This program has just a single process 1 and thread, denoted by 1.1, which reports that its status is Stopped in main(). The thread is in bold, because it is the active thread or the Thread of Interest (TOI).
The status bar at the bottom also displays process/thread status, reporting that the TOI is in main().
— Select Step again to advance to the while loop on line 31, and then select Step again to step into the readexpr() function. (Next would step over, or execute it.)
Because the
readexpr() function is in a different file, TotalView opens the
readexpr.c file and advances the PC to the first line of executable code in the
readexpr() function.
Note that the
readexpr() function now appears in the Call Stack view:
The status bar reports the location of the PC:
2. Run To
Select the
return() statement at line 136, then click
Run To (
) in the toolbar. The PC advances to line 136. Blue highlighting denotes a “run to” location.
3. Out
Select
Out (
) to execute the
return statement and exit the function. The PC returns to the while condition inside
main():
4. Next
Click
Next (
) on the toolbar. The
Next command simply executes any executable code at the location of the PC. If that is a function call, it fully executes the function. If the PC is instead at a location within a function, it executes that line and then moves the PC to the next line.
In this case, the PC moves to the next executable line in
main(), the assignment of the
evaluate() function's return value on line 32:
Now let’s add some breakpoints and rerun the program.