Skip to content

ethdebug: Require an explicit debug info selection and ast-id - #16961

Merged
cameel merged 1 commit into
argotorg:developfrom
walnuthq:feature/ethdebug-explicit-debuginfo
Sep 19, 2026
Merged

cameel merged 1 commit into
argotorg:developfrom
walnuthq:feature/ethdebug-explicit-debuginfo

Conversation

@djolertrk

Copy link
Copy Markdown
Contributor

Selecting an ethdebug output no longer implicitly enables the ethdebug and ast-id components of the debug info selection, just as --ir-optimized does not imply --optimize: requesting a program ethdebug output without ethdebug in --debug-info or settings.debug.debugInfo is now an error, in both the CLI and Standard JSON.

Semantic debug info transfer depends on @ast-id comments, so ethdebug now also depends on the ast-id component: selecting ethdebug without ast-id is an error. The ethdebug.resources and ethdebug.compilation outputs are derived from analysis results alone and still need no selection.

The optimizer and SSA CFG gates now apply whenever ethdebug is selected, not only when a program output is requested.

@djolertrk

djolertrk commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor Author

cc @cameel

Comment thread solc/CommandLineParser.cpp Outdated
Comment thread docs/using-the-compiler.rst Outdated
Comment thread docs/using-the-compiler.rst Outdated
Comment thread libsolidity/interface/StandardCompiler.cpp Outdated
Comment thread libsolidity/interface/StandardCompiler.cpp
Comment thread libsolidity/interface/StandardCompiler.cpp Outdated
@djolertrk
djolertrk force-pushed the feature/ethdebug-explicit-debuginfo branch from 19a7db3 to 3f08fa2 Compare September 3, 2026 09:16
@djolertrk
djolertrk requested a review from cameel September 3, 2026 09:16
@djolertrk
djolertrk force-pushed the feature/ethdebug-explicit-debuginfo branch 2 times, most recently from bd52feb to cc712c9 Compare September 4, 2026 09:04
@cameel cameel self-assigned this Sep 7, 2026

@nikola-matic nikola-matic left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was off for a while so just curious - are we making ast-id an explicit requirement to be more in line with other output requests, or was there a different reason?

if iszero(condition) { panic_error_0x01() }
}
/// @src 1:72:121
/// @ast-id 41 @src 1:72:121

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this wasn't introduced here, but I'd say we should consolidate the printers to have these outputs be consistent (either dump everything into one line, or put each item on a new one).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, though that's something I'd do in a separate PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I agree.

Comment thread solc/CommandLineParser.cpp Outdated
@cameel

cameel commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

are we making ast-id an explicit requirement to be more in line with other output requests, or was there a different reason?

Yes. Context: #16780 (comment).

Comment thread libsolidity/interface/CompilerStack.cpp Outdated
Comment on lines +1206 to +1210
// Without the ethdebug debug info component the pipeline does not carry the
// info the program output is derived from; the output is empty rather than
// an error, like the outputs of a contract that produces no bytecode.
if (!m_debugInfoSelection.ethdebug)
return {};

@cameel cameel Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this is still not exactly what I meant in #16961 (comment). I think I wasn't clear enough about how that empty output is meant to be produced.

I said "empty output" because I assumed that's what we will get from Yul stack if we don't block it with an error. We should pass on to the user whatever it gives us rather than short-circuit here. Just like yulIR() or object() return whatever we have stored in the Contract object as a result of the compilation.

@cameel cameel Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, will the output even be completely empty? Now that I think of it, it will just be missing the variable info that goes into context, right? There's still other useful info elsewhere. E.g. instructions, the compilation reference, type of assembly, etc. These things are likely available even without passing any extra debug info through Yul and we should return them if they are. Basically, the content of the ethdebug program output from single- and two-stage compilation should be the same.

We should actually have a simple test verifying that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I guess I misunderstood that one then. I dropped the early return, now it just returns whatever the assembly gives, instructions and all, only the context is missing.

Comment thread test/cmdlineTests/ethdebug_program_without_debug_info/exit Outdated
Comment thread test/cmdlineTests/ethdebug_program_without_debug_info/args Outdated
Comment thread test/cmdlineTests/metadata_experimental/args Outdated
Comment thread test/cmdlineTests/standard_output_selection_ethdebug_no_debug_info/input.json Outdated
Comment thread test/cmdlineTests/standard_output_selection_ethdebug_no_viair/output.json Outdated
Comment thread libsolidity/interface/StandardCompiler.cpp
@djolertrk
djolertrk force-pushed the feature/ethdebug-explicit-debuginfo branch from cc712c9 to 173a029 Compare September 8, 2026 13:00
@djolertrk

Copy link
Copy Markdown
Contributor Author

are we making ast-id an explicit requirement to be more in line with other output requests, or was there a different reason?

Yes. Context: #16780 (comment).

Yes!

@djolertrk
djolertrk force-pushed the feature/ethdebug-explicit-debuginfo branch 2 times, most recently from 7020fa3 to cd69b55 Compare September 8, 2026 20:32
@cameel

cameel commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

Looks like some of the tests break the build.

@djolertrk
djolertrk force-pushed the feature/ethdebug-explicit-debuginfo branch 2 times, most recently from e445dae to 306db70 Compare September 9, 2026 06:44
@djolertrk

Copy link
Copy Markdown
Contributor Author

Looks like some of the tests break the build.

It is fixed now.

@djolertrk

Copy link
Copy Markdown
Contributor Author

@nikola-matic @cameel is this ready?

@djolertrk
djolertrk force-pushed the feature/ethdebug-explicit-debuginfo branch from 306db70 to 48d5fb3 Compare September 10, 2026 07:12
Comment thread Changelog.md
Comment thread docs/using-the-compiler.rst Outdated
Comment thread test/cmdlineTests/ethdebug_program_without_ethdebug_in_debug_info/args Outdated
@djolertrk
djolertrk force-pushed the feature/ethdebug-explicit-debuginfo branch from 48d5fb3 to c6a660d Compare September 11, 2026 13:00
@djolertrk
djolertrk requested a review from cameel September 14, 2026 10:20

@cameel cameel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's the final batch.

The tests here were quite tedious to review for such a small change. Commandline tests are too verbose and Boost tests are getting repetitive as well. And they both have a lot of overlap. We would be better off with more things being testable using custom TestCases.

We should think about it in the longer term, but in the context of this PR I just suggested a few adjustments and removals. When you apply those, we can move on.

Comment thread test/solc/CommandLineInterface.cpp
Comment thread test/libsolidity/StandardCompiler.cpp Outdated
Comment thread test/libsolidity/StandardCompiler.cpp Outdated
Comment thread test/libsolidity/StandardCompiler.cpp Outdated
Comment thread test/libsolidity/StandardCompiler.cpp Outdated
@djolertrk
djolertrk requested a review from cameel September 15, 2026 13:39
@djolertrk
djolertrk force-pushed the feature/ethdebug-explicit-debuginfo branch from c6a660d to 51fd389 Compare September 15, 2026 13:44
…debug outputs

Selecting an ethdebug output no longer implicitly enables the ethdebug
and ast-id components of the debug info selection, just as --ir-optimized
does not imply --optimize. Without ethdebug in --debug-info or
settings.debug.debugInfo the program outputs are still produced from what
the pipeline has, i.e. without the annotations that component adds, the
same way the outputs of an interface are produced without bytecode.

Semantic debug info transfer depends on @ast-id comments, so ethdebug now
also depends on the ast-id component: selecting ethdebug without ast-id
is an error. The ethdebug.resources and ethdebug.compilation outputs are
derived from analysis results alone and need no selection.

The optimizer gate applies whenever ethdebug is selected. The SSA CFG
gate applies to the program outputs as well, since that code generator
attaches no source locations, which those outputs consist of.
@djolertrk
djolertrk force-pushed the feature/ethdebug-explicit-debuginfo branch from 51fd389 to e6934d8 Compare September 15, 2026 13:44
@cameel
cameel merged commit e56c2b4 into argotorg:develop Sep 19, 2026
83 checks passed
@argotorg argotorg deleted a comment from john23armedilla-spec Sep 19, 2026
@argotorg argotorg deleted a comment from john23armedilla-spec Sep 19, 2026
gnidan added a commit to ethdebug/format that referenced this pull request Sep 22, 2026
solc's develop branch rejects `debugInfo: ["ethdebug"]` since
argotorg/solidity#16961 (merged 2026-09-19): "To use 'ethdebug' with
settings.debug.debugInfo you must select also 'ast-id'." Every
conformance run against a solc built after that date fails at
compilation. The adapter now selects both.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants