npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gba-kit/debug-adapter

v0.9.0

Published

Debug Adapter Protocol server for GBA programs on top of gba-kit: VS Code, Neovim, Emacs, Zed and JetBrains debug a ROM with source, DWARF values, data breakpoints and exact rewind

Readme

@gba-kit/debug-adapter

A Debug Adapter Protocol server for GBA programs, on top of @gba-kit/debug-core. Any editor with a DAP client launches it and debugs a ROM at the source level, with the emulator's own notions of time (frames, scanlines, rewind) reachable through custom requests.

Standard DAP, as an editor expects it:

  • Breakpoints: source lines (statement rows, or the entry of a call inlined on that line; a line without code slides forward and reports where it went), functions, instruction addresses, conditions, hit counts (3, >= 3, % 4), logpoints with {expressions}; data breakpoints on a variable, a struct member picked in the Variables view, a symbol, a label or an address, for reads, writes or both, whose stop names the code that touched it (or the DMA channel and the instruction that started it); hardware events as exception filters (VBlank, HBlank, interrupt request and entry, DMA, I/O write, halt).
  • Stepping: statement or instruction granularity for over, into and out; stepBack is one instruction back, replay-exact; reverseContinue lands on the previous breakpoint hit. Responses always precede the stopped they cause.
  • Call stack with inlined frames, unwound through .debug_frame (a link-register guess is marked subtle).
  • Scopes and variables: Locals, the file's Globals, Registers, Machine. Values unfold structs, unions, bitfields, arrays, enums and pointers; one with an address carries a memory reference for the Memory view, a named one an evaluate name for Watch; scalars and registers other than cpsr are writable. References are dropped whenever the machine moves: a client expands again at the new stop.
  • Evaluate for hover, Watch and the console: C operators, [addr], {addr}, u32(addr), registers, frame/scanline/cycle, enumerators, labels, and C's paths through the DWARF — a.b[i].c, p->m, *p, &x, (T)x and (T *)x, with pointer arithmetic scaled by the element. A console line writes through any of them.
  • Disassembly with symbols, labels and source lines, in the instruction set the ELF's mapping symbols state; memory read and write; loaded sources; restart, which reads the ROM and ELF from disk again (so an edit, a rebuild and a restart debug the new program) with the breakpoints carried over.

Emulator operations are gba-kit/* custom requests, typed in @gba-kit/debug-adapter/protocol (the same module as @gba-kit/debug-core/protocol, where they are defined): buttons, stepFrame / stepScanline, rewind by frames, save states under <project>/.gba-kit/states/, input recordings (and the press/wait script they amount to), the palette / tiles / tilemap / sprites / backgrounds views, decoded I/O registers, the instruction trace and hardware event log, labels (persisted to .gba-kit/labels.json, importable from .sym files), memory search, captures of RAM and the filters that compare them, and a frame/audio stream over a pipe the client owns. Every stop, resume and rewind is also a gba-kit/state event, as is every recording start or stop and every tracing toggle.

Launch configuration

{
  "type": "gba-kit",
  "request": "launch",
  "rom": "${workspaceFolder}/build/game.gba",
  "elf": "${workspaceFolder}/build/game.elf", // default: the ROM's sibling .elf
  "cwd": "${workspaceFolder}", // relative DWARF paths resolve here
  "sourceMap": { "/build-container/src": "${workspaceFolder}/src" }, // optional
  "stopOnEntry": true,
  "projectDir": "${workspaceFolder}", // where .gba-kit/ lives (default: cwd)
  "allowElfMismatch": false, // debug an ELF that is not this ROM's build anyway
}

The launch fails, with the first mismatching section named, when the ELF's loadable bytes differ from the ROM: breakpoints from a stale ELF land in the wrong places, so the adapter says so instead of guessing.

Any editor

npx @gba-kit/debug-adapter            # DAP over stdin/stdout
npx @gba-kit/debug-adapter --server=4711

Neovim with nvim-dap:

local dap = require('dap')
dap.adapters['gba-kit'] = { type = 'executable', command = 'npx', args = { '@gba-kit/debug-adapter' } }
dap.configurations.c = {
  { type = 'gba-kit', request = 'launch', name = 'Debug ROM', rom = '${workspaceFolder}/build/game.gba', cwd = '${workspaceFolder}' },
}

Then :lua require('dap').continue().

The screen outside VS Code

The screen is not part of DAP. gba-kit-screen serves a browser page with the display and a keyboard gamepad, fed by the adapter over a pipe it owns:

npx -p @gba-kit/debug-adapter gba-kit-screen   # prints http://127.0.0.1:4712/ and the pipe path
# or: pnpm --package=@gba-kit/debug-adapter dlx gba-kit-screen

then, in the debug session, send the request it prints:

:lua require('dap').session():request('gba-kit/stream', { path = '/tmp/gba-kit-screen-….sock' })

Frames flow to the page, button presses flow back (the pipe is two-way; see the STREAM framing in protocol.ts). A client that prefers polling asks gba-kit/frame for a base64 RGBA image.

Emacs, Zed, JetBrains

Any DAP client works the same way: launch npx @gba-kit/debug-adapter on stdio with a launch configuration of type: "gba-kit", request: "launch" and the rom / elf / cwd fields above. Emacs dap-mode registers it with dap-register-debug-provider; Zed's debug.json and JetBrains' generic DAP support (2025.1+) take the same command line and arguments. Exception filters show up as the hardware events, custom requests are available wherever the client exposes request, and gba-kit-screen (installed globally, or through npx -p @gba-kit/debug-adapter gba-kit-screen) provides the display.

In-process

import { GbaDebugSession } from '@gba-kit/debug-adapter';

const adapter = new GbaDebugSession();
adapter.start(inputStream, outputStream); // or VS Code's DebugAdapterInlineImplementation
adapter.onSession((session) => session.on({ frame: (rgba) => draw(rgba) }));

Develop

pnpm --filter @gba-kit/debug-adapter build
pnpm --filter @gba-kit/debug-adapter test

The tests drive the adapter with real DAP messages against the committed fixtures of @gba-kit/debug-core — over in-memory streams, and in stdio.spec.ts against the CLI spawned as a real child process on stdio — and check what an editor would see: capabilities, breakpoint verification, the order of responses and events, stale references, and the custom requests.