This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
KDAB DAP is a VS Code extension that debugs C/C++ programs using GDB's and LLDB's own Debug
Adapter Protocol support. Unlike most debugger extensions, it doesn't implement any part of the
DAP protocol itself — both debuggers already speak DAP natively (gdb -i dap, and LLDB's
lldb-dap binary) — so the extension's only job is to find a suitable debugger, work out what to
pass it, and hand it to VS Code as the debug adapter process.
Two debug types, one per debugger: kdap (gdb, 16.1+) and kdap-lldb (lldb-dap, no version
floor). Linux only, by design.
npm run watch # Watch TypeScript files and recompile on changes
npm run lint # ESLint (zero warnings)
npm run format:check # Prettier formatting check
npm run format:fix # Auto-format with Prettier
npm run compile # Compile TypeScript to JavaScript./test.sh # Everything; requires gcc, and gdb 16.1+ and/or lldb-dap, on PATH
./test.sh --unit # Unit tests only, no VS Code instance needed
./test.sh --gdb # Integration tests against gdb only
./test.sh --lldb # Integration tests against lldb-dap only
./build_package.sh # Package the extension as a .vsix file
./test-printers.sh # The standalone suites under printers/; needs g++, gdb, lldb and Qt
# (Qt with debug info: QUrl's printer reads QUrlPrivate, which only
# libQt6Core's own debug info describes - see printers/lldb/qt/README.md)./test.sh wraps npm test, which is npm run test:unit (plain mocha) followed by
npm run test:integration (vscode-test, which boots a real VS Code per suite).
The integration debug suite runs once per debugger in the registry, inside one VS Code instance,
skipping any debugger that isn't installed. --gdb / --lldb set KDAP_TEST_DEBUGGERS.
Everything outside src/debuggers/ is debugger-agnostic. No file outside that directory
should name gdb or lldb — adding a debugger means adding a backend and a contributes.debuggers
entry, nothing else.
src/extension.ts— activation entry point; registers aDapDescriptorFactoryand aDapConfigurationProviderper entry in the backend registry.src/debuggers/backend.ts— theDebuggerBackendinterface. It deliberately covers both the adapter's argv and the launch configuration: gdb expresses nearly everything as an-iexcommand because its DAP handler ignores launch arguments it doesn't know, while lldb-dap expresses most of the same things as DAP launch arguments.src/debuggers/registry.ts— the list of backends, and the debug types derived from it.src/sessionOptions.ts— parses a launch configuration plus the settings intoSessionOptions, the debugger-independent intents (sysroot, sourceFileMap, logging, …). Only intents that make sense for more than one debugger belong here; single-debugger properties stay in the launch configuration and are read by that backend.src/settings.ts— readskdap.*into a plain-data snapshot. Settings whose meaning depends on the debugger live underkdap.<backend id>.;kdap.logPathandkdap.environmentare shared.src/debugAdapterFactory.ts— resolves the binary (launch config'sdebuggerPath>kdap.<debugger>.pathsetting > the backend's ownPATHlookup), lets the backend vet it and render the command line, and reports whatever the backend says it can't support.src/debuggers/gdb/—arguments.ts(argv,-iexcommands),version.ts(the 16.1 floor),prettyPrinters.ts(the Qt printer download),backend.ts(the wiring, plus theinf.clear_env()workaround that makes a launch config'senvmerge rather than replace).src/debuggers/lldb/—arguments.ts(LLDBDAP_LOG, and the options lldb can't honour),configuration.ts(sourceMap),backend.ts(the wiring).printers/— Python a backend loads into its debugger, bundled in the.vsix:printers/lldb/qt/(Qt pretty printers, which lldb doesn't ship) andprinters/gdb/(kdap_map_hint.py, which makes gdb's DAP layer pair up the children of amap-hinted pretty printer instead of showing[0].key/[0].valuerows). Each has a standalone test suite undertests/, all of them run by./test-printers.sh.
arguments.ts, configuration.ts, version.ts, sessionOptions.ts and paths.ts take no
vscode dependency, which is where the logic lives and where the unit tests reach it; the
backend.ts files are the thin vscode-facing wiring.
src/test/integration/smoke.test.ts— extension activation and configuration sanity checks.src/test/integration/debug.test.ts— a loop overenabledTestDebuggers(), which reads the extension's own backend registry, so registering a backend runs the suite against it.src/test/integration/debugSuite.ts— the suite body, defined once per debugger. Everything asserted here is a promise the extension makes regardless of which debugger is behind it, so the assertions are identical per debugger rather than switched on the descriptor: making them hold on a new debugger is the extension's job, not the test's. This is the test that actually exercises the DAP-to-DAP communication path.src/test/unit/— plain mocha, run without a VS Code instance, so nothing here (nor anything it imports) mayimport "vscode". Registered by thetest:unitglob rather than by name, unlike the integration suites, which.vscode-test.jslists individually.
- ESLint uses
js.configs.recommendedplus typescript-eslint'srecommendedTypeChecked(type-aware, so rules likeno-floating-promisesapply), andnpm run lintallows zero warnings. Run it before committing — pre-commit does not. - Prettier (
npm run format:check/format:fix) coverssrc/**/*.ts. Run it before committing too; pre-commit does not. - pre-commit (
.pre-commit-config.yaml) only enforces conventional commit messages and runs codespell. - GitHub Actions enforces ESLint and Prettier on every PR and push (
.github/workflows/lints.yml) - CI is Linux-only and split by debugger:
.github/workflows/build-gdb.ymlinstalls only gdb and runs./test.sh --gdb,.github/workflows/build-lldb.ymlinstalls only lldb and runs./test.sh --lldb.
- Conventional commits: prefix with
fix:,feat:, orchore: - Releases: managed automatically via
release-please(.github/workflows/release-please.yml); merge the Release PR to trigger changelog + version bump + tag - Publishing:
.github/workflows/package.ymlbuilds the.vsix; upload manually to the VS Marketplace at marketplace.visualstudio.com/manage/publishers/KDAB