-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Support ethdebug source locations under EOF #15994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
20d6a64
to
fb559fb
Compare
e6a1055
to
2a91773
Compare
d82b70c
to
0fd1232
Compare
0fd1232
to
cf6aa71
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to take a closer look at this, especially the Assembly.cpp
part, but for now just a few small annoyances I found while doing a quick initial pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output here is quite long and seems to have little to do with ethdebug itself (the ethdebug JSON gets stripped). Do we need it all? What's the point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I just added it because there is the same test for non-eof. And looking at it now, I agree. There doesn't seem to be much value to keep it (or: them) around, especially with #16009 around the corner. I have removed this one.
test/cmdlineTests/standard_output_debuginfo_ethdebug_compatible_eof/input.json
Outdated
Show resolved
Hide resolved
3c02df0
to
f9a0985
Compare
f9a0985
to
ae80060
Compare
@@ -1216,8 +1216,9 @@ Json CompilerStack::ethdebug(Contract const& _contract, bool _runtime) const | |||
solUnimplementedAssert(!isExperimentalSolidity()); | |||
evmasm::LinkerObject const& object = _runtime ? _contract.runtimeObject : _contract.object; | |||
std::shared_ptr<evmasm::Assembly> const& assembly = _runtime ? _contract.evmRuntimeAssembly : _contract.evmAssembly; | |||
solAssert(assembly); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interfaces will throw an assertion here - e.g. with test/libsolidity/semanticTests/interfaceID/homer.sol
.. sadly I didn't add a test for interfaces already, thats why you didn't just saw that..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do interfaces have an environment (call/create)? that'll be required for the current ethdebug schema
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interfaces / abstract contracts not really.. in the previous experimantal version I just omitted "environment" and "instructions" but its not really specified like this.. @gnidan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm I think there's nothing extra needed here? like if you compile just an interface, there's no bytecode and thus nothing to debug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consequently I have replaced the assert by returning empty json. we can think about whether we want to issue a warning, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I just saw
======= /Users/alex/git/solidity/test/libsolidity/semanticTests/interfaceID/homer.sol:Simpson =======
IR:
Debug Data (ethdebug/format/program):
null
Debug Data of the runtime part (ethdebug/format/program):
null
So its not exactly an empty json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you maybe also add a small test that consists of an interface?
ae80060
to
082d7f9
Compare
ret.bytecode.push_back(static_cast<uint8_t>(Instruction::ADD)); | ||
instructionLocationEmitter.emit(); | ||
ret.bytecode.push_back(static_cast<uint8_t>(Instruction::MSTORE)); | ||
// no emit needed here, it's taken care of by the destructor of addInstructionLocation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addInstrictionLocation -> InstructionLocationEmitter, other comments also still referring to the old name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.. at least on the cli I just saw that ethdebug returns null
for the interface (e.g. using test/libsolidity/semanticTests/interfaceID/homer.sol
) - I guess we want an empty json object there. I think it would be nice to add a small test for that simple interface case.
EthdebugSchema
header with the relevant part of the schema mapped to structs with correspondingto_json
methods and validations(-1, -1)
)assembleEOF
Fixes the unoptimized part of #15978.
Fixes #15998.