TOC PREV NEXT INDEX DOC LIST MASTER INDEX



Debugging

This section contains the following topics:

Cross target debugging is very similar to host debugging. Most commands are supported for the cross-target debuggers. However, there are some additional considerations for executing the cross debuggers.


Commands

Several commands are specific to the embedded debugger. These commands are used to download programs, attach to existing programs on the target, and pass commands to the target's controlling agent.

Loading a program

When the cross debugger is invoked, the Auto Load Program button in the File > Debug dialog is selected by default. The user application is automatically downloaded to the target system.

You can also download a program within the debugger using either the File > Download command or the Download button. Until the executable is downloaded or the debugger is attached to the target via the File > Sync command, the rest of the debugger commands cannot be used.

The File > Download command is described in the Online Reference. The equivalent batch mode command is apex_download. It must be entered from within an Apex shell.

The load command is the equivalent debugger line mode command and is described in Using the Apex Debugger. It can be entered in the debugger window's command pane.

Note: The runtime kernel for cross compilers is a seperate executable and it must be present on the target board before you can execute or debug your program. Click on File > Download in the debugger window to open the dialog box which, by default, has the name of the kernel in it. Click OK or Apply to download the kernel.

Attaching to a Pre-loaded Target

You can debug a program already present on the target board without reloading. The File > Sync command in the debugger is used to synchronize the debugger with the current state of the target processor and the controlling agent. This command causes the debugger to establish its current state based on information from the target. The debugger assimilates the current target state in the same way as it does when a program hits a breakpoint. It reads up the value of the program counter and other registers, for example, to determine the current execution position.

If the state of the target changes while the program is being debugged, File > Sync can be used to force the debugger to flush its cached information about the target and re-establish the debugging context by re-reading the relevant information from the target controlling agent.

Because Auto Load Program is the default within the File > Debug dialog, the button will need to be deselected before starting the debugger.

The File > Sync command is described in the Online Reference. The sync command is the equivalent line mode command that can be entered through the debugger window's command pane. It is described in Using the Apex Debugger.

Passing Commands to the Target Controlling Agent

Cross debuggers are implemented by utilizing the support of what is called a target controlling agent. A microprocessor emulator and the Target Debug Monitor (TDM) are both examples of target controlling agents. These agents are often powerful debugging stations in their own rights and can provide facilities that complement those provided by the Apex debugger.

The line mode pass command enables you to send commands to the controlling agent. All of the text in the command pane that follows the pass keyword is sent to the agent. If any output is generated by the agent, it is displayed in the Log pane of the main debugger window.

The pass command also permits debugger expressions to be evaluated with the resulting value replacing the expression in the pass command text. For example, suppose the variable xxx has the value 222 and is at location 07fff1680. The pass command:

results in the following text being passed down to the target controlling agent.


Rational Software Corporation 
http://www.rational.com
support@rational.com
techpubs@rational.com
Copyright © 1993-2002, Rational Software Corporation. All rights reserved.
TOC PREV NEXT INDEX DOC LIST MASTER INDEX TECHNOTES APEX TIPS