Skip to content

ethdebug: Add the semantic debug info side table and its sidecar - #4

Open
djolertrk wants to merge 3 commits into
feature/ethdebug-resources-schemafrom
feature/ethdebug-data-table
Open

djolertrk wants to merge 3 commits into
feature/ethdebug-resources-schemafrom
feature/ethdebug-data-table

Conversation

@djolertrk

Copy link
Copy Markdown
Collaborator

A few things addressed:

  • Move the ethdebug schema to liblangutil
  • Read and validate the resources tables from JSON
  • Add the semantic debug info side table and its sidecar

@djolertrk

Copy link
Copy Markdown
Collaborator Author

cc @cameel

@djolertrk
djolertrk added this pull request to stack #6 October 1, 2026 18:56
@djolertrk
djolertrk force-pushed the feature/ethdebug-data-table branch 3 times, most recently from 79e6567 to 090c641 Compare October 9, 2026 12:45
@djolertrk
djolertrk force-pushed the feature/ethdebug-data-table branch from 090c641 to 0f663ff Compare October 16, 2026 12:00
The semantic debug info side table lives in liblangutil, next to the
DebugData of Yul nodes that will carry its records, and is expressed in
the ethdebug type and pointer structures. Those therefore move down from
libevmasm, which keeps producing the program and resources outputs from
them under the same schema namespace.
Add the reading direction for the ethdebug type and pointer structures:
type documents, pointer expressions, pointers and pointer templates are
parsed from JSON and checked against the schema, with every violation
reported as a util::JsonValidationError whose message names the
offending location.

The generic part of that checking, i.e. object and array requirements,
member presence, unknown members and typed member access, goes into
libsolutil's JSON helpers next to isOfType(), so that the other JSON
importers can use it as well.

A new isoltest flavour, ethdebugDocumentTests, reads an ethdebug JSON
document, validates it and writes it back, so that the expectation is
either the document as the compiler writes it or the validation error.
Add the compiler structures of the semantic debug info specified in
docs/internals/ethdebug_internal_debug_info.rst: scope records keyed by
a scope ID (the AST ID of the source-language scope and an instance
discriminator for cloned code), with variables carrying their identity,
declaration range, type reference, phase and ethdebug pointer, plus the
variable updates optimizer passes will produce. The side table keeps
the records together with the type and pointer template resources they
reference.

Stack values are expressed over generated Yul locals until Yul is
compiled to EVM, so the pointer expressions gain one compiler-internal
form, YulLocal, written as $$yulLocal in the sidecar only; readers
accept it on request and the public resources writer rejects it.

The sidecar serialization writes the table as a versioned JSON document
and reads it back with the same validation as the resources: unknown
formats and members, malformed scope keys, variables whose phase and
pointer disagree, unresolvable template references and internal
expressions in the resources are reported with their location.

The ethdebug document tests cover the sidecar round trip and the
validation errors.
@djolertrk
djolertrk force-pushed the feature/ethdebug-data-table branch from 0f663ff to 74b357c Compare October 19, 2026 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant