Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
f42fbdc
ethdebug: Add semantic debug metadata carrier
djolertrk May 26, 2026
2eb9591
ethdebug: Add semantic debug AST ID side table
djolertrk May 26, 2026
db60f85
ethdebug: Preserve semantic debug data across Yul reparse
djolertrk May 26, 2026
98aa615
ethdebug: Attach semantic debug data for function variables
djolertrk May 26, 2026
5ba220a
docs: Document ETHDebug internal metadata
djolertrk May 26, 2026
673e292
test: Cover semantic debug data across Yul reparse
djolertrk Jun 5, 2026
81ab972
docs: improve ethdebug internal metadata
djolertrk Jun 5, 2026
042f584
ethdebug: Map semantic variables to type descriptors
djolertrk Jun 7, 2026
17ac6ad
ethdebug: Map semantic variables to pointer descriptors
djolertrk Jun 7, 2026
e4e8a2d
ethdebug: Add optimizer debug location update rule
djolertrk Jun 7, 2026
c7179bb
ethdebug: Export semantic type resources
djolertrk Jun 9, 2026
06a7aa6
ethdebug: Export storage pointer resources
djolertrk Jun 9, 2026
43fbf6a
ethdebug: Default initialize semantic variable list
djolertrk Jun 10, 2026
c978e47
ethdebug: Fix semantic metadata for modifiers
djolertrk Jun 10, 2026
05fdbb3
yul: Avoid MSVC leave keyword in debug data visitors
djolertrk Jun 10, 2026
596ce3d
ethdebug: Harden semantic debug metadata propagation
djolertrk Jun 10, 2026
53a8f2c
test: Avoid nested designated initializers that crash MSVC
djolertrk Jun 11, 2026
d76fb19
ethdebug: Emit program-level state variable context
djolertrk Jun 25, 2026
4bec7ed
ethdebug: Support recursive type and pointer descriptors
djolertrk Jul 1, 2026
0f4a723
ethdebug: Assert positive width for sized resize expressions
djolertrk Jul 6, 2026
9f4a524
ethdebug: Move semantic metadata JSON lowering out of CompilerStack
djolertrk Jul 6, 2026
68e2379
ethdebug: Describe variable data locations at EVM level
djolertrk Jul 20, 2026
a8e7fc6
ethdebug: Add versioned serialization for the semantic side table
djolertrk Jul 20, 2026
d30f299
test: Cover ethdebug semantic metadata production with isoltests
djolertrk Jul 20, 2026
728d780
ethdebug: Serialize the semantic sidecar across compiler interfaces
djolertrk Jul 20, 2026
e5e142e
docs: Rewrite the ethdebug internal metadata specification
djolertrk Jul 20, 2026
a752fda
test: Avoid comparing Json against string_view, which is ambiguous on…
djolertrk Jul 23, 2026
9b0d173
test: Run transient storage pointer isoltest only from Cancun on
djolertrk Jul 23, 2026
34c2193
test: Build source maps explicitly instead of via nested braced initi…
djolertrk Jul 23, 2026
3797dbd
ethdebug: Normalize the Yul path in --ethdebug-input mappings
djolertrk Jul 24, 2026
12f6283
docs: Specify optimizer debug info update rules
djolertrk Jul 27, 2026
9772f4b
ethdebug: Share one name table between each enum's two directions
djolertrk Jul 31, 2026
fc13679
docs: Answer the type vocabulary and expression questions
djolertrk Aug 3, 2026
c76b987
docs: Say where pointer templates and type descriptors actually live
djolertrk Aug 3, 2026
652ddcd
docs: Specify how pointers survive the optimizer
djolertrk Aug 3, 2026
aade685
ethdebug: Separate a Yul local from a bound variable in pointer expre…
djolertrk Aug 3, 2026
51cb5ec
docs: Stop claiming scopeInstanceID is serialized
djolertrk Aug 3, 2026
65697d9
ethdebug: Resolve the type vocabulary
djolertrk Aug 4, 2026
9949090
ethdebug: Key debug entries by (astId, instance) end to end
djolertrk Aug 5, 2026
321af53
ethdebug: Location updates, so a value that moves can be described
djolertrk Aug 5, 2026
1460456
ethdebug: Share type descriptors by ID in the serialized sidecar
djolertrk Aug 5, 2026
0189c6f
ethdebug: Rename SemanticDebugDataSerDe to SemanticDebugDataSerializa…
djolertrk Aug 6, 2026
8a1ee75
Update docs/internals/ethdebug_internal_metadata.rst
djolertrk Aug 6, 2026
e09ced2
ethdebug: Remove the type-level dataLocation annotation
djolertrk Aug 6, 2026
6fd875c
docs: Cite where the type reference ID comes from in the ethdebug spec
djolertrk Aug 6, 2026
1bf1f27
ethdebug: Serialize sidecar types as the ethdebug type schema
djolertrk Aug 7, 2026
7ab444e
Fix coding style in the type table lambdas
djolertrk Aug 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ Contents
internals/layout_in_calldata.rst
internals/variable_cleanup.rst
internals/source_mappings.rst
internals/ethdebug_internal_metadata.rst
internals/optimizer.rst
metadata.rst
abi-spec.rst
Expand Down
538 changes: 538 additions & 0 deletions docs/internals/ethdebug_internal_metadata.rst
Comment thread
cameel marked this conversation as resolved.

Large diffs are not rendered by default.

21 changes: 19 additions & 2 deletions docs/using-the-compiler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,17 @@ Input Description
}
}
},
// Optional auxiliary inputs.
"auxiliaryInput": {
// Internal ethdebug semantic data sidecar for Yul input (experimental).
// This is the object emitted as the Solidity `irEthdebug` output.
"ethdebug": {
"format": "solidity-ethdebug-semantic-data",
"version": 1,
"contractName": "ContractName",
"entries": [/* ... */]
}
},
// Optional
"settings":
{
Expand Down Expand Up @@ -391,7 +402,9 @@ Input Description
// The snippet is quoted and follows the corresponding `@src` annotation.
// - `ast-id`: Annotations of the form `@ast-id <id>` over elements that can be mapped back to a definition in the original Solidity file.
// `<id>` is a node ID in the Solidity AST ('ast' output).
// - `ethdebug`: Ethdebug annotations (experimental). Automatically enabled when any ethdebug output is requested.
// - `ethdebug`: Ethdebug annotations (experimental). Depends on `ast-id`; explicitly selecting
// `ethdebug` without `ast-id` is an error. The required pair is automatically enabled when
// an ethdebug output is requested without an explicit `debugInfo` selection.
// - `*`: Wildcard value that can be used to request all non-experimental components.
"debugInfo": ["location", "snippet", "ast-id", "ethdebug"]
},
Expand Down Expand Up @@ -444,6 +457,7 @@ Input Description
// userdoc - User documentation (natspec)
// metadata - Metadata
// ir - Yul intermediate representation of the code before optimization
// irEthdebug - Internal ethdebug semantic data sidecar for the Yul IR (experimental)
// irAst - AST of Yul intermediate representation of the code before optimization (experimental)
// irOptimized - Intermediate representation after optimization
// irOptimizedAst - AST of intermediate representation after optimization (experimental)
Expand Down Expand Up @@ -602,6 +616,8 @@ Output Description
"devdoc": {},
// Intermediate representation before optimization (string)
"ir": "",
// Internal ethdebug semantic data sidecar for Yul (experimental)
"irEthdebug": {/* ... */},
// AST of intermediate representation before optimization
"irAst": {/* ... */},
// Intermediate representation after optimization (string)
Expand Down Expand Up @@ -769,7 +785,8 @@ The table below details all currently available experimental features.
+-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| Non-mainnet EVMs | ``evm`` | yes | ``--evm-version <version name>`` |
+-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| Ethdebug | ``ethdebug`` | no | ``--ethdebug-resources``, ``--ethdebug-compilation``, ``--ethdebug-program``, ``--ethdebug-program-runtime``, ``--debug-info ethdebug`` |
| Ethdebug | ``ethdebug`` | no | ``--ethdebug-resources``, ``--ethdebug-compilation``, ``--ethdebug-program``, ``--ethdebug-program-runtime``, ``--ir-ethdebug``, |
| | | | ``--ethdebug-input``, ``--debug-info ast-id,ethdebug`` |
+-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| | | no | ``--yul-cfg-json`` |
| SSA CFG + ``ssa-cfg`` +------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
Expand Down
15 changes: 10 additions & 5 deletions libevmasm/Ethdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ schema::materials::Compilation materialCompilation(std::vector<Source> const& _s

} // anonymous namespace

Json ethdebug::program(std::string_view _name, unsigned _sourceID, Assembly const& _assembly, LinkerObject const& _linkerObject)
Json ethdebug::program(std::string_view _name, unsigned _sourceID, Assembly const& _assembly, LinkerObject const& _linkerObject, std::optional<schema::program::Context> _programContext)
{
return schema::Program{
.compilation = std::nullopt,
Expand All @@ -186,17 +186,22 @@ Json ethdebug::program(std::string_view _name, unsigned _sourceID, Assembly cons
}
},
.environment = _assembly.isCreation() ? schema::Program::Environment::CREATE : schema::Program::Environment::CALL,
.context = std::nullopt,
.context = std::move(_programContext),
.instructions = programInstructions(_assembly, _linkerObject, _sourceID)
};
}

Json ethdebug::resources(std::vector<Source> const& _sources, std::string_view _version)
Json ethdebug::resources(
std::vector<Source> const& _sources,
std::string_view _version,
Json _types,
Json _pointers
)
{
schema::info::Resources result;
result.compilation = materialCompilation(_sources, _version);
result.types = Json::object();
result.pointers = Json::object();
result.types = std::move(_types);
result.pointers = std::move(_pointers);
return result;
}

Expand Down
18 changes: 16 additions & 2 deletions libevmasm/Ethdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
#include <libsolutil/JSON.h>

#include <libevmasm/Assembly.h>
#include <libevmasm/EthdebugSchema.h>
#include <libevmasm/LinkerObject.h>

#include <optional>

namespace solidity::evmasm::ethdebug
{

Expand All @@ -35,10 +38,21 @@ struct Source
};

// returns ethdebug/format/program.
Json program(std::string_view _name, unsigned _sourceID, Assembly const& _assembly, LinkerObject const& _linkerObject);
Json program(
std::string_view _name,
unsigned _sourceID,
Assembly const& _assembly,
LinkerObject const& _linkerObject,
std::optional<schema::program::Context> _programContext = std::nullopt
);

// returns ethdebug/format/info/resources
Json resources(std::vector<Source> const& _sources, std::string_view _version);
Json resources(
std::vector<Source> const& _sources,
std::string_view _version,
Json _types = Json::object(),
Json _pointers = Json::object()
);

// returns the 'compilation' object from ethdebug/format/info/resources
Json compilation(std::vector<Source> const& _sources, std::string_view _version);
Expand Down
8 changes: 7 additions & 1 deletion libevmasm/EthdebugSchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ void schema::program::to_json(Json& _json, Context::Variable const& _contextVari
{
auto const numProperties =
_contextVariable.identifier.has_value() +
_contextVariable.declaration.has_value();
_contextVariable.declaration.has_value() +
_contextVariable.type.has_value() +
_contextVariable.pointer.has_value();
solRequire(numProperties >= 1, EthdebugException, "Context variable has no properties.");
if (_contextVariable.identifier)
{
Expand All @@ -111,6 +113,10 @@ void schema::program::to_json(Json& _json, Context::Variable const& _contextVari
}
if (_contextVariable.declaration)
_json["declaration"] = *_contextVariable.declaration;
if (_contextVariable.type)
_json["type"] = *_contextVariable.type;
if (_contextVariable.pointer)
_json["pointer"] = *_contextVariable.pointer;
}

void schema::program::to_json(Json& _json, Context const& _context)
Expand Down
6 changes: 4 additions & 2 deletions libevmasm/EthdebugSchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ struct Context
{
std::optional<std::string> identifier;
std::optional<materials::SourceRange> declaration;
// TODO: type
// TODO: pointer according to ethdebug/format/spec/pointer
// ethdebug/format/type/specifier: a full type representation or an { "id": ... } reference.
std::optional<Json> type;
// ethdebug/format/pointer: a region or collection describing where the value lives.
std::optional<Json> pointer;
};

std::optional<materials::SourceRange> code;
Expand Down
4 changes: 4 additions & 0 deletions liblangutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ set(sources
Scanner.cpp
Scanner.h
CharStreamProvider.h
SemanticDebugData.h
SemanticDebugDataSerialization.cpp
SemanticDebugDataSerialization.h
SemanticDebugDataTable.h
SemVerHandler.cpp
SemVerHandler.h
SourceLocation.h
Expand Down
16 changes: 12 additions & 4 deletions liblangutil/DebugData.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@

#pragma once

#include <liblangutil/SemanticDebugData.h>
#include <liblangutil/SourceLocation.h>
#include <optional>
#include <memory>
#include <utility>

namespace solidity::langutil
{
Expand All @@ -32,23 +34,27 @@ struct DebugData
explicit DebugData(
langutil::SourceLocation _nativeLocation = {},
langutil::SourceLocation _originLocation = {},
std::optional<int64_t> _astID = {}
std::optional<int64_t> _astID = {},
SemanticDebugData::ConstPtr _semanticDebugData = {}
):
nativeLocation(std::move(_nativeLocation)),
originLocation(std::move(_originLocation)),
astID(_astID)
astID(_astID),
semanticDebugData(std::move(_semanticDebugData))
{}

static DebugData::ConstPtr create(
langutil::SourceLocation _nativeLocation,
langutil::SourceLocation _originLocation = {},
std::optional<int64_t> _astID = {}
std::optional<int64_t> _astID = {},
SemanticDebugData::ConstPtr _semanticDebugData = {}
)
{
return std::make_shared<DebugData>(
std::move(_nativeLocation),
std::move(_originLocation),
_astID
_astID,
std::move(_semanticDebugData)
);
}

Expand All @@ -65,6 +71,8 @@ struct DebugData
langutil::SourceLocation originLocation;
/// ID in the (Solidity) source AST.
std::optional<int64_t> astID;
/// Extended semantic debug data that cannot be represented in Yul comments.
SemanticDebugData::ConstPtr semanticDebugData;
};

} // namespace solidity::langutil
Loading