Expose --debug-info/settings.debug.debugInfo option

This commit is contained in:
Kamil Śliwak 2021-09-13 14:17:05 +02:00
parent bcfefc79d9
commit a9e794c872
73 changed files with 1913 additions and 5 deletions

View File

@ -6,8 +6,10 @@ Language Features:
Compiler Features:
* Commandline Interface: Accept nested brackets in step sequences passed to ``--yul-optimizations``.
* Commandline Interface: Add ``--debug-info`` option for selecting how much extra debug information should be included in the produced EVM assembly and Yul code.
* SMTChecker: Output values for ``block.*``, ``msg.*`` and ``tx.*`` variables that are present in the called functions.
* Standard JSON: Accept nested brackets in step sequences passed to ``settings.optimizer.details.yulDetails.optimizerSteps``.
* Standard JSON: Add ``settings.debug.debugInfo`` option for selecting how much extra debug information should be included in the produced EVM assembly and Yul code.
Bugfixes:

View File

@ -308,7 +308,18 @@ Input Description
// "strip" removes all revert strings (if possible, i.e. if literals are used) keeping side-effects
// "debug" injects strings for compiler-generated internal reverts, implemented for ABI encoders V1 and V2 for now.
// "verboseDebug" even appends further information to user-supplied revert strings (not yet implemented)
"revertStrings": "default"
"revertStrings": "default",
// Optional: How much extra debug information to include in comments in the produced EVM
// assembly and Yul code. Available components are:
// - `location`: Annotations of the form `@src <index>:<start>:<end>` indicating the
// location of the corresponding element in the original Solidity file, where:
// - `<index>` is the file index matching the `@use-src` annotation,
// - `<start>` is the index of the first byte at that location,
// - `<end>` is the index of the first byte after that location.
// - `snippet`: A single-line code snippet from the location indicated by `@src`.
// The snippet is quoted and follows the corresponding `@src` annotation.
// - `*`: Wildcard value that can be used to request everything.
"debugInfo": ["location", "snippet"]
},
// Metadata settings (optional)
"metadata": {

View File

@ -33,7 +33,6 @@
#include <libsmtutil/Exceptions.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/SourceReferenceFormatter.h>
#include <libsolutil/JSON.h>
@ -798,7 +797,7 @@ std::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompiler:
if (settings.isMember("debug"))
{
if (auto result = checkKeys(settings["debug"], {"revertStrings"}, "settings.debug"))
if (auto result = checkKeys(settings["debug"], {"revertStrings", "debugInfo"}, "settings.debug"))
return *result;
if (settings["debug"].isMember("revertStrings"))
@ -815,6 +814,31 @@ std::variant<StandardCompiler::InputsAndSettings, Json::Value> StandardCompiler:
);
ret.revertStrings = *revertStrings;
}
if (settings["debug"].isMember("debugInfo"))
{
if (!settings["debug"]["debugInfo"].isArray())
return formatFatalError("JSONError", "settings.debug.debugInfo must be an array.");
vector<string> components;
for (Json::Value const& arrayValue: settings["debug"]["debugInfo"])
components.push_back(arrayValue.asString());
optional<DebugInfoSelection> debugInfoSelection = DebugInfoSelection::fromComponents(
components,
true /* _acceptWildcards */
);
if (!debugInfoSelection.has_value())
return formatFatalError("JSONError", "Invalid value in settings.debug.debugInfo.");
if (debugInfoSelection->snippet && !debugInfoSelection->location)
return formatFatalError(
"JSONError",
"To use 'snippet' with settings.debug.debugInfo you must select also 'location'."
);
ret.debugInfoSelection = debugInfoSelection.value();
}
}
if (settings.isMember("remappings") && !settings["remappings"].isArray())
@ -1034,6 +1058,8 @@ Json::Value StandardCompiler::compileSolidity(StandardCompiler::InputsAndSetting
compilerStack.setRemappings(move(_inputsAndSettings.remappings));
compilerStack.setOptimiserSettings(std::move(_inputsAndSettings.optimiserSettings));
compilerStack.setRevertStringBehaviour(_inputsAndSettings.revertStrings);
if (_inputsAndSettings.debugInfoSelection.has_value())
compilerStack.selectDebugInfo(_inputsAndSettings.debugInfoSelection.value());
compilerStack.setLibraries(_inputsAndSettings.libraries);
compilerStack.useMetadataLiteralSources(_inputsAndSettings.metadataLiteralSources);
compilerStack.setMetadataHash(_inputsAndSettings.metadataHash);
@ -1364,7 +1390,9 @@ Json::Value StandardCompiler::compileYul(InputsAndSettings _inputsAndSettings)
_inputsAndSettings.evmVersion,
AssemblyStack::Language::StrictAssembly,
_inputsAndSettings.optimiserSettings,
DebugInfoSelection::Default()
_inputsAndSettings.debugInfoSelection.has_value() ?
_inputsAndSettings.debugInfoSelection.value() :
DebugInfoSelection::Default()
);
string const& sourceName = _inputsAndSettings.sources.begin()->first;
string const& sourceContents = _inputsAndSettings.sources.begin()->second;

View File

@ -26,6 +26,8 @@
#include <libsolidity/interface/CompilerStack.h>
#include <libsolutil/JSON.h>
#include <liblangutil/DebugInfoSelection.h>
#include <optional>
#include <utility>
#include <variant>
@ -78,6 +80,7 @@ private:
std::vector<ImportRemapper::Remapping> remappings;
RevertStrings revertStrings = RevertStrings::Default;
OptimiserSettings optimiserSettings = OptimiserSettings::minimal();
std::optional<langutil::DebugInfoSelection> debugInfoSelection;
std::map<std::string, util::h160> libraries;
bool metadataLiteralSources = false;
CompilerStack::MetadataHash metadataHash = CompilerStack::MetadataHash::IPFS;

View File

@ -631,6 +631,8 @@ bool CommandLineInterface::compile()
m_compiler->setViaIR(m_options.output.experimentalViaIR);
m_compiler->setEVMVersion(m_options.output.evmVersion);
m_compiler->setRevertStringBehaviour(m_options.output.revertStrings);
if (m_options.output.debugInfoSelection.has_value())
m_compiler->selectDebugInfo(m_options.output.debugInfoSelection.value());
// TODO: Perhaps we should not compile unless requested
m_compiler->enableIRGeneration(m_options.compiler.outputs.ir || m_options.compiler.outputs.irOptimized);
@ -973,7 +975,9 @@ bool CommandLineInterface::assemble(yul::AssemblyStack::Language _language, yul:
m_options.output.evmVersion,
_language,
m_options.optimiserSettings(),
DebugInfoSelection::Default()
m_options.output.debugInfoSelection.has_value() ?
m_options.output.debugInfoSelection.value() :
DebugInfoSelection::Default()
);
if (!stack.parseAndAnalyze(src.first, src.second))

View File

@ -67,6 +67,7 @@ static string const g_strImportAst = "import-ast";
static string const g_strInputFile = "input-file";
static string const g_strYul = "yul";
static string const g_strYulDialect = "yul-dialect";
static string const g_strDebugInfo = "debug-info";
static string const g_strIPFS = "ipfs";
static string const g_strLicense = "license";
static string const g_strLibraries = "libraries";
@ -252,6 +253,7 @@ bool CommandLineOptions::operator==(CommandLineOptions const& _other) const noex
output.evmVersion == _other.output.evmVersion &&
output.experimentalViaIR == _other.output.experimentalViaIR &&
output.revertStrings == _other.output.revertStrings &&
output.debugInfoSelection == _other.output.debugInfoSelection &&
output.stopAfter == _other.output.stopAfter &&
input.mode == _other.input.mode &&
assembly.targetMachine == _other.assembly.targetMachine &&
@ -595,6 +597,13 @@ General Information)").c_str(),
po::value<string>()->value_name(joinHumanReadable(g_revertStringsArgs, ",")),
"Strip revert (and require) reason strings or add additional debugging information."
)
(
g_strDebugInfo.c_str(),
po::value<string>()->default_value(toString(DebugInfoSelection::Default())),
("Debug info components to be included in the produced EVM assembly and Yul code. "
"Value can be all, none or a comma-separated list containing one or more of the "
"following components: " + joinHumanReadable(DebugInfoSelection::componentMap() | ranges::views::keys) + ".").c_str()
)
(
g_strStopAfter.c_str(),
po::value<string>()->value_name("stage"),
@ -935,6 +944,12 @@ bool CommandLineParser::processArgs()
serr() << "Option --" << option << " is only valid in compiler and assembler modes." << endl;
return false;
}
if (!m_args[g_strDebugInfo].defaulted())
{
serr() << "Option --" << g_strDebugInfo << " is only valid in compiler and assembler modes." << endl;
return false;
}
}
if (m_args.count(g_strColor) > 0)
@ -961,6 +976,23 @@ bool CommandLineParser::processArgs()
m_options.output.revertStrings = *revertStrings;
}
if (!m_args[g_strDebugInfo].defaulted())
{
string optionValue = m_args[g_strDebugInfo].as<string>();
m_options.output.debugInfoSelection = DebugInfoSelection::fromString(optionValue);
if (!m_options.output.debugInfoSelection.has_value())
{
serr() << "Invalid value for --" << g_strDebugInfo << " option: " << optionValue << endl;
return false;
}
if (m_options.output.debugInfoSelection->snippet && !m_options.output.debugInfoSelection->location)
{
serr() << "To use 'snippet' with --" << g_strDebugInfo << " you must select also 'location'." << endl;
return false;
}
}
if (!parseCombinedJsonOption())
return false;

View File

@ -24,8 +24,12 @@
#include <libsolidity/interface/DebugSettings.h>
#include <libsolidity/interface/FileReader.h>
#include <libsolidity/interface/ImportRemapper.h>
#include <libyul/AssemblyStack.h>
#include <liblangutil/DebugInfoSelection.h>
#include <liblangutil/EVMVersion.h>
#include <libsolutil/JSON.h>
#include <boost/program_options.hpp>
@ -174,6 +178,7 @@ struct CommandLineOptions
langutil::EVMVersion evmVersion;
bool experimentalViaIR = false;
RevertStrings revertStrings = RevertStrings::Default;
std::optional<langutil::DebugInfoSelection> debugInfoSelection;
CompilerStack::State stopAfter = CompilerStack::State::CompilationSuccessful;
} output;

View File

@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info all

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}

View File

@ -0,0 +1,213 @@
======= debug_info_in_yul_and_evm_asm_print_all/input.sol:C =======
EVM assembly:
/* "debug_info_in_yul_and_evm_asm_print_all/input.sol":60:101 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* "debug_info_in_yul_and_evm_asm_print_all/input.sol":60:101 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* "debug_info_in_yul_and_evm_asm_print_all/input.sol":77:99 function f() public {} */
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset("C_6_deployed"), datasize("C_6_deployed"))
return(_1, datasize("C_6_deployed"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
/// @src 0:60:101 "contract C {..."
function constructor_C_6() {
/// @src 0:60:101 "contract C {..."
}
/// @src 0:60:101 "contract C {..."
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
/// @ast-id 5
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6" {
code {
{
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("C_6_deployed")
codecopy(128, dataoffset("C_6_deployed"), _1)
return(128, _1)
}
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_all/input.sol"
object "C_6_deployed" {
code {
{
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}

View File

@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info location,all,none

View File

@ -0,0 +1 @@
Invalid value for --debug-info option: location,all,none

View File

@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info location

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}

View File

@ -0,0 +1,212 @@
======= debug_info_in_yul_and_evm_asm_print_location_only/input.sol:C =======
EVM assembly:
/* "debug_info_in_yul_and_evm_asm_print_location_only/input.sol":60:101 */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* "debug_info_in_yul_and_evm_asm_print_location_only/input.sol":60:101 */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* "debug_info_in_yul_and_evm_asm_print_location_only/input.sol":77:99 */
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6" {
code {
/// @src 0:60:101
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset("C_6_deployed"), datasize("C_6_deployed"))
return(_1, datasize("C_6_deployed"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
/// @src 0:60:101
function constructor_C_6() {
/// @src 0:60:101
}
/// @src 0:60:101
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
/// @src 0:77:99
function fun_f_5() {
}
/// @src 0:60:101
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6" {
code {
{
/// @src 0:60:101
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("C_6_deployed")
codecopy(128, dataoffset("C_6_deployed"), _1)
return(128, _1)
}
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_location_only/input.sol"
object "C_6_deployed" {
code {
{
/// @src 0:60:101
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}

View File

@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info none

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}

View File

@ -0,0 +1,201 @@
======= debug_info_in_yul_and_evm_asm_print_none/input.sol:C =======
EVM assembly:
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6" {
code {
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset("C_6_deployed"), datasize("C_6_deployed"))
return(_1, datasize("C_6_deployed"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function constructor_C_6() {
}
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6_deployed" {
code {
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function fun_f_5() {
}
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}
Optimized IR:
/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize("C_6_deployed")
codecopy(128, dataoffset("C_6_deployed"), _1)
return(128, _1)
}
}
/// @use-src 0:"debug_info_in_yul_and_evm_asm_print_none/input.sol"
object "C_6_deployed" {
code {
{
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data ".metadata" hex"<BYTECODE REMOVED>"
}
}

View File

@ -0,0 +1 @@
--ir --ir-optimized --asm --optimize --debug-info snippet

View File

@ -0,0 +1 @@
To use 'snippet' with --debug-info you must select also 'location'.

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}

View File

@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}

View File

@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"C": {"urls": ["standard_debug_info_in_yul_and_evm_asm_print_all/in.sol"]}
},
"settings": {
"debug": {"debugInfo": ["*"]},
"optimizer": {"enabled": true},
"outputSelection": {
"*": {"*": ["ir", "irOptimized", "evm.assembly"]}
}
}
}

View File

@ -0,0 +1,230 @@
{
"contracts":
{
"C":
{
"C":
{
"evm":
{
"assembly": " /* \"C\":60:101 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* \"C\":60:101 contract C {... */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* \"C\":77:99 function f() public {} */
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
"
},
"ir": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
/// @src 0:60:101 \"contract C {...\"
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\"))
return(_1, datasize(\"C_6_deployed\"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
/// @src 0:60:101 \"contract C {...\"
function constructor_C_6() {
/// @src 0:60:101 \"contract C {...\"
}
/// @src 0:60:101 \"contract C {...\"
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
/// @src 0:60:101 \"contract C {...\"
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
/// @ast-id 5
/// @src 0:77:99 \"function f() public {}\"
function fun_f_5() {
}
/// @src 0:60:101 \"contract C {...\"
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
",
"irOptimized": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
{
/// @src 0:60:101 \"contract C {...\"
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize(\"C_6_deployed\")
codecopy(128, dataoffset(\"C_6_deployed\"), _1)
return(128, _1)
}
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
{
/// @src 0:60:101 \"contract C {...\"
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
"
}
}
},
"sources":
{
"C":
{
"id": 0
}
}
}

View File

@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}

View File

@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"C": {"urls": ["standard_debug_info_in_yul_and_evm_asm_print_location_only/in.sol"]}
},
"settings": {
"debug": {"debugInfo": ["location"]},
"optimizer": {"enabled": true},
"outputSelection": {
"*": {"*": ["ir", "irOptimized", "evm.assembly"]}
}
}
}

View File

@ -0,0 +1,229 @@
{
"contracts":
{
"C":
{
"C":
{
"evm":
{
"assembly": " /* \"C\":60:101 */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
/* \"C\":60:101 */
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
/* \"C\":77:99 */
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
"
},
"ir": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
/// @src 0:60:101
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\"))
return(_1, datasize(\"C_6_deployed\"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
/// @src 0:60:101
function constructor_C_6() {
/// @src 0:60:101
}
/// @src 0:60:101
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
/// @src 0:60:101
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
/// @src 0:77:99
function fun_f_5() {
}
/// @src 0:60:101
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
",
"irOptimized": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
{
/// @src 0:60:101
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize(\"C_6_deployed\")
codecopy(128, dataoffset(\"C_6_deployed\"), _1)
return(128, _1)
}
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
{
/// @src 0:60:101
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
"
}
}
},
"sources":
{
"C":
{
"id": 0
}
}
}

View File

@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}

View File

@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"C": {"urls": ["standard_debug_info_in_yul_and_evm_asm_print_none/in.sol"]}
},
"settings": {
"debug": {"debugInfo": []},
"optimizer": {"enabled": true},
"outputSelection": {
"*": {"*": ["ir", "irOptimized", "evm.assembly"]}
}
}
}

View File

@ -0,0 +1,218 @@
{
"contracts":
{
"C":
{
"C":
{
"evm":
{
"assembly": " mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
dataSize(sub_0)
dup1
dataOffset(sub_0)
0x00
codecopy
0x00
return
stop
sub_0: assembly {
mstore(0x40, 0x80)
callvalue
dup1
iszero
tag_1
jumpi
0x00
dup1
revert
tag_1:
pop
jumpi(tag_2, lt(calldatasize, 0x04))
shr(0xe0, calldataload(0x00))
dup1
0x26121ff0
eq
tag_3
jumpi
tag_2:
0x00
dup1
revert
tag_3:
stop
auxdata: <AUXDATA REMOVED>
}
"
},
"ir": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
mstore(64, 128)
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
constructor_C_6()
let _1 := allocate_unbounded()
codecopy(_1, dataoffset(\"C_6_deployed\"), datasize(\"C_6_deployed\"))
return(_1, datasize(\"C_6_deployed\"))
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function constructor_C_6() {
}
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let selector := shift_right_224_unsigned(calldataload(0))
switch selector
case 0x26121ff0
{
// f()
if callvalue() { revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() }
abi_decode_tuple_(4, calldatasize())
fun_f_5()
let memPos := allocate_unbounded()
let memEnd := abi_encode_tuple__to__fromStack(memPos )
return(memPos, sub(memEnd, memPos))
}
default {}
}
if iszero(calldatasize()) { }
revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74()
function shift_right_224_unsigned(value) -> newValue {
newValue :=
shr(224, value)
}
function allocate_unbounded() -> memPtr {
memPtr := mload(64)
}
function revert_error_ca66f745a3ce8ff40e2ccaf1ad45db7774001b90d25810abd9040049be7bf4bb() {
revert(0, 0)
}
function revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() {
revert(0, 0)
}
function abi_decode_tuple_(headStart, dataEnd) {
if slt(sub(dataEnd, headStart), 0) { revert_error_dbdddcbe895c83990c08b3492a0e83918d802a52331272ac6fdb6a7c4aea3b1b() }
}
function abi_encode_tuple__to__fromStack(headStart ) -> tail {
tail := add(headStart, 0)
}
function revert_error_42b3090547df1d2001c96683413b8cf91c1b902ef5e3cb8d9f6f304cf7446f74() {
revert(0, 0)
}
function fun_f_5() {
}
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
",
"irOptimized": "/*=====================================================*
* WARNING *
* Solidity to Yul compilation is still EXPERIMENTAL *
* It can result in LOSS OF FUNDS or worse *
* !USE AT YOUR OWN RISK! *
*=====================================================*/
/// @use-src 0:\"C\"
object \"C_6\" {
code {
{
mstore(64, 128)
if callvalue() { revert(0, 0) }
let _1 := datasize(\"C_6_deployed\")
codecopy(128, dataoffset(\"C_6_deployed\"), _1)
return(128, _1)
}
}
/// @use-src 0:\"C\"
object \"C_6_deployed\" {
code {
{
mstore(64, 128)
if iszero(lt(calldatasize(), 4))
{
let _1 := 0
if eq(0x26121ff0, shr(224, calldataload(_1)))
{
if callvalue() { revert(_1, _1) }
if slt(add(calldatasize(), not(3)), _1) { revert(_1, _1) }
return(128, _1)
}
}
revert(0, 0)
}
}
data \".metadata\" hex\"<BYTECODE REMOVED>\"
}
}
"
}
}
},
"sources":
{
"C":
{
"id": 0
}
}
}

View File

@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .

View File

@ -0,0 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
pragma solidity >=0.0;
contract C {
function f() public {}
}

View File

@ -0,0 +1,13 @@
{
"language": "Solidity",
"sources": {
"C": {"urls": ["standard_debug_info_in_yul_and_evm_asm_print_snippet_only/in.sol"]}
},
"settings": {
"debug": {"debugInfo": ["snippet"]},
"optimizer": {"enabled": true},
"outputSelection": {
"*": {"*": ["ir", "irOptimized", "evm.assembly"]}
}
}
}

View File

@ -0,0 +1,12 @@
{
"errors":
[
{
"component": "general",
"formattedMessage": "To use 'snippet' with settings.debug.debugInfo you must select also 'location'.",
"message": "To use 'snippet' with settings.debug.debugInfo you must select also 'location'.",
"severity": "error",
"type": "JSONError"
}
]
}

View File

@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .

View File

@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}

View File

@ -0,0 +1,12 @@
{
"language": "Yul",
"sources": {
"C": {"urls": ["standard_yul_debug_info_print_all/in.yul"]}
},
"settings": {
"debug": {"debugInfo": ["*"]},
"outputSelection": {
"*": {"*": ["evm.assembly"]}
}
}
}

View File

@ -0,0 +1,36 @@
{
"contracts":
{
"C":
{
"C_6_deployed":
{
"evm":
{
"assembly": " /* \"input.sol\":60:101 */
mstore(0x40, 0x80)
tag_2
tag_1
jump\t// in
tag_2:
/* \"input.sol\":77:99 */
jump(tag_3)
tag_1:
jump\t// out
tag_3:
"
}
}
}
},
"errors":
[
{
"component": "general",
"formattedMessage": "Yul is still experimental. Please use the output with care.",
"message": "Yul is still experimental. Please use the output with care.",
"severity": "warning",
"type": "Warning"
}
]
}

View File

@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .

View File

@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}

View File

@ -0,0 +1,12 @@
{
"language": "Yul",
"sources": {
"C": {"urls": ["standard_yul_debug_info_print_location_only/in.yul"]}
},
"settings": {
"debug": {"debugInfo": ["location"]},
"outputSelection": {
"*": {"*": ["evm.assembly"]}
}
}
}

View File

@ -0,0 +1,36 @@
{
"contracts":
{
"C":
{
"C_6_deployed":
{
"evm":
{
"assembly": " /* \"input.sol\":60:101 */
mstore(0x40, 0x80)
tag_2
tag_1
jump\t// in
tag_2:
/* \"input.sol\":77:99 */
jump(tag_3)
tag_1:
jump\t// out
tag_3:
"
}
}
}
},
"errors":
[
{
"component": "general",
"formattedMessage": "Yul is still experimental. Please use the output with care.",
"message": "Yul is still experimental. Please use the output with care.",
"severity": "warning",
"type": "Warning"
}
]
}

View File

@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .

View File

@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}

View File

@ -0,0 +1,12 @@
{
"language": "Yul",
"sources": {
"C": {"urls": ["standard_yul_debug_info_print_none/in.yul"]}
},
"settings": {
"debug": {"debugInfo": []},
"outputSelection": {
"*": {"*": ["evm.assembly"]}
}
}
}

View File

@ -0,0 +1,34 @@
{
"contracts":
{
"C":
{
"C_6_deployed":
{
"evm":
{
"assembly": " mstore(0x40, 0x80)
tag_2
tag_1
jump\t// in
tag_2:
jump(tag_3)
tag_1:
jump\t// out
tag_3:
"
}
}
}
},
"errors":
[
{
"component": "general",
"formattedMessage": "Yul is still experimental. Please use the output with care.",
"message": "Yul is still experimental. Please use the output with care.",
"severity": "warning",
"type": "Warning"
}
]
}

View File

@ -0,0 +1 @@
--pretty-json --json-indent 4 --allow-paths .

View File

@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}

View File

@ -0,0 +1,12 @@
{
"language": "Yul",
"sources": {
"C": {"urls": ["standard_yul_debug_info_print_snippet_only/in.yul"]}
},
"settings": {
"debug": {"debugInfo": ["snippet"]},
"outputSelection": {
"*": {"*": ["evm.assembly"]}
}
}
}

View File

@ -0,0 +1,12 @@
{
"errors":
[
{
"component": "general",
"formattedMessage": "To use 'snippet' with settings.debug.debugInfo you must select also 'location'.",
"message": "To use 'snippet' with settings.debug.debugInfo you must select also 'location'.",
"severity": "error",
"type": "JSONError"
}
]
}

View File

@ -0,0 +1 @@
--strict-assembly --debug-info all

View File

@ -0,0 +1 @@
Warning: Yul is still experimental. Please use the output with care.

View File

@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}

View File

@ -0,0 +1,32 @@
======= strict_asm_debug_info_print_all/input.yul (EVM) =======
Pretty printed source:
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101
mstore(64, 128)
fun_f_5()
/// @src 0:77:99
function fun_f_5()
{ }
}
}
Binary representation:
6080604052600a600e565b6010565b565b
Text representation:
/* "input.sol":60:101 */
mstore(0x40, 0x80)
tag_2
tag_1
jump // in
tag_2:
/* "input.sol":77:99 */
jump(tag_3)
tag_1:
jump // out
tag_3:

View File

@ -0,0 +1 @@
--strict-assembly --debug-info location

View File

@ -0,0 +1 @@
Warning: Yul is still experimental. Please use the output with care.

View File

@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}

View File

@ -0,0 +1,32 @@
======= strict_asm_debug_info_print_location_only/input.yul (EVM) =======
Pretty printed source:
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101
mstore(64, 128)
fun_f_5()
/// @src 0:77:99
function fun_f_5()
{ }
}
}
Binary representation:
6080604052600a600e565b6010565b565b
Text representation:
/* "input.sol":60:101 */
mstore(0x40, 0x80)
tag_2
tag_1
jump // in
tag_2:
/* "input.sol":77:99 */
jump(tag_3)
tag_1:
jump // out
tag_3:

View File

@ -0,0 +1 @@
--strict-assembly --debug-info none

View File

@ -0,0 +1 @@
Warning: Yul is still experimental. Please use the output with care.

View File

@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}

View File

@ -0,0 +1,28 @@
======= strict_asm_debug_info_print_none/input.yul (EVM) =======
Pretty printed source:
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
mstore(64, 128)
fun_f_5()
function fun_f_5()
{ }
}
}
Binary representation:
6080604052600a600e565b6010565b565b
Text representation:
mstore(0x40, 0x80)
tag_2
tag_1
jump // in
tag_2:
jump(tag_3)
tag_1:
jump // out
tag_3:

View File

@ -0,0 +1 @@
--strict-assembly --debug-info snippet

View File

@ -0,0 +1 @@
To use 'snippet' with --debug-info you must select also 'location'.

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1,15 @@
/// @use-src 0:"input.sol"
object "C_6_deployed" {
code {
/// @src 0:60:101 "contract C {..."
mstore(64, 128)
// f()
fun_f_5()
/// @src 0:77:99 "function f() public {}"
function fun_f_5() {
}
/// @src 0:60:101 "contract C {..."
}
}

View File

@ -127,6 +127,7 @@ BOOST_AUTO_TEST_CASE(cli_mode_options)
"--evm-version=spuriousDragon",
"--experimental-via-ir",
"--revert-strings=strip",
"--debug-info=location",
"--pretty-json",
"--json-indent=7",
"--no-color",
@ -180,6 +181,7 @@ BOOST_AUTO_TEST_CASE(cli_mode_options)
expectedOptions.output.evmVersion = EVMVersion::spuriousDragon();
expectedOptions.output.experimentalViaIR = true;
expectedOptions.output.revertStrings = RevertStrings::Strip;
expectedOptions.output.debugInfoSelection = DebugInfoSelection::fromString("location");
expectedOptions.formatting.json = JsonFormat{JsonFormat::Pretty, 7};
expectedOptions.linker.libraries = {
{"dir1/file1.sol:L", h160("1234567890123456789012345678901234567890")},
@ -269,6 +271,7 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options)
"--overwrite",
"--evm-version=spuriousDragon",
"--revert-strings=strip", // Accepted but has no effect in assembly mode
"--debug-info=location",
"--pretty-json",
"--json-indent=1",
"--no-color",
@ -315,6 +318,7 @@ BOOST_AUTO_TEST_CASE(assembly_mode_options)
expectedOptions.output.overwriteFiles = true;
expectedOptions.output.evmVersion = EVMVersion::spuriousDragon();
expectedOptions.output.revertStrings = RevertStrings::Strip;
expectedOptions.output.debugInfoSelection = DebugInfoSelection::fromString("location");
expectedOptions.formatting.json = JsonFormat {JsonFormat::Pretty, 1};
expectedOptions.assembly.targetMachine = expectedMachine;
expectedOptions.assembly.inputLanguage = expectedLanguage;