aboutsummaryrefslogtreecommitdiffstats
path: root/solc
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-06-14 20:28:06 +0800
committerGitHub <noreply@github.com>2017-06-14 20:28:06 +0800
commite232a105f036e40c9da5c3ce051c5ebd4236b558 (patch)
tree4a9ffe35f31a77c94c0181d2aa9db895ce69d204 /solc
parent6441baae6b742a41b174f4a177c611689b4613ed (diff)
parent762bec9116d74a1022e4d06bd7112e4758a64b10 (diff)
downloaddexon-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.cpp20
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;