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
howto:gdb [2021/04/02 18:19] – [Debugging] using pgrep digital manhowto:gdb [2024/11/04 02:56] (current) – [Debug Synchronet for *nix using GDB] Ad bug character to title digital man
Line 1: Line 1:
-====== Debug Synchronet for *nix using GDB ======+====== 🐛 Debug Synchronet for *nix using GDB ======
  
 You can either run Synchronet (''sbbs'') from the GNU debugger (''gdb''), or you You can either run Synchronet (''sbbs'') from the GNU debugger (''gdb''), or you
Line 36: Line 36:
      
 :!: **Linux Sysops**:\\ :!: **Linux Sysops**:\\
-To help locate sbbs crash core files, adding the following lines in your ''/etc/sysctl.conf'' file can be helpful:+To help locate sbbs crash core files, adding the following lines in your ''/etc/sysctl.conf'' or ''/etc/sysctl.d/sysctl.local.conf'' file can be helpful:
  
   # Controls whether core dumps will append the PID to the core filename.   # Controls whether core dumps will append the PID to the core filename.
Line 45: Line 45:
 This will place core files with the name ''core.sbbs.####'' in the ''/tmp'' directory This will place core files with the name ''core.sbbs.####'' in the ''/tmp'' directory
 instead of ''core.####'' in the current directory (typically ''/sbbs/ctrl''). instead of ''core.####'' in the current directory (typically ''/sbbs/ctrl'').
 +To reload the modified sysctl configuration files, run
 +  $ /sbin/sysctl --system
  
 Also, if you're using the ''setuid'' feature of sbbs (e.g. starts as //root// but changes to a different user after binding ports), then you may need to add the following line to your ''/etc/sysctl.conf'' file: Also, if you're using the ''setuid'' feature of sbbs (e.g. starts as //root// but changes to a different user after binding ports), then you may need to add the following line to your ''/etc/sysctl.conf'' file:
Line 50: Line 52:
      
 You can also set ''suid_dumpable'' immediately and temporarily with the following command: You can also set ''suid_dumpable'' immediately and temporarily with the following command:
-  echo 2 > /proc/sys/fs/suid_dumpable+  echo 2 > /proc/sys/fs/suid_dumpable
      
  
Line 61: Line 63:
 or (if attaching to an existing running instance, reading 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): +or (if attaching to an existing running instance, using ''pidof'' to determine the PID): 
-  # gdb -p $(pgrep sbbs)+  # gdb -p $(pidof sbbs)
  
 B. Run Synchronet non-daemonized (if no core file used): B. Run Synchronet non-daemonized (if no core file used):
Line 100: Line 102:
 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 $(pidof sbbs) -batch -ex "thread apply all bt" -ex quit > sbbs_threads.txt
  
 ===== See Also ===== ===== See Also =====