gdb
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
gdb [2016/10/17 10:01] – dblume | gdb [2020/01/16 09:14] – dblume | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== gdb ====== | ====== gdb ====== | ||
+ | |||
+ | ===== Example code with a deadlock ===== | ||
+ | |||
+ | Build your target with debug symbols. For example, with [[http:// | ||
+ | |||
+ | make debug | ||
+ | |||
+ | If the deadlock was compiled in, then run it like so: | ||
+ | |||
+ | product/ | ||
+ | |||
+ | Then you can run gdb and attach to the process in one of the following ways. | ||
+ | |||
+ | $ gdb -p < | ||
+ | | ||
+ | $ gdb product/ | ||
+ | | ||
+ | $ gdb | ||
+ | (gdb) attach < | ||
+ | | ||
+ | |||
+ | ===== Tips ===== | ||
Show all the backtraces: | Show all the backtraces: | ||
Line 12: | Line 34: | ||
(gdb) t a a bt -3 # thread apply all backtrace top three frames | (gdb) t a a bt -3 # thread apply all backtrace top three frames | ||
- | ==== Detecting a Deadlock ==== | + | ===== Detecting a Deadlock |
Get high level info on the threads: | Get high level info on the threads: | ||
Line 55: | Line 77: | ||
Note the < | Note the < | ||
+ | |||
+ | ==== Attaching to a remote target ==== | ||
+ | |||
+ | - Deploy gdb server with the remote target. Launch remote target with gdb server. | ||
+ | - Untar remote libraries to a local dir. Eg., 487.72E04128A-2371582-rootfs.tar.gz in my ~/Downloads directory. | ||
+ | |||
+ | $ / | ||
+ | GNU gdb (GDB) 7.5.1 | ||
+ | This GDB was configured as " | ||
+ | Reading symbols from builds/ | ||
+ | (gdb) set sysroot ~/ | ||
+ | (gdb) set solib-search-path builds/ | ||
+ | (gdb) target remote 10.15.24.54: | ||
+ | Remote debugging using 10.15.24.54: | ||
+ | ... | ||
+ | (gdb) c | ||
+ |
gdb.txt · Last modified: 2023/04/12 20:44 by 127.0.0.1