본문으로 건너뛰기
cccskills
무료GitHub에 공개

kernel-debugging

Use when debugging the Linux kernel: kgdb and kdb, ftrace and kprobes, dynamic debug, kdump and crash analysis, or printk levels on a live or crashed target.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md6.7 KB
  • agents/openai.yaml227 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Kernel debugging

Contract

FieldBound contract
TriggerA kernel panic or oops with an unclear trace, live debugging of a module with kgdb or kdb, tracing a function without recompiling, enabling driver debug output, or analyzing a vmcore.
AuthorityRead-only. Emits analysis and commands for the operator to run on the target; no file writes, no rollback needed. No remote mutation.
Side effectDiagnostic commands and an evidence-backed verdict in chat. Nothing is written.
DoneThe failing path is named with evidence from a trace, backtrace, or crash session, or the next diagnostic step is stated with the reason.

Inputs

  1. Symptom (required): panic, oops, hang, lockup, or wrong behavior.
  2. Target access (optional): serial console, root shell, mounted debugfs, or a vmcore file.
  3. Kernel build (optional): vmlinux with debug info for the running kernel; mainline 7.2 or LTS 6.18 assumed when not stated.

Procedure

  1. Read the ring buffer before anything else.

    dmesg -T -l err,warn              # filter by level
    dmesg -w                          # follow live
    cat /proc/sys/kernel/printk       # current default minimum boot-default
    echo 8 > /proc/sys/kernel/printk  # raise verbosity
    

    Driver dev_dbg() output stays hidden until dynamic debug or a DEBUG define turns it on. Done when: the level is raised and the first fault line is captured.

  2. Break into kgdb when the target is alive. Boot with kgdboc=ttyS0,115200 kgdbwait, or attach at runtime and trigger the break from sysrq.

    echo ttyS0,115200 > /sys/module/kgdboc/parameters/kgdboc
    echo g > /proc/sysrq-trigger
    
    gdb vmlinux
    (gdb) set serial baud 115200
    (gdb) target remote /dev/ttyUSB0
    (gdb) bt
    

    A USB serial adapter shows up as ttyUSB0 and works the same as a built-in port. Done when: gdb reports a backtrace on the stopped target.

  3. Use kdb when no host gdb exists. CONFIG_KGDB_KDB gives an in-kernel shell at the sysrq break (echo k > /proc/sysrq-trigger). Commands: bt backtrace, ps process list, lsmod modules, md <addr> memory, rd registers, id <addr> disassembly, cpu <n> switch CPU, go continue. Done when: the faulting frame is visible without a host debugger.

  4. Trace without recompiling: ftrace.

    cd /sys/kernel/debug/tracing
    echo function > current_tracer
    echo schedule > set_ftrace_filter
    echo '*probe*' > set_ftrace_notrace
    echo 1 > tracing_on
    cat trace_pipe
    echo 0 > tracing_on && echo nop > current_tracer
    
    trace-cmd record -p function -l schedule,do_page_fault
    trace-cmd report          # kernelshark reads the same trace.dat
    

    Requires debugfs mounted and root. Done when: the trace shows the calls in question with the filters narrowing it.

  5. Probe one suspect function with kprobes.

    echo 'p:myprobe do_sys_open $arg1 $arg2' > /sys/kernel/debug/tracing/kprobe_events
    echo 1 > /sys/kernel/debug/tracing/events/kprobes/myprobe/enable
    cat /sys/kernel/debug/tracing/trace
    echo 'r:myret do_sys_open $retval' >> /sys/kernel/debug/tracing/kprobe_events
    # cleanup
    echo '-:myprobe' > /sys/kernel/debug/tracing/kprobe_events
    

    An in-kernel probe registers a struct kprobe with .symbol_name and a .pre_handler through register_kprobe(). Done when: the probe fires and the fetch arguments read sanely.

  6. Turn on driver debug prints with dyndbg.

    echo 'module mydriver +p' > /sys/kernel/debug/dynamic_debug/control
    echo 'file drivers/i2c/i2c-core.c +p' > /sys/kernel/debug/dynamic_debug/control
    grep mydriver /sys/kernel/debug/dynamic_debug/control
    

    Boot time: dyndbg="module mydriver +p" on the kernel command line. Needs CONFIG_DYNAMIC_DEBUG. Done when: the driver's debug lines appear in the log.

  7. Analyze the crash dump. Reserve memory with crashkernel=256M, then use the distro tool (kdump-config show on Ubuntu, kdumpctl status on RHEL). After a panic the vmcore lands in /var/crash/.

    crash /usr/lib/debug/boot/vmlinux-$(uname -r) /var/crash/*/vmcore
    crash> bt
    crash> log
    crash> ps
    crash> kmem -i
    crash> mod
    

    Compress with makedumpfile -c -d 31 /proc/vmcore /tmp/vmcore; the dump level is a number after -d. The vmlinux must carry debug info for the exact running kernel, usually the distro linux-image-*-dbg package. Done when: the crash session yields the panic backtrace.

  8. Tune the target for reproduction.

    sysctl kernel.panic_on_oops=1      # stop at the first oops, in a VM
    sysctl kernel.softlockup_panic=1
    sysctl kernel.nmi_watchdog=1
    # boot: slub_debug=P,pagealloc     # poison slab for corruption hunts
    

    Done when: the target halts at the defect instead of limping on.

  9. Triage by issue class.

    Panic or oops        -> dmesg, then crash on the vmcore
    Driver logic bug     -> dyndbg, then ftrace function_graph
    Latency regression   -> perf record -g -a, trace-cmd
    Intermittent         -> kprobe the suspect path
    Module crash         -> kgdb, audit module refcounts
    

    Done when: the next tool follows from the class.

Failure and recovery

SymptomCauseFix
kgdb will not connectWrong tty or baudMatch kgdboc to the adapter, check both ends
Trace stays emptyTracer not set or tracing offecho function > current_tracer, echo 1 > tracing_on
kprobe registration failsInlined symbol or CONFIG_KPROBES offPick a symbol present in /proc/kallsyms, or use a tracepoint
dyndbg has no effectCONFIG_DYNAMIC_DEBUG disabledRebuild the kernel with the option
crash rejects the vmcoreWrong vmlinux debug symbolsInstall the dbg package matching uname -r
sysrq deadkernel.sysrq is 0echo 1 > /proc/sys/kernel/sysrq
Failure classBehavior
Break hangs the targetFall back to kdb in-kernel or to the kdump path; do not retry the same break without changing the transport.
kprobe floods the traceNarrow to one symbol, or switch to a kretprobe that only logs $retval.
crash session mismatches the kernelRefuse analysis; a mismatched vmlinux produces plausible garbage. Fetch the matching debug package first.
Debug controls write nothingdebugfs is not mounted: mount -t debugfs none /sys/kernel/debug.

Output

  1. The faulting function or subsystem named with captured evidence.
  2. The command transcript used.
  3. The next diagnostic step when the cause is still open.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

Use when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

af-xdp

무료

Use when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

Use when a completed session needs an agent-environment retrospective. Not for an engineering retrospective from telemetry: use engineering-retrospective.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

Use when a redacted, trimmed agent transcript must be appended to a GitHub PR or issue body, with human approval and preview. Not for automated or model-initiated insertion.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

agents-md

무료

Use when a repo needs agent setup, AGENTS.md added or made lean, CLAUDE.md audited, or agent instructions scored or pruned. Not for remote, credential, publish, deploy, or irreversible changes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

OutlineDriven/odin-claude-plugin372026년 9월 29일 업데이트

OutlineDriven의 스킬 모두 보기

이 스킬의 문제 신고