Skip to content

Debugger: source-mapped stack traces and a Chrome DevTools Protocol (--inspect) endpoint #33

Closed

Description

@hassidan

Summary

Slice has no debugger. --trace exports Chrome-trace span timelines, which is useful for profiling but there is no way to set a breakpoint, step, inspect scope, or evaluate in a paused frame.

Why it matters

In the conversations I have had evaluating Slice for teams, "can I attach a debugger?" is the first question after "does my framework run?". Hono, itty-router and Express-style apps now run unmodified (v0.10.5), which means the next blocker to adoption is the inner loop: a stack trace pointing into a SLICEBC blob with no line mapping, and no breakpoints. Bun, Deno and Node all speak the Chrome DevTools Protocol (CDP), so editors already have the client side.

Proposal (incremental)

  1. Source-mapped stack traces first. CAS already embeds sourcemaps; ensure every Error.stack emitted from Boa is rewritten to original file:line:col before reaching user code or the CLI. Add a test that a thrown error in tests/apps/01 reports src/pricing_engine.ts:NN.
  2. slice run --inspect[-brk]=host:port exposing a CDP WebSocket endpoint (the WebSocket server code from net/websocket.rs can be reused).
  3. Implement the minimum CDP domains editors need: Runtime.enable/evaluate/getProperties, Debugger.enable/setBreakpointByUrl/pause/resume/stepOver/stepInto/stepOut/getScriptSource, Debugger.paused/resumed events with call frames and scope chains.
  4. Boa side: a per-instruction hook in the VM dispatch loop that checks a breakpoint bitmap for the current CodeBlock/pc (the vendored engine in vendor/boa_engine makes this feasible; upstream Boa has an experimental --debugger flag worth tracking). The same hook can share the fuel counter so debugging does not disturb metering.
  5. Fuel/timeout should be suspended while paused, and resumed on Debugger.resume.

Even step 1 alone would be a significant DX improvement.

Activity

  1. siktec-lab commented on Nov 9, 2026

    @siktec-lab
    Collaborator

    Addressed in #41 (�0.10.6).

    • Kept the fused runtime prelude on a single line so SLICEBC\x01 pre-compiled bytecode line numbers align 1:1 with //@sm: source map markers.
    • Extended source map resolution to cover ES6 class methods, dynamic error prefixes (TypeError, ReferenceError, etc.), and uncaught exception output so original : locations are preserved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions