We will assume that you already have SuperCollider running and that you have booted the server. Now you’d like to attach the GDB debugger to that process to see what happens when / if it crashes.

Attach GDB to an already running scsynth process

First, we need to find the pid of the running process:

ps -C scsynth -o pid h

Then, we can use the number output from the command above to attach gdb:

sudo gdb scsynth -p <pid>

Or, both of the above in one line:

sudo gdb scsynth -p $(ps -C scsynth -o pid h)

Once inside GDB, you may execute the command n (or next) until it crashes. Then run bt to get a backtrace with more information.