About loading debug information into the debugger
An executable image contains symbolic references, such as function and variable names, in addition to the application code and data. These symbolic references are generally referred to as debug information. Without this information, the debugger is unable to debug at the source level.
To debug an application at source level, the image file and shared object files must be compiled with debug information, and a suitable level of optimization. For example, when compiling with either the ARM® or the GNU compiler you can use the following options:
Debug information is not loaded when an image is loaded to a target, but is a separate action. A typical load sequence is:
Load the main application image.
Load any shared objects.
Load the symbols for the main application image.
Load the symbols for shared objects.
Loading debug information increases memory use and can take a long time. To minimize these costs, the debugger loads debug information incrementally as it is needed. This is called on-demand loading. Certain operations, such as listing all the symbols in an image, load additional data into the debugger and therefore incur a small delay. Loading of debug information can occur at any time, on-demand, so you must ensure that your images remain accessible to the debugger and do not change during your debug session.
Images and shared objects might be preloaded onto the target, such as an image in a ROM device or an OS-aware target. The corresponding image file and any shared object files must contain debug information, and be accessible from your local host workstation. You can then configure a connection to the target loading only the debug information from these files. Use the Load symbols from file option on the debug configuration Files tab as appropriate for the target environment.
After connecting to the target you can also use the view menu entry Load... in the Debug Control view to load files as required. The following options for loading debug information are available:
- Add Symbols File
Loads additional debug information into the debugger.
- Load Debug Info
Loads debug information into the debugger.
- Load Image and Debug Info
Loads the application image on to the target, and loads the debug information from the same image into the debugger.
- Load Offset
Specifies a decimal or hexadecimal offset that is added to all addresses within the image. A hexadecimal offset must be prefixed with
- Set PC to entry point
Sets the PC to the entry point when loading image or debug information so that the code runs from the beginning.
NoteThe option is not available for the Add Symbols File option.
Figure 16-2 Load additional debug information dialog box
The debug information in an image or shared object also contains the path of the sources used to build it. When execution stops at an address in the image or shared object, the debugger attempts to open the corresponding source file. If this path is not present or the required source file is not found, then you must inform the debugger where the source file is located. You do this by setting up a substitution rule to associate the path obtained from the image with the path to the required source file that is accessible from your local host workstation.