Software Emulation Debug for Alveo Accelerators - 2021.2 English

Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)

Document ID
English (United States)
Release Date
2021.2 English

You can use the following process to debug the system in software emulation for an Alveo™ accelerator card. This process launches a new terminal that allows for gdb commands to be used, as well as displaying the source files for code stepping.

  1. Complete the sw_emu build process, using the -g or --debug options when building the host and kernels.
  2. Add the kernel-dbg=true option to the xrt.ini file prior to running the application:
  3. As described in Running Emulation on Data Center Accelerator Cards, set the XCL_EMULATION_MODE to sw_emu:
    setenv XCL_EMULATION_MODE sw_emu
  4. Launch the host application with the .xclbin file: ./host.exe a.xclbin

    Launching the host application also launches gdb in a separate terminal to let you debug the PL kernels in the .xclbin. In gdb, you can perform all the typical activities to set up your debug environment, such as breakpoint insertion for PL kernels, and step or continue commands to walk through the code.

  5. You can set a breakpoint on either function name or line number in gdb using this syntax. During execution, when it reaches that breakpoint, gdb automatically opens the file with the right line number, as long as it can locate the sources. For example,
    break <filename>:<function name>
    break <filename>:<line_num >

    Also, you can set a breakpoint for a kernel using a command such as b Vadd_A_B. This command pauses .xclbin execution in gdb at the invocation of the specified kernel, in this example the Vadd_A_B kernel. In an .xclbin file with multiple kernels, you can add breakpoints for all or specific kernels.

    Note: When you set the breakpoint in gdb, you will see a note that the function is not defined and prompting you to make the breakpoint pending on future load. Enter y to proceed.
  6. In the gdb terminal, press r to run the application and step through the code, set variable values, and continue.
    Tip: To use a Textual User Interface (TUI) in gdb, use the following keystrokes:
    Ctrl+x Ctrl+a
  7. If the TUI is displayed, the source code for the kernel is displayed, as well as the path to the source code defined in the .xclbin by the software emulation build process.
  8. Step through the code, or press c to let the code run through to completion. The results of your software emulation are displayed in the original command terminal.
  9. Press q to quit gdb.
  10. Close the gdb command terminal.