Repository navigation
Conversation
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
|
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.
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. |
# Conflicts: # Cargo.lock # Cargo.toml
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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--dumpwrites it into the bundle.Downstream
With solc,
experimentaladds 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.