gdb-attach

Connect GDB to a running QEMU instance for Breenix assembly and C debugging.

7|Updated Nov 21, 2015
One-click install
npx skills add https://github.com/ryanbreen/breenix --skill gdb-attach
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gdb-attach
Source: https://github.com/ryanbreen/breenix/tree/main/breenix-gdb-attach
Command: npx skills add https://github.com/ryanbreen/breenix --skill gdb-attach

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It enables detailed debugging of Breenix at the assembly and C level, including interrupt and boot sequence analysis, by connecting GDB to a running QEMU instance.

Core Features & Use Cases

  • Breakpointing at boot-time and during initialization
  • Inspect registers, memory, and control-flow
  • Step through boot, interrupt entry, and context-switch paths
  • Use cases: diagnose early boot issues or kernel exceptions by attaching GDB and stepping

Quick Start

Launch QEMU in GDB mode: BREENIX_GDB=1 cargo run --release --bin qemu-uefi Then connect with: gdb target/x86_64-breenix/release/kernel -ex 'target remote localhost:1234' Or use the helper: breenix-gdb-attach/scripts/connect.py (if present) - optional.

Frequently Asked Questions about gdb-attach

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug a kernel at the assembly level using GDB?

Kernel-level assembly debugging with GDB connects to a QEMU instance running in GDB mode. Launch QEMU with BREENIX_GDB=1, then attach GDB to the kernel binary using `target remote localhost:1234`. You can set breakpoints, inspect registers and memory, and step through boot and interrupt sequences.

Can I use GDB to debug early boot issues in a kernel?

Yes. GDB attachment enables breakpointing at boot time and during initialization. Connect to QEMU in GDB mode to step through the boot sequence, inspect control flow, and diagnose failures before the kernel fully initializes.

What's the best way to analyze interrupt handling and context switches in kernel code?

Use GDB to attach to a running kernel instance and step through interrupt entry and context-switch paths. This allows you to inspect registers, memory state, and execution flow at the assembly and C level during interrupt processing.

Do I need QEMU to debug kernel code with GDB?

Yes. GDB connects remotely to QEMU running in GDB mode via localhost:1234. QEMU provides the debugging interface; you launch it with BREENIX_GDB=1 and then connect GDB to the kernel binary.

Can I inspect CPU registers and memory while debugging a kernel?

Yes. Once GDB is attached to the running kernel, you can inspect registers, examine memory contents, and view the call stack. This is useful for diagnosing kernel exceptions and understanding state changes during boot and interrupt handling.