| |||
Home > Debugging > Using other debuggers to debug LISA source > Debugging with GDB |
To debug ISIM targets, start a GDB session directly from Fast Models Canvas by selecting Launch Host Debugger from the Project menu. Command line arguments can be specified on the Applications page of the Preferences Dialog.
You can also debug CADI shared library from either the Model Shell or Model Debugger executable. This method of debugging is not directly available from Canvas, but you can use a Linux shell start the executable.
To start the GDB session with Model Debugger as the executable:
Load Model Debugger into GDB
by typing gdb modeldebugger.exec
in the console.
Ensure that you use GDB version 6.2 or higher.
Starting modeldebugger.exec
might require
manually modifying the LD_LIBRARY_PATH
environment
variable to include a reference to the directory containing libcadiclient.so
.
This directory is $MAXVIEW_HOME/lib
.
Type run
at the GDB prompt to
start Model Debugger.
You can load the model in the same step by adding the name of model library, for example:
run cadi_system_Linux-Debug-GCC-3.4.so
Model Debugger starts and the Configure Model Parameters dialog opens.
Configure any required parameters for the target, then click OK.
The Select Targets dialog opens. The ARM processor is selected by default. Select the additional targets, if any, to load into Model Debugger. A separate Model Debugger window is created for each target. Click OK to close the target selection dialog.
Load the applications to the targets that execute software:
If there is one target selected, a Model Debugger prompt for the application is displayed.
If more then one target was selected, load the application to the targets in each debug view separately by selecting Load Application from the File menu.
Selecting the application can also be done when Model Debugger
is started by adding command line option -a
in
line with the name of the target and application file:
run cadi_system_Linux-Debug-GCC-3.4.so -atargetName1
=application1
-atargetName2
=application2
GDB is now ready to debug the model source code.
This section describes a typical example of debugging a system model on the source code level and setting and running to a breakpoint in the LISA source.
In GDB, interrupt execution of Model Debugger by pressing Ctrl+C.
You can now type commands at the GDB prompt. To
set a breakpoint in GDB, for example at line 123 in the MyCode.lisa
file,
enter:
break MyCode.lisa:123
In GDB, continue execution of Model Debugger by typing:
continue
In Model Debugger, click the Run button to start execution.
You can use GDB to perform any debug action on the LISA code such as printing values of variables or stepping through code.