Working with the Debugger
Common Debugging Actions
Table 17.1 Thread Window Items ( continued)
Icon Item
Functions list box
Line and
Column button
Source list box
Explanation
Click to show a list of functions declared in the file. Select a function to highlight it in the
Source pane.
Shows the current line and column number of the text-insertion cursor. Click to specify a line to show in the Source pane.
Click to specify how to display source code in the Source pane:
• Source—programming-language statements appear exclusively in the pane
• Assembler—assembly-language instructions appear exclusively in the pane
• Mixed—each programminglanguage statement shows its corresponding assemblylanguage instructions
Common Debugging Actions
This section explains how to perform common debugging actions that correct source-code errors, control program execution, and observe memory behavior:
• Start the debugger
• Step into, out of, or over routines
• Stop, resume, or kill program execution
• Run the program
• Restart the debugger
192
Starting the Debugger
Use the Debug command to begin a debugging session. The debugger takes control of program execution, starting at the main entry point of the program.
Select Project > Debug or click the Debug button (shown at left) to start the debugger.
After you start the debugging session, the IDE opens a new Thread window.
IDE 5.7 User’s Guide
Working with the Debugger
Common Debugging Actions
NOTE
Some projects require additional configuration before the debugging session can begin. The IDE might prompt you for permission to perform this configuration automatically.
Stepping Into a Routine
Use the Step Into command to execute one source-code statement at a time and follow execution into a routine call.
Select Debug > Step Into or click the Step Into button to step into a routine.
After the debugger executes the source-code statement, the current-statement arrow moves to the next statement determined by these rules:
• If the executed statement did not call a routine, the current-statement arrow moves to the next statement in the source code.
• If the executed statement called a routine, the current-statement arrow moves to the first statement in the called routine.
• If the executed statement is the last statement in a called routine, the currentstatement arrow moves to the statement that follows the calling routine.
Stepping Out of a Routine
Use the Step Out command to execute the rest of the current routine and stop program execution after the routine returns to its caller. This command causes execution to return up the calling chain.
Select Debug > Step Out or click the Step Out button to step out of a routine.
The current routine executes and returns to its caller, then program execution stops.
Stepping Over a Routine
Use the Step Over command to execute the current statement and advance to the next statement in the source code. If the current statement is a routine call, program execution continues until reaching one of these points:
• the end of the called routine
• a breakpoint
IDE 5.7 User’s Guide 193
Working with the Debugger
Common Debugging Actions
• a watchpoint
• an eventpoint that stops execution
Select Debug > Step Over or click the Step Over button to step over a routine.
The current statement or routine executes, then program execution stops.
Stopping Program Execution
Use the Break or Stop command to suspend program execution during a debugging session.
Select Debug > Break, Debug > Stop, or click the Stop button to stop program execution.
The operating system surrenders control to the debugger, which stops program execution.
Resuming Program Execution
Use the Resume command to continue executing a suspended debugging session. If the debugging session is already active, use this command to switch view from the Thread window to the executing program.
Select Project > Resume or click the Debug button to resume program execution.
The suspended session resumes, or the view changes to the running program.
NOTE
The Resume command appears only for those platforms that support it. If your platform does not support this command, you must stop the current debugging session and start a new session.
194
Killing Program Execution
Use the Kill command to completely terminate program execution and end the debugging session. This behavior differs from stopping a program, as stopping temporarily suspends execution.
Select Debug > Kill or click the Kill button to kill program execution.
The debugger terminates program execution and ends the debugging session.
IDE 5.7 User’s Guide