Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

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
Next revisionBoth sides next revision
howto:gdb [2019/05/07 15:10] – [Debugging] mention "bt full" and "-ex run -args" and such digital manhowto:gdb [2021/04/02 18:33] – Instructions for collecting a quick backtrace snapshot from all running threads digital man
Line 59: Line 59:
 or (if debugging with a core file): or (if debugging with a core file):
   # gdb /sbbs/exec/sbbs /tmp/core.sbbs.####   # gdb /sbbs/exec/sbbs /tmp/core.sbbs.####
-or (if attaching to an existing running instance, read the pid from ''/var/run/sbbs.pid''):+or (if attaching to an existing running instance, reading the PID from ''/var/run/sbbs.pid''):
   # gdb /sbbs/exec/sbbs <pid>   # gdb /sbbs/exec/sbbs <pid>
 +or (if attaching to an existing running instance, using ''pgrep'' to determine the PID):
 +  # gdb -p $(pgrep sbbs)
  
 B. Run Synchronet non-daemonized (if no core file used): B. Run Synchronet non-daemonized (if no core file used):
Line 79: Line 81:
 **TIP:**\\ **TIP:**\\
 To run Synchronet (non-daemonized) directly from the GNU debugger without having to type "run" at a ''(gdb)'' prompt: To run Synchronet (non-daemonized) directly from the GNU debugger without having to type "run" at a ''(gdb)'' prompt:
-  # gdb -ex run -args sbbs -nd+  # gdb -ex run --args sbbs -nd 
 + 
 +==== Root Access ==== 
 + 
 +If the ''sbbs'' process was started as root, you may need root privileges to attached with ''gdb'': 
 + 
 +  Attaching to process 21848 
 +  ptrace: Operation not permitted. 
 +  (gdb) 
 +   
 +If you get this error, try attaching again as root (e.g. run with ''sudo gdb'').
  
 ==== Handling SIGPIPE ==== ==== Handling SIGPIPE ====
Line 88: Line 100:
 Alternatively, you can add the following line to your ''~/.gdbinit'' file or ''/etc/gdb/gdbinit'': Alternatively, you can add the following line to your ''~/.gdbinit'' file or ''/etc/gdb/gdbinit'':
   handle SIGPIPE nostop noprint pass   handle SIGPIPE nostop noprint pass
 +  
 +===== Thread Snapshot =====
 +
 +To attach to a running sbbs process and quickly collect a snapshot of backtraces from all running threads (remember, obtain root privileges first, e.g. with ''sudo'', if necessary):
 +  $ gdb -p $(pgrep sbbs) -batch -ex "thread apply all bt" -ex quit > sbbs_threads.txt
  
 ===== See Also ===== ===== See Also =====