Debugging with APEX2 Emulator

This topic describes the configuration needed to debug an S32DS application using APEX2 Emulator.

Note: Before you proceed to debugging on Linux, make sure the host uses GCC 4.9.3. Rebuild the APEX2 libraries to use them with a different version of GCC.
To specify the debug configuration settings:
  1. Select your APEX2 project in the Project Explorer view, set the EMU build configuration to be active and build the project.
  2. Click Run > Debug Configurations on the main menu.
  3. In the left pane, open a configuration under C/C++ Application.
  4. In the right pane, go to the Debugger tab. Select the Stop on startup at check box to stop the debugger at the first line of main(). You can modify the function name.

    Settings for debugging with Emulator

  5. In the Main tab, specify the following configuration settings:
    Table 1. Debugger Options - Main
    Setting Description
    GDB debugger The location of the GDB debugger.
    GDB command file The initialization file which contains GDB commands to automatically execute during GDB startup.
    Non-stop mode (Note: Requires non-stop GDB) Select this check box to stop one or more threads while leaving others running.

    Non-stop debugging allows each thread of a debug session to be controlled independently.

    Enable Reverse Debugging at startup using Select this check box to enable reverse debugging, which allows you to "step" or "continue" your program backwards, reverting all memory and registers to their previous values. Options available:
    • Software Reverse Debugging (detailed but slower)
    • Hardware Reverse Debugging (no details but faster)
    Force thread list update on suspend Select this check box to enable polling GDB for the target program's thread list on each suspend event (breakpoint-hit, step, etc).

    Normally, this isn't necessary, as GDB sends notifications in realtime when a thread is created or destroyed. But some lightweight GDB remote stubs won't send these notifications. For example, the CDT debugger doesn't find out about new or destroyed threads unless it polls GDB.

    Automatically debug forked processes (Note: Requires Multi Process GDB) Select this check box to automatically attach available forked processes.

    Whenever any process you are currently debugging forks a new process, that new process will be added to your debug session.

    Tracepoint mode The Tracepoint mode allows you to specify locations in the program, called tracepoints, and arbitrary expressions to evaluate when those tracepoints are reached. Later, you can examine the values those expressions had when the program hit the tracepoints. Options available:
    • Normal - default mode.
    • Fast - faster alternative to normal tracepoints, that have a lower execution overhead. They have some limitations and require more complicated setup.
    • Automatic - this mode automatically select the tracepoint type. The normal tracepoint will be used if a fast one can't be set.
  6. In the Shared Libraries tab, specify the following configuration settings:
    Table 2. Debugger Options - Shared Libraries
    Setting Description
    Directories The prioritized list of additional directories to be searched when loading the shared libraries.
    Load shared library symbols automatically Select this check box to load symbols in the shared libraries at startup.
Before you click Debug or exit the dialog box, click Apply to save your settings. To drop the modifications and go back to the settings that were opened with the dialog box, click Revert.