Using Vitis Debugger - 2024.2 English

Vitis Model Composer User Guide (UG1483)

Document ID
UG1483
Release Date
2024-11-13
Version
2024.2 English

The Vitis IDE provides a debug environment that can be invoked directly from Vitis Model Composer.

The Vitis IDE debug environment has many features found in traditional GUI-based debug environments, such as GDB. You can add break points to the code, step over or step into specific lines of codes, loops, or functions, and examine the state of variables and force them to specific values.

To invoke the Vitis Debugger from Vitis Model Composer, do the following:

  1. Open the model that contains the C/C++ source code block you would like to debug.
  2. Run vmcLaunchVitisDebugger in the MATLAB® Command Window.

    After a few moments, the Vitis IDE loads and the following message appears.



  3. Select the Debug button on the Vitis IDE menu.


  4. Inside the Debug panel, make sure Attach to PID is select in the drop-down menu. Click Start Debugging.


    Wait for the debugger to finish attaching to process. When finished, the status bar at the bottom of the Vitis window turns orange and indicate clangd: idle.



  5. In the Vitis Debugger, open the source file you would like to debug. (Select File > Open File...)
  6. On the source code line where you would like the debugger to stop, place a breakpoint by clicking to the left of the line number. A red circle displays when the breakpoint has been successfully placed.


    Note: When debugging HLS kernels on Windows, it is not possible to set breakpoints in the source code editor.

    Instead, the breakpoints must be set in the _ide/launch.json file. Modify the autorun section of the file by adding a break statement, similar to the code snippet below. The file must be saved and the debugger restarted for the breakpoint to enable.

    "autorun": [
           "handle SIGSEGV nostop noprint",
           "set breakpoint pending on",
           "break detectSingleWindow.cpp:82"
         ]
  7. Return to Simulink and run the model.

When model execution hits the breakpoint that you set, the Vitis Debugger pauses execution on that line, which becomes highlighted.



You can now use the Debug controls on the left side of the screen to control program execution, view the call stack and data variables, and enable and disable breakpoints. For more information on the capabilities of the Vitis Debugger, refer to Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400).

When finished debugging, click Stop in the Debug panel.