diff options
author | chriseth <chris@ethereum.org> | 2017-06-14 20:28:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-14 20:28:06 +0800 |
commit | e232a105f036e40c9da5c3ce051c5ebd4236b558 (patch) | |
tree | 4a9ffe35f31a77c94c0181d2aa9db895ce69d204 /solc | |
parent | 6441baae6b742a41b174f4a177c611689b4613ed (diff) | |
parent | 762bec9116d74a1022e4d06bd7112e4758a64b10 (diff) | |
download | dexon-solidity-e232a105f036e40c9da5c3ce051c5ebd4236b558.tar.gz dexon-solidity-e232a105f036e40c9da5c3ce051c5ebd4236b558.tar.zst dexon-solidity-e232a105f036e40c9da5c3ce051c5ebd4236b558.zip |
Merge pull request #2327 from ethereum/assembler-object
Return assembler object in AssemblyStack
Diffstat (limited to 'solc')
-rw-r--r-- | solc/CommandLineInterface.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index cae05b18..58c8bf73 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -1103,9 +1103,14 @@ bool CommandLineInterface::assemble( "eWasm"; cout << endl << "======= " << src.first << " (" << machine << ") =======" << endl; AssemblyStack& stack = assemblyStacks[src.first]; + + cout << endl << "Pretty printed source:" << endl; + cout << stack.print() << endl; + + MachineAssemblyObject object; try { - cout << stack.assemble(_targetMachine).toHex() << endl; + object = stack.assemble(_targetMachine); } catch (Exception const& _exception) { @@ -1117,7 +1122,18 @@ bool CommandLineInterface::assemble( cerr << "Unknown exception while assembling." << endl; return false; } - cout << stack.print() << endl; + + cout << endl << "Binary representation:" << endl; + if (object.bytecode) + cout << object.bytecode->toHex() << endl; + else + cerr << "No binary representation found." << endl; + + cout << endl << "Text representation:" << endl; + if (!object.assembly.empty()) + cout << object.assembly << endl; + else + cerr << "No text representation found." << endl; } return true; |