/cpp:debuggingfrom cpp
Use when C, C++, or Objective-C misbehaves at run time and its cause is unproven (wrong value, failing test case, throw, trap, sanitizer report, crash core), covering build facts, test launches, value reads under lldb-dap, exception and trap stops, dSYMs, core files, attaches, and sanitizer builds
Ships in cpp. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Covers native programs and tests built from C, C++, and Objective-C, debugged under LLVM's lldb-dap. Use tool:debugging for the method, session answers, and crash reports. Use cpp:coding for the fix.
[REFERENCES]:
Facts read before a session, in order:
Compile command of the unit under suspicion:
jq -r '.[] | select(.file | endswith("<unit>")) | .command // (.arguments | join(" "))' <build>/compile_commands.json
-g and -O0 -> next fact-g with -O1 or higher -> frames read [opt] and locals <unavailable>, so build at -O0 or stop at function entry-g -> no line breakpoint binds, build a configuration with -g-ffile-prefix-map=<root>=. -> debug info names paths relative to <root>, mapped by [03]CMAKE_EXPORT_COMPILE_COMMANDS)Standard library release of the unit, through its compiler and flags:
printf '#include <version>\n_LIBCPP_VERSION\n' | <compiler> <flags> -E -x c++ - | tail -1
230106 is libc++ 23.1.6, and _LIBCPP_VERSION printed back names another standard library.
Engine release, as the cpp language runs the first lldb-dap on the PATH of the program's folder and the client's project:
cd <program folder> && lldb-dap --version
std::vector reads size=error: or size=0 with no error, so put a newer lldb-dap on the project's PATH| [INDEX] | [QUESTION] | [ROUTE] |
|---|---|---|
| [01] | Wrong value or path in one test case | Launch the case by [03], read values by [04] |
| [02] | Value reads empty, wrong, or as a type name alone | [04] before any other step |
| [03] | C++ or Objective-C exception | Exception filter of [05] |
| [04] | Trap, abort, or uncaught throw | Launch with no breakpoint, read [05] |
| [05] | Memory error, undefined behavior, race, leak | references/sanitizers.md |
| [06] | Fails optimized, passes at -O0 | Optimized build at -g, functions stop |
| [07] | Frames of the program's own code without source | Debug info by [06] |
| [08] | Process died, or a state to keep | Core file by [07] |
| [09] | Process already running | Attach by [08] |
CTest holds each case's program, arguments, folder, and environment, and that program runs under the server in place of ctest:
Build through the project's own build command
ctest --test-dir <build> -N lists the cases
catch_discover_tests or gtest_discover_tests runs in PRE_TEST mode -> build the program, then list againCommand and properties of one case:
ctest --test-dir <build> --show-only=json-v1 | jq '.tests[] | select(.name == "<case>") | {command, properties}'
command names a program of the build -> first element is program, the rest args, each element passed wholecommand -> program not built yet, step 1command names cmake or ctest -> case configures or builds a project, and its product is debugged apartWORKING_DIRECTORY -> cwd, each ENVIRONMENT entry <name>=<value> -> one env keyenvironment of the test preset and each preset it inherits -> more env keys, as the JSON lists none of them
session launch with those values and each breakpoint by a source's absolute path:
stopped, breakpoint -> read values by [04][06])Launch facts:
<program> --list-tests lists names), GoogleTest one --gtest_filter=<suite>.<case>CHECK and REQUIRE lines bind 2 locations, so a step from the first stops on the same line, and step_in enters Catch2's own code firstfunctions [{"name": "<function>"}] or a line of their body, in place of a step from an assertion<root> resolve against the client's git root, and another root takes "settings": {"sourceMap": [[".", "<root>"]]}external, no sourcelldb-dap keys of settings: initCommands run before the target exists, preRunCommands before the launch, launchCommands in its placeValue readings, repl commands running in LLDB's selected frame:
| [INDEX] | [READING] | [MEANING] | [NEXT] |
|---|---|---|---|
| [01] | size=error:, or size=0 beside a nonzero .size() | Engine older than libc++ | Engine by [01], launch again |
| [02] | Couldn't look up symbols | Member never instantiated | Repl frame variable --raw-output <name> |
| [03] | std::expected shown by its type name | No summary in LLDB | __repr_ members |
| [04] | Parse error after Ran expression as 'C++14' | DWARF 5 names no later standard | Repl expression -l c++20 -- <expression> |
| [05] | use of undeclared identifier for a caller's local | Expression ran in frame 0 | frame <n>, repl frame select <n> first |
| [06] | Implausible local | Declaration not run yet | next past it, read again |
| [07] | <unavailable> locals, [opt] frames | Optimized unit | Stop at function entry, or build at -O0 |
| [08] | Can't evaluate ... without a running target | Core file, no calls run | Summaries and raw members |
| [09] | Expression set refused | lldb-dap sets variables alone | value with a scope reference |
Value facts:
Conclusions rest on 2 reads of one value: a summary beside .size(), or a summary beside its raw members
std::expected <name> holds <name>.__repr_.__v.__has_val_, then <name>.__repr_.__v.__union_.__v.__val_ or .__unex_ by that flag
One repl line gives every std::expected of a session a summary:
type summary add -x '^std::(__1::)?expected<' --summary-string 'has_value=${var.__repr_.__v.__has_val_}'
hit takes an integer alone: "3" stops at the third hit and every later one, and another form stops at every hit
log prints its {<expression>} values as [console] output lines with no stop
breakpoints add {"watch": "<name>", "reference": <n>, "access": "write"} stops at each write to a variable of the scope or value ref names
Repl image lookup -n <function> names the binary, file, and line holding a symbol
Locals take a new value through value with reference of the Locals scope read {"of": "scopes"} lists, or repl expression <name> = <value>
Exception filters are cpp_throw, cpp_catch, objc_throw, and objc_catch, none armed by default, set through exceptions of session or breakpoints:
signal SIGABRT naming terminating due to uncaught exception of type <type>: <what>, and the first frame with source past the external run is the throwcpp_throw -> stop in __cxa_throw at every throw, caught ones included, with frame 1 the throw lineobjc_throw -> stop naming the NSException reason, the first frame with source the sending linesignal SIGABRT naming the reason, trace: rows listing the throw stackTraps stop with their own text and need no breakpoint:
__builtin_verbose_trap("<category>", "<message>") -> exception, <category>: <message>, frame 0 __clang_trap_msg$<category>$<message>, frame 1 the trapping lineexception, libc++: <header>:<line>: libc++ Hardening assertion <condition> failed: <message>, and the first frame past the library's headers is the call breaking its contractDebug info reaches LLDB on macOS from one of 2 places:
<program>.dSYM beside the program, written by a one-step clang++ -g compile and link, or by dsymutil <program> from the objectsnm -ap <program> | rg ' OSO 'Readings:
read {"of": "modules"} row names <program>.dSYM/Contents/Resources/DWARF/<program> -> dSYM, its own path -> debug mapdebug map object file "<object>" changed ... since this executable was linked in output -> link againstop: unread, naming debug map object file ... does not exist -> objects moved or deleted, so build again or write a dSYMCommands:
clang++ -print-prog-name=dsymutil names the compiler's own dsymutil"settings": {"preRunCommands": ["target symbols add <bundle>.dSYM"]}, or repl target symbols add <bundle>.dSYM at a stopCores beside the forms of tool:debugging:
codesign -f -s - --entitlements <plist> <program> signs a program ad hoc with the get-task-allow a macOS crash core needs, <plist> holding the key as truecoredumpctl dump <pid> -o <file> writes systemd's copy, and a sanitizer report leaves one under the options of references/sanitizers.mdCores load through a launch that stops on entry:
{"action": "launch", "language": "cpp", "program": "<program>", "stop_on_entry": true, "settings": {"launchCommands": ["target create --core <core> <program>"]}, "wait_seconds": 120}
stopped, entry -> frames and locals of the stopped thread, repl thread backtrace all for every threadmach-o-core does not support resuming processes -> stop_on_entry absentAttaches interrupt the system call each thread blocks in:
read returns -1 with errno EINTR once the attach completes, and other blocking calls can tooEINTR as an error or end of input fail or exit at the attach -> launch under the server, or retry the call on EINTRProofs rerun the case through ctest --test-dir <build> -R '^<case>$', or ctest --preset <preset> -R '^<case>$' with its environment.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub bsamiee/rasm --plugin cpp3 skills in this plugin
/codingUse when writing or reviewing C++ or Objective-C++, covering functional design with value types and results, ownership, coroutines, compile-time evaluation, memory layout, concurrency, and C interfaces/unrealUse when writing code an Unreal Engine module or a package it links compiles, or debugging, rebuilding, or reloading C++, Python, or Blueprint running inside Unreal Engine on macOS, or reading its logs, crash reports, and traces, covering module build rules, editor attaches, native stops, Hot Reload, embedded Python, and Blueprint limits