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:
- Open the model that contains the C/C++ source code block you would like to debug.
- Run
vmcLaunchVitisDebugger
in the MATLAB® Command Window.After a few moments, the Vitis IDE loads and the following message appears.
- Select the Debug button on
the Vitis IDE menu.
- 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
.
- In the Vitis Debugger, open the source file you would like to debug. (Select )
- 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 theautorun
section of the file by adding abreak
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" ]
- 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.