Skip to content

feat(debugger): read ETHDebug programs in soldb - #17430

Draft
figtracer wants to merge 8 commits into
masterfrom
fig/soldb-ethdebug
Draft

figtracer wants to merge 8 commits into
masterfrom
fig/soldb-ethdebug

Conversation

@figtracer

@figtracer figtracer commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Why

Before: SolDB gets debug info only from legacy source maps, which have no variable locations.

After: debug runs also give SolDB the compiler's ETHDebug programs, which will carry variable locations when compilers emit them (paradigmxyz/solar#1800, argotorg/solidity#16990, walnuthq/soldb#181). Today the programs give the same stops as source maps, so this PR stays a draft.

Change

Stacked on #17429, with foundry-core pinned to foundry-rs/foundry-core#248. Debug runs request ETHDebug: always for solar, and for solc only with via-IR and the optimizer off, which also sets experimental. The adapter prefers the program over the source map, and --dump writes it into the bundle.

Downstream

With solc, experimental adds 14 bytes to the CBOR metadata of debug builds; the executed code does not change. Before merge, move the foundry-core pin to the merged #248 commit.

Add `--debugger soldb` to `forge test`, `forge script`, `cast run`, and
`cast call`. An adapter converts forge's step traces and legacy source
maps into soldb's types and runs the soldb session. With `--dump`, it
writes a bundle that `soldb profile` and `soldb-dap-server` read. soldb
sits behind the `soldb` cargo feature, which release builds enable; the
built-in debugger stays the default.

Debug runs now enable `build_info` and read the compiled sources from
it, so both debuggers show correct lines in test files that dynamic
test linking rewrites.

Refs #16557
Pin foundry-core to foundry-rs/foundry-core#248, which keeps the
compiler's ETHDebug programs on artifacts. With `--debugger soldb`,
forge, script, and cast request them: always for solar, which emits
them for optimized builds, and for solc only through via-IR with the
optimizer disabled, with `experimental` set from 0.8.35. The soldb
adapter prefers the compiler's program over the legacy source map, and
the `--dump` bundle writes the programs in the layout soldb loads.

With solc, `experimental` grows the CBOR metadata by 14 bytes; the
executed code is unchanged.

Refs #16557
@marijamijailovic

Copy link
Copy Markdown

Just a follow-up on this: soldb also works with older solc versions that don't emit ETHDebug. Without an ETHDebug program, it falls back to the compiler's legacy source map. That still gives lines, functions, frames, breakpoints, and state variables from the storage layout -> https://github.com/walnuthq/soldb#try-it

Merge current master and update the published SolDB crates to 0.4.1. Keep deployment, setup, and execution traces in one session, preserve breakpoint offsets, and record transient storage and return-data snapshots.
Use SolDB for every debug command and remove the legacy UI and frontend selection. Make the adapter dependencies unconditional and migrate dump consumers to SolDB bundles.

BREAKING CHANGE: --dump writes a directory, --debug-layout is removed, and Rust callers must use DebuggerBuilder::run instead of the old debugger API.
Bump SolDB to 0.4.2, which no longer counts forwarded call gas as spent in profiles.
Follow the SolDB replacement: every debug run requests ETHDebug, since SolDB is the only debugger. Move the foundry-core pin to the ETHDebug branch merged with current main.
@figtracer figtracer added the T-blocked Type: blocked label Oct 20, 2026
Base automatically changed from fig/soldb-debugger to master October 29, 2026 16:20
@github-actions

Copy link
Copy Markdown
Contributor

This pull request is stale because it has been open for 14 days with no activity. It will be closed in 7 days if there is no further activity.

@github-actions github-actions Bot added the stale label Nov 13, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale T-blocked Type: blocked

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants