gdb-cli
Helps your agent debug code and analyze failures. Allows investigating errors in real-time or in core dump files. Useful for finding and fixing bugs.
What it does
Helps find and fix errors in computer programs written in C/C++. It analyzes the program's state when it crashes or freezes, comparing it with the source code to understand what happened.
When to use it
- ✓When a program crashes and you have a 'crash dump' file.
- ✓When a program is running and unresponsive (frozen).
- ✓To understand why a program crashed or is using too much memory.
Example of what to ask your AI
“Analyze the crash dump of my program 'my_app' located at '/tmp/core.1234' and tell me where the error is.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
It uses a tool called GDB to examine the program's state at the time of the failure. Then, it compares the information found with the program's source code to give you a clear explanation of the problem.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill gdb-cliOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/gdb-cli/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
GDB Debugging Assistant
Overview
A GDB debugging skill designed for AI agents. Combines source code analysis with runtime state inspection using gdb-cli to provide intelligent debugging assistance for C/C++ programs.
When to Use This Skill
- Analyze core dumps or crash dumps
- Debug running processes with GDB attach
- Investigate crashes, deadlocks, or memory issues
- Get intelligent debugging assistance with source code context
- Debug multi-threaded applications
Do Not Use This Skill When
- The task is unrelated to C/C++ debugging
- The user needs general-purpose assistance without debugging
- No GDB is available (GDB 9.0+ with Python support required)
Prerequisites
# Install gdb-cli
pip install gdb-cli
# Or from GitHub
pip install git+https://github.com/Cerdore/gdb-cli.git
# Verify GDB has Python support
gdb -nx -q -batch -ex "python print('OK')"
Requirements:
- Python 3.6.8+
- GDB 9.0+ with Python support enabled
- Linux OS
How It Works
Step 1: Initialize Debug Session
For core dump analysis:
gdb-cli load --binary <binary_path> --core <core_path> [--gdb-path <gdb_path>]
For live process debugging:
gdb-cli attach --pid <pid> [--binary <binary_path>]
Output: A session_id like "session_id": "a1b2c3". Store this for subsequent commands.
Step 2: Gather Initial Information
SESSION="<session_id>"
# List all threads
gdb-cli threads -s $SESSION
# Get backtrace (with local variables)
gdb-cli bt -s $SESSION --full
# Get registers
gdb-cli registers -s $SESSION
Step 3: Correlate Source Code (CRITICAL)
For each frame in the backtrace:
- Extract frame info:
{file}:{line} in {function} - Read source context: Get ±20 lines around the crash point
- Get local variables:
gdb-cli locals-cmd -s $SESSION --frame <N> - Analyze: Correlate code logic with variable values
Example correlation:
Frame #0: process_data() at src/worker.c:87
Source code shows:
85: Node* node = get_node(id);
86: if (node == NULL) return;
87: node->data = value; <- Crash here
Variables show:
node = 0x0 (NULL)
Analysis: The NULL check on line 86 didn't catch the issue.
Step 4: Deep Investigation
# Examine variables
gdb-cli eval-cmd -s $SESSION "variable_name"
gdb-cli eval-cmd -s $SESSION "ptr->field"
gdb-cli ptype -s $SESSION "struct_name"
# Memory inspection
gdb-cli memory -s $SESSION "0x7fffffffe000" --size 64
# Disassembly
gdb-cli disasm -s $SESSION --count 20
# Check all threads (for deadlock analysis)
gdb-cli thread-apply -s $SESSION bt --all
# View shared libraries
gdb-cli sharedlibs -s $SESSION
Step 5: Session Management
# List active sessions
gdb-cli sessions
# Check session status
gdb-cli status -s $SESSION
# Stop session (cleanup)
gdb-cli stop -s $SESSION
Common Debugging Patterns
Pattern: Null Pointer Dereference
Indicators:
- Crash on memory access instruction
- Pointer variable is 0x0
Investigation:
gdb-cli registers -s $SESSION # Check RIP
gdb-cli eval-cmd -s $SESSION "ptr" # Check pointer value
Pattern: Deadlock
Indicators:
- Multiple threads stuck in lock functions
pthread_mutex_lockin backtrace
Investigation:
gdb-cli thread-apply -s $SESSION bt --all
# Look for circular wait patterns
Pattern: Memory Corruption
Indicators:
- Crash in malloc/free
- Garbage values in variables
Investigation:
gdb-cli memory -s $SESSION "&variable" --size 128
gdb-cli registers -s $SESSION
Examples
Example 1: Core Dump Analysis
# Load core dump
gdb-cli load --binary ./myapp --core /tmp/core.1234
# Get crash location
gdb-cli bt -s a1b2c3 --full
# Examine crash frame
gdb-cli locals-cmd -s a1b2c3 --frame 0
Example 2: Live Process Debugging
# Attach to stuck server
gdb-cli attach --pid 12345
# Check all threads
gdb-cli threads -s b2c3d4
# Get all backtraces
gdb-cli thread-apply -s b2c3d4 bt --all
Best Practices
- Always read source code before drawing conclusions from variable values
- Use
--rangefor pagination on large thread counts or deep backtraces - Use
ptypeto understand complex data structures before examining values - Check all threads for multi-threaded issues
- Cross-reference types with source code definitions
Security & Safety Notes
- This skill requires GDB access to processes and core dumps
…
FAQ
Do I need to install anything?
Yes, you need to have GDB (a debugging tool) installed, as well as the gdb-cli tool, which is an add-on for GDB.
Does it work for any programming language?
No, this tool is specific to programs written in C and C++.
What is a 'crash dump'?
It's a file that the system automatically creates when a program crashes, containing information about the program's state at that moment.
Details
Original description by the author
GDB debugging assistant for AI agents - analyze core dumps, debug live processes, investigate crashes and deadlocks with source code correlation
Popularity
- GitHub stars
- 48k
- Ranking position
- #3089
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
cpp-testing
Makes your agent write and improve tests for C++ code. It helps set up testing tools and fix errors.
affaan-m/ECC
csharp-testing
Helps your agent create tests for C# and .NET code. It uses best practices to ensure tests are efficient and reliable.
affaan-m/ECC
django-tdd
Enables your agent to apply testing strategies for Django with pytest-django and TDD. It's useful for writing robust tests and ensuring code quality, especially for DRF APIs.
affaan-m/ECC