4.4.2. 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:

  1. 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.

  2. 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
  3. Model Debugger starts and the Configure Model Parameters dialog opens.

  4. Configure any required parameters for the target, then click OK.

  5. 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.

  6. 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 -a targetName1=application1 -a targetName2=application2
  7. GDB is now ready to debug the model source code.

Example GDB LISA debug session

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.

  1. In GDB, interrupt execution of Model Debugger by pressing Ctrl+C.

  2. 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 
  3. In GDB, continue execution of Model Debugger by typing:

  4. 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.

Copyright © 2007-2009 ARM Limited. All rights reserved.ARM DUI 0370H