-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Make ethdebug inputs/outputs consistent #16565
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -393,7 +393,7 @@ 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). | ||
| // - `ethdebug`: Ethdebug annotations (experimental). Automatically enabled when any ethdebug output is requested. | ||
| // - `*`: Wildcard value that can be used to request all non-experimental components. | ||
| "debugInfo": ["location", "snippet", "ast-id", "ethdebug"] | ||
| }, | ||
|
|
@@ -453,8 +453,8 @@ Input Description | |
| // transientStorageLayout - Slots, offsets and types of the contract's state variables in transient storage | ||
| // evm.assembly - New assembly format | ||
| // evm.legacyAssembly - Old-style assembly format in JSON | ||
| // evm.bytecode.ethdebug - Debug information in ethdebug format (ethdebug/format/program schema). Can only be requested when compiling via IR. (experimental) | ||
| // evm.deployedBytecode.ethdebug - Like evm.bytecode.ethdebug, but for the runtime part of the contract (experimental) | ||
| // evm.bytecode.ethdebug - Debug information in ethdebug format (ethdebug/format/program schema for creation bytecode). Can only be requested when compiling via IR. (experimental) | ||
| // evm.deployedBytecode.ethdebug - Debug information in ethdebug format (ethdebug/format/program schema for deployed bytecode). Can only be requested when compiling via IR. (experimental) | ||
| // evm.bytecode.functionDebugData - Debugging information at function level | ||
| // evm.bytecode.object - Bytecode object | ||
| // evm.bytecode.opcodes - Opcodes list | ||
|
|
@@ -467,6 +467,10 @@ Input Description | |
| // evm.gasEstimates - Function gas estimates | ||
| // yulCFGJson - Control Flow Graph (CFG) of the Single Static Assignment (SSA) form of the contract (experimental) | ||
| // | ||
| // Global level (needs "*" as file name and "*" as contract name): | ||
| // ethdebug.resources - Global ethdebug output (ethdebug/format/info/resources schema) containing source list and compiler info (experimental) | ||
| // ethdebug.compilation - Global ethdebug compilation output (the 'compilation' key from ethdebug/format/info/resources schema) (experimental) | ||
| // | ||
| // Note that using `evm`, `evm.bytecode`, etc. will select every | ||
| // target part of that output. Additionally, `*` can be used as a wildcard to request everything. | ||
| // | ||
|
|
@@ -696,7 +700,12 @@ Output Description | |
| } | ||
| }, | ||
| // Global Ethdebug output (experimental) | ||
| "ethdebug": {/* ... */ } | ||
| "ethdebug": { | ||
| // Requested via ethdebug.resources output selection | ||
| "resources": {/* ... */}, | ||
| // Requested via ethdebug.compilation output selection | ||
| "compilation": {/* ... */} | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
@@ -751,26 +760,26 @@ Note that the use of this mode is recorded in the metadata: | |
|
|
||
| The table below details all currently available experimental features. | ||
|
|
||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| | Feature | ID | Affects bytecode | Flag/pragma | | ||
| +=======================+==========================+==================+===================================================================+ | ||
| | AST import | ``ast-import`` | yes | ``--import-ast`` | | ||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| | LSP | ``lsp`` | no | ``--lsp`` | | ||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| | EVM Assembly import | ``evmasm-import`` | yes | ``--import-asm-json`` | | ||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| | Generic Solidity | ``generic-solidity`` | yes | ``pragma experimental solidity`` | | ||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| | IR AST | ``ir-ast`` | no | ``--ir-ast-json``, ``--ir-optimized-ast-json`` | | ||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| | EOF | ``eof`` | yes | ``--experimental-eof-version`` | | ||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| | Non-mainnet EVMs | ``evm`` | yes | ``--evm-version <version name>`` | | ||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| | Ethdebug | ``ethdebug`` | no | ``--ethdebug``, ``--ethdebug-runtime``, ``--debug-info ethdebug`` | | ||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| | | | no | ``--yul-cfg-json`` | | ||
| | SSA CFG + ``ssa-cfg`` +------------------+-------------------------------------------------------------------+ | ||
| | | | yes | ``--via-ssa-cfg`` | | ||
| +-----------------------+--------------------------+------------------+-------------------------------------------------------------------+ | ||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | Feature | ID | Affects bytecode | Flag/pragma | | ||
| +=======================+==========================+==================+=========================================================================================================================================+ | ||
| | AST import | ``ast-import`` | yes | ``--import-ast`` | | ||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | LSP | ``lsp`` | no | ``--lsp`` | | ||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | EVM Assembly import | ``evmasm-import`` | yes | ``--import-asm-json`` | | ||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | Generic Solidity | ``generic-solidity`` | yes | ``pragma experimental solidity`` | | ||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | IR AST | ``ir-ast`` | no | ``--ir-ast-json``, ``--ir-optimized-ast-json`` | | ||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | EOF | ``eof`` | yes | ``--experimental-eof-version`` | | ||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | Non-mainnet EVMs | ``evm`` | yes | ``--evm-version <version name>`` | | ||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | Ethdebug | ``ethdebug`` | no | ``--ethdebug-resources``, ``--ethdebug-compilation``, ``--ethdebug-program``, ``--ethdebug-program-runtime``, ``--debug-info ethdebug`` | | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the default now, actually? is that somehow reflected in the docs?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default in what way?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry I confused myself here. What I meant were the default settings for emitting debug info. Which, obviously, is to not emit anything unless debug info output is requested. So nothing to change or even discuss in that regard. Tangentially (and where my confusion came from): I've always found it a bit funny that the default behavior of IR output is to attach source location info. |
||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | | | no | ``--yul-cfg-json`` | | ||
| | SSA CFG + ``ssa-cfg`` +------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| | | | yes | ``--via-ssa-cfg`` | | ||
| +-----------------------+--------------------------+------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -792,6 +792,7 @@ bool CompilerStack::compile(State _stopAfter) | |
|
|
||
| // Only compile contracts individually which have been requested. | ||
| std::map<ContractDefinition const*, std::shared_ptr<Compiler const>> otherCompilers; | ||
| bool requiresFullCompilation = false; | ||
|
|
||
| for (Source const* source: m_sourceOrder) | ||
| for (ASTPointer<ASTNode> const& node: source->ast->nodes()) | ||
|
|
@@ -802,6 +803,11 @@ bool CompilerStack::compile(State _stopAfter) | |
|
|
||
| try | ||
| { | ||
| // Skip if full compilation is not needed (i.e. no IR/bytecode requested) | ||
| if (!pipelineConfig.needsFullCompilation()) | ||
| continue; | ||
| requiresFullCompilation = true; | ||
|
|
||
| if (pipelineConfig.needIR(m_viaIR)) | ||
| generateIR(*contract, pipelineConfig.needIRCodegenOnly(m_viaIR)); | ||
| if (pipelineConfig.needBytecode()) | ||
|
|
@@ -831,7 +837,8 @@ bool CompilerStack::compile(State _stopAfter) | |
|
|
||
| solAssert(!m_errorReporter.hasErrors()); | ||
| m_stackState = CompilationSuccessful; | ||
| this->link(); | ||
| if (requiresFullCompilation) | ||
| this->link(); | ||
|
Comment on lines
+840
to
+841
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how is this (as well as the perf optimization above) related to ethdebug? isn't this orthogonal?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I guess you could say so, although it was a requirement in the issue. E.g. requiresting |
||
| return true; | ||
| } | ||
|
|
||
|
|
@@ -1227,10 +1234,14 @@ Json CompilerStack::interfaceSymbols(std::string const& _contractName) const | |
| Json CompilerStack::ethdebug() const | ||
| { | ||
| solAssert(m_stackState >= AnalysisSuccessful, "Analysis was not successful."); | ||
| solAssert(!m_contracts.empty()); | ||
| return evmasm::ethdebug::resources(sourceNames(), VersionString); | ||
| } | ||
|
|
||
| Json CompilerStack::ethdebugCompilation() const | ||
| { | ||
| return evmasm::ethdebug::compilation(VersionString); | ||
| } | ||
|
|
||
| Json CompilerStack::ethdebug(std::string const& _contractName) const | ||
| { | ||
| return ethdebug(contract(_contractName), /* runtime */ false); | ||
|
|
||
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.
not sure why it needs "*" for file and contract name, can this be solved differently? wouldn't it be better as flat top-level key if it's actually global?