-
Notifications
You must be signed in to change notification settings - Fork 0
Debugging with Gdb
sharmasadhna edited this page Feb 28, 2021
·
4 revisions
GDB is an open source debugger available for multiple architectures, for Gen4
- GDB Server - Executes on the target and attaches a running process (PID). or a
- GDB Client - Executes on the Host/development machine and connects to the GDB server running on the target.
On Target:
- #./gdbserver : PORT --attach PID - Attaches to a already running process and halt its execution.
- #./gdbserver HOST : PORT program args - Starts the GDB server and loads a program and then waits for GDB client to attach.
On Host: The GDB client (running on host) connect to the GDB server (running on the target) and then controls the execution of the program.
- Start the gdb client with: <YOUR_PATH_TO_GDB_CLIENT>/gdb
- Connect to the server with: target remote :
Create .gdbinit in home folder to save configurations, like set solib-search-path <lib_path>, set sysroot <lib_path>
debugging with separate .debug files,
https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html
How to generate such .debug files, sol: objcopy+strip
https://stackoverflow.com/questions/866721/how-to-generate-gcc-debug-symbol-outside-the-build-target