GDB (GNU Project Debugger) - 2022.1 English

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

Document ID
UG1400
Release Date
2022-04-26
Version
2022.1 English

GDB is a popular debugger, especially among Linux developers. While Xilinx recommends using System Debugger, GDB is also supported for baremetal embedded flows. However, unlike System Debugger, GDB support is limited to single application debug.

GDB for embedded targets require a gdbserver. GDB is responsible for the front-end; it allows users to specify the program to debug, plant breakpoints, halt/resume programs, etc. Each user command is sent to the gdbserver, which then configures the target to execute the command. For example, when users plant a line breakpoint in GDB, GDB reads the debug info in the elf and decodes the address corresponding to that line. GDB then issues a 'plant breakpoint at address' command to the gdbserver, which writes to the target processor's registers to plant the breakpoint. Similar logic is applied to all the debug commands issued by the users.

For Xilinx embedded flows, hw_server starts gdbserver for each processor architecture on different ports. Below is a list of supported architectures and default gdbserver ports.

Architecture gdbserver port
Arm® 3000
AARCH64 3001
MicroBlaze 3002
MicroBlaze64 3003

Users can change the base port by specifying -p<port> while starting hw_server. For example, hw_server -p2345 starts gdbserver for Arm at 2345, AARCH64 at 2346, MB at 2347, and MB64 at 2348.