Attach a debugger to a running process.

Section: Debuggers and Core Dumps

Attach gdb to PID

bash
bash
gdb -p 1234
Explanation

Attach a debugger to a running process.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Debuggers and Core Dumps
Batch backtrace with gdb
Collect all-thread backtraces from a live process.
OpenIn sheetbashsame section
Open latest core in gdb
Load the newest core dump for a PID into gdb.
OpenIn sheetbashsame section
List captured core dumps
List core dumps managed by systemd-coredump.
OpenIn sheetbashsame section
Enable core dumps in shell
Allow the shell to generate core dumps.
OpenIn sheetbashsame section
Attach strace to a running PID
Attach to a live process and trace syscalls.
OpenIn sheetbash1 tag match
Read process command line
Print the null-separated command line from /proc.