Debugging on the Command Line - 2022.1 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2022-04-26
Version
2022.1 English
While debugging a single processor core using GDB on the command line is straightforward, some extra steps are required to debug other cores.
  1. Start the hardware server on the machine where the board is connected. For every processor architecture, a GDB server is started on the ports described above.
  2. Start GDB from a terminal (for example, $XILINX_VITS/gnu/aarch64/lin/aarch64-none/bin/aarch64-none-elf-gdb to debug A64 applications).
  3. Connect to the GDB server using the target extended command (for example, tar ext :3001). The target extended command is required to debug multiple cores.
  4. To see a list of available targets, run the monitor ps command. The hardware server extends the monitor command to support listing of available targets.
  5. To debug the second core, add it as an inferior and attach to it.
  6. To debug other cores, detach the previous core, and repeat the previous step. See the following code snippet for a full example of the steps.
    Note: Processor cores must be in a stopped or running state before they can be used with GDB. Remember to clear resets (through XSDB, for example) before using GDB.
    # connect to gdbserver
    (gdb) tar ext xhdbfarmrki7:3001
    Remote debugging using xhdbfarmrki7:3001
    warning: No executable has been specified and target does not support
    determining executable automatically. Try using the "file" command.
    0x00000000ffff0000 in ?? ()
     
    # view available targets
    (gdb) mon ps
    1: Cortex-A53 #0 (Reset Catch)
    2: Cortex-A53 #1 (Reset Catch)
    3: Cortex-A53 #2 (Reset Catch)
    4: Cortex-A53 #3 (Reset Catch)
     
    # add other cores (2, 3, and 4) as inferiors
    (gdb) add-infe
    [New inferior 2]
    Added inferior 2
    (gdb) add-infe
    [New inferior 3]
    Added inferior 3
    (gdb) add-infe
    [New inferior 4]
    Added inferior 4
     
    # switch to inferior 2
    (gdb) infe 2
    [Switching to inferior 2 [<null>] (<noexec>)]
     
    # attach to 2nd core
    (gdb) attach 2
    Attaching to process 2
    warning: No executable has been specified and target does not support
    determining executable automatically. Try using the "file" command.
    0x00000000ffff0000 in ?? ()
     
    # detach before connecting to other cores
    (gdb) detach
    Detaching from program: , process 2
    [Inferior 2 (process 2) detached]
     
    # 3rd core
    (gdb) infe 3
    [Switching to inferior 3 [<null>] (<noexec>)]
    (gdb) attach 3
    Attaching to process 3
    warning: No executable has been specified and target does not support
    determining executable automatically. Try using the "file" command.
     
    Thread 2.1 stopped.
    0x0000000000000000 in ?? ()
    (gdb) detach
    Detaching from program: , process 3
    [Inferior 2 (process 3) detached]
     
    # 4th core
    (gdb) infe 4
    [Switching to inferior 3 [<null>] (<noexec>)]
    (gdb) attach 4
    Attaching to process 4
    warning: No executable has been specified and target does not support
    determining executable automatically. Try using the "file" command.
     
    Thread 2.1 stopped.
    0x0000000000000110 in ?? ()