gdb
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revisionNext revision | |||
— | gdb [2017/10/24 17:22] – dblume | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== gdb ====== | ||
+ | |||
+ | Show all the backtraces: | ||
+ | |||
+ | (gdb) set pagination off | ||
+ | (gdb) thread apply all bt | ||
+ | |||
+ | Other useful tips: | ||
+ | |||
+ | (gdb) t a a f # thread apply all frame | ||
+ | (gdb) t a a bt 3 # thread apply all backtrace bottom three frames | ||
+ | (gdb) t a a bt -3 # thread apply all backtrace top three frames | ||
+ | |||
+ | ==== Detecting a Deadlock ==== | ||
+ | |||
+ | Get high level info on the threads: | ||
+ | |||
+ | (gdb) info threads | ||
+ | Id | ||
+ | * 3 Thread 0x76c9d450 (LWP 24793) " | ||
+ | 2 Thread 0x7649d450 (LWP 24794) " | ||
+ | 1 Thread 0x76fdd000 (LWP 24792) " | ||
+ | |||
+ | Make notes of those Thread IDs at LWP, and choose the thread you want, and choose a stack frame that shows the mutex of interest. | ||
+ | |||
+ | (gdb) thread 3 | ||
+ | | ||
+ | # | ||
+ | | ||
+ | (gdb) bt | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | ... | ||
+ | #10 0x0001b37c in std:: | ||
+ | #11 0x76f54348 in ?? () from / | ||
+ | | ||
+ | (gdb) f 4 | ||
+ | # | ||
+ | | ||
+ | (gdb) info args | ||
+ | this = 0x76c9cd9c | ||
+ | __m = @0x3147c: {< | ||
+ | |||
+ | Note the < | ||
+ | |||
+ | (gdb) t 2 | ||
+ | (gdb) bt | ||
+ | (gdb) f 3 | ||
+ | (gdb) p *this | ||
+ | $8 = {< | ||
+ | |||
+ | 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