User Tools

Site Tools


gdb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gdb [2017/10/24 17:22] dblumegdb [2023/04/12 20:44] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== gdb ====== ====== gdb ======
 +
 +===== Example code with a deadlock =====
 +
 +Build your target with debug symbols. For example, with [[http://git.dlma.com/testcode.git/|the testcode project]], make with the target "debug"
 +
 +  make debug
 +
 +If the deadlock was compiled in, then run it like so:
 +
 +  product/testcode &
 +
 +Then you can run gdb and attach to the process in one of the following ways.
 +
 +  $ gdb -p <pid-of-testcode>
 +  
 +  $ gdb product/testcode <pid-of-testcode>
 +  
 +  $ gdb
 +  (gdb) attach <pid-of-testcode>
 +  
 +
 +===== 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:
gdb.1508890932.txt.gz · Last modified: 2023/04/12 20:44 (external edit)