Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

GDB

$ gdb Foundation Med Risk
GNU · Code & DevOps · GPL-3.0-or-later · macos / linux / windows

gdb is the standard GNU source-level debugger for compiled binaries and core dumps. While interactive by default, agents can extract backtraces and registers safely without hanging using gdb --batch -ex "bt" or drive it programmatically via the Machine Interface (--interpreter=mi3).

FCRS-1.0 Score
65 /100
Usable w/ Caveats
Medium Confidence
Zero-Friction Install
brew install gdb
CLI vs MCP Decision CLI Only

Low-level local process and core-dump debugger; requires direct OS ptrace/binary access.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 15 / 25

Interactive REPL by default (hangs non-TTY agents if --batch is forgotten); provides --batch -ex scripting and GDB/MI (--interpreter=mi3) rather than JSON.

  • --batch -ex ensures non-interactive exit
  • --interpreter=mi3 provides structured MI line protocol, not JSON
Trust & Safety 17 / 25

Inspecting core dumps is read-only, while attaching to live processes (-p) pauses execution and can modify memory/registers; .gdbinit auto-loading poses code-execution risk if enabled.

  • Live process attachment pauses target processes
  • Use -nx to skip untrusted .gdbinit files
Setup & Portability 11 / 15

Preinstalled/standard on Linux and available via MinGW on Windows, but macOS requires manual code-signing certificates and lacks Apple Silicon native support.

  • Seamless on Linux; significant macOS setup friction
Utility & Efficiency 11 / 15

Unmatched support for Linux core dumps, embedded targets, and multi-language symbols, though verbose without Python pretty-printers.

  • Standard Linux crash/core-dump diagnostics
Maintenance & Lineage 6 / 10

Maintained by the GNU Project (sourceware.org/gdb) with regular major releases under GPL-3.0-or-later.

  • Official GNU Project debugger
Docs & Verifiability 5 / 10

Massive official manual exists, though scripting -ex sequences and MI syntax are complex.

  • Comprehensive manual at sourceware.org/gdb

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

No credentials required; inspects local ELF/Mach-O/PE executables and core dumps.

Side Effects
Read-Only Local Write
Cost & Quotas

GPL-3.0-or-later GNU Project free software; free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# GDB Agent Rules
- Always pass `--batch -q` (and `-ex ...`) so `gdb` exits cleanly instead of entering the interactive `(gdb)` REPL.
- Never use `gdb` interactively without a batch script or `--interpreter=mi3`.
- On macOS, prefer `lldb` unless `gdb` is code-signed for taskgated debugging.

Agent-Ready Command Recipes

Safe Read-Only Queries

Extract a backtrace from a core dump in batch mode
gdb --batch -q -ex "thread apply all bt full" ./build/app core.dump

Loads the binary and core dump, prints full stack traces for all threads, and exits immediately without prompting.

Run a crashing binary under batch mode to capture backtrace
gdb --batch -q -ex "run" -ex "bt" --args ./build/app --test

Executes the binary non-interactively and prints the backtrace on crash before exiting.

Strengths for Agents

  • + gdb --batch -q -ex "thread apply all bt" extracts crash backtraces cleanly in one shot.
  • + --interpreter=mi3 offers deterministic machine-readable event framing.

Caveats & Pitfalls

  • ! Enters a blocking (gdb) prompt unless --batch is passed.
  • ! Outputs GDB/MI or plain text rather than JSON, and macOS requires code-signing setup (prefer lldb on macOS).

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI