Skip to content

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

Draft
figtracer wants to merge 2 commits into
fig/soldb-debuggerfrom
fig/soldb-ethdebug
Draft

figtracer wants to merge 2 commits into
fig/soldb-debuggerfrom
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.

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

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.

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

T-blocked Type: blocked

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants