Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
howto:gdb [2018/10/07 00:11] – [Core File] Mention the suid_dumpable thing needed for core files to be generated on Linux when running sbbs with the setuid feature digital man | howto: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 ====== | + | ====== |
You can either run Synchronet ('' | You can either run Synchronet ('' | ||
Line 36: | Line 36: | ||
| | ||
:!: **Linux Sysops**:\\ | :!: **Linux Sysops**:\\ | ||
- | To help locate sbbs crash core files, adding the following lines in your ''/ | + | To help locate sbbs crash core files, adding the following lines in your ''/ |
# 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 '' | This will place core files with the name '' | ||
instead of '' | instead of '' | ||
+ | To reload the modified sysctl configuration files, run | ||
+ | $ / | ||
Also, if you're using the '' | Also, if you're using the '' | ||
Line 50: | Line 52: | ||
| | ||
You can also set '' | You can also set '' | ||
- | | + | |
| | ||
Line 59: | Line 61: | ||
or (if debugging with a core file): | or (if debugging with a core file): | ||
# gdb / | # gdb / | ||
- | or (if attaching to an existing running instance, | + | or (if attaching to an existing running instance, |
# gdb / | # gdb / | ||
+ | or (if attaching to an existing running instance, using '' | ||
+ | # gdb -p $(pidof sbbs) | ||
- | B. Run Synchronet (if no core file used): | + | B. Run Synchronet |
(gdb) run -nd | (gdb) run -nd | ||
C. After segfault or other crash (or when using a core), display back-trace: | C. After segfault or other crash (or when using a core), display back-trace: | ||
(gdb) bt | (gdb) bt | ||
+ | or (if more details are needed): | ||
+ | (gdb) bt full | ||
D. If (and only if) the last line of the output looks like this: | D. If (and only if) the last line of the output looks like this: | ||
Line 74: | Line 80: | ||
E. Copy and paste in e-mail to rob[at]synchro[dot]net or post in one of the Synchronet [[support|discussion groups]]. | E. Copy and paste in e-mail to rob[at]synchro[dot]net or post in one of the Synchronet [[support|discussion groups]]. | ||
+ | |||
+ | **TIP:**\\ | ||
+ | To run Synchronet (non-daemonized) directly from the GNU debugger without having to type " | ||
+ | # gdb -ex run --args sbbs -nd | ||
+ | |||
+ | ==== Root Access ==== | ||
+ | |||
+ | If the '' | ||
+ | |||
+ | Attaching to process 21848 | ||
+ | ptrace: Operation not permitted. | ||
+ | (gdb) | ||
+ | | ||
+ | If you get this error, try attaching again as root (e.g. run with '' | ||
==== Handling SIGPIPE ==== | ==== Handling SIGPIPE ==== | ||
Line 82: | Line 102: | ||
Alternatively, | Alternatively, | ||
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 '' | ||
+ | $ gdb -p $(pidof sbbs) -batch -ex " | ||
===== See Also ===== | ===== See Also ===== | ||
- | * [[:howto:|howto index]] | + | * [[:howto:|How-To |
+ | * [[https:// | ||
{{tag> | {{tag> | ||