gdbserver
GDB Server skill for the ikigai project
When & Why to Use This Skill
This Claude skill facilitates remote debugging for TUI (Terminal User Interface) applications using gdbserver, specifically optimized for the ikigai project. It solves the common issue of terminal buffer conflicts by decoupling the debugger from the application's display, allowing developers to perform deep inspections of crashes, variables, and stack frames in a stable environment.
Use Cases
- Case 1: Debugging TUI applications that use alternate screen buffers to prevent the GDB interface from corrupting the application's visual output.
- Case 2: Remote debugging of C/C++ projects by establishing a connection between a local GDB instance and a remote gdbserver.
- Case 3: Post-mortem crash analysis where gdbserver keeps a failed process frozen, enabling developers to attach and run backtraces (bt) to find the exact point of failure.
- Case 4: Real-time state inspection of running processes, including monitoring local variables, registers, and memory addresses without interrupting the user interface.
| name | gdbserver |
|---|---|
| description | GDB Server skill for the ikigai project |
GDB Server
Description
Remote debugging with gdbserver for TUI apps that use alternate screen buffer.
Why gdbserver
This app uses the alternate terminal buffer. Running GDB directly would conflict with the TUI. gdbserver separates the debugger from the application's terminal.
Workflow
Terminal 1 - Start app under gdbserver:
gdbserver :1234 ./ikigai
Terminal 2 - Connect with GDB:
gdb ./ikigai -ex "target remote :1234"
Key Commands
bt # Backtrace
frame N # Select stack frame
info locals # Local variables
print var # Inspect variable
list # Source at current location
break file:line # Set breakpoint
continue # Resume execution
step / next # Step into / over
When Crashes Occur
gdbserver keeps the crashed process frozen. Connect and inspect:
gdb ./ikigai -ex "target remote :1234"
(gdb) bt # See crash location
(gdb) info registers
(gdb) print *ptr # Inspect state at crash
Limitations
- TUI output not visible (process attached to gdbserver)
- Very early crashes may need coredump analysis instead
- Inspect internal state via variables, not screen output
References
- GDB manual: https://sourceware.org/gdb/current/onlinedocs/gdb/
- See
coredump.mdfor early crash debugging