|
@ -25,13 +25,10 @@ |
|
|
#include <libevmcore/CommonSubexpressionEliminator.h> |
|
|
#include <libevmcore/CommonSubexpressionEliminator.h> |
|
|
#include <libevmcore/ControlFlowGraph.h> |
|
|
#include <libevmcore/ControlFlowGraph.h> |
|
|
#include <json/json.h> |
|
|
#include <json/json.h> |
|
|
|
|
|
|
|
|
using namespace std; |
|
|
using namespace std; |
|
|
using namespace dev; |
|
|
using namespace dev; |
|
|
using namespace dev::eth; |
|
|
using namespace dev::eth; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Assembly::append(Assembly const& _a) |
|
|
void Assembly::append(Assembly const& _a) |
|
|
{ |
|
|
{ |
|
|
auto newDeposit = m_deposit + _a.deposit(); |
|
|
auto newDeposit = m_deposit + _a.deposit(); |
|
@ -170,7 +167,6 @@ ostream& Assembly::streamAsm(ostream& _out, string const& _prefix, StringMap con |
|
|
Json::Value Assembly::createJsonValue(string _name, int _locationX, int _locationY, string _value, string _jumpType) const |
|
|
Json::Value Assembly::createJsonValue(string _name, int _locationX, int _locationY, string _value, string _jumpType) const |
|
|
{ |
|
|
{ |
|
|
Json::Value value; |
|
|
Json::Value value; |
|
|
assert(!_name.empty()); |
|
|
|
|
|
value["name"] = _name; |
|
|
value["name"] = _name; |
|
|
value["locationX"] = _locationX; |
|
|
value["locationX"] = _locationX; |
|
|
value["locationY"] = _locationY; |
|
|
value["locationY"] = _locationY; |
|
@ -196,8 +192,12 @@ Json::Value Assembly::streamAsmJson(ostream& _out, string const& _prefix, String |
|
|
createJsonValue(instructionInfo(i.instruction()).name, i.getLocation().start, i.getLocation().end, i.getJumpTypeAsString())); |
|
|
createJsonValue(instructionInfo(i.instruction()).name, i.getLocation().start, i.getLocation().end, i.getJumpTypeAsString())); |
|
|
break; |
|
|
break; |
|
|
case Push: |
|
|
case Push: |
|
|
|
|
|
{ |
|
|
|
|
|
std::stringstream hexStr; |
|
|
|
|
|
hexStr << hex << (unsigned)i.data(); |
|
|
currentCollection.push_back( |
|
|
currentCollection.push_back( |
|
|
createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, string(i.data()), i.getJumpTypeAsString())); |
|
|
createJsonValue(string("PUSH"), i.getLocation().start, i.getLocation().end, hexStr.str(), i.getJumpTypeAsString())); |
|
|
|
|
|
} |
|
|
break; |
|
|
break; |
|
|
case PushString: |
|
|
case PushString: |
|
|
currentCollection.push_back( |
|
|
currentCollection.push_back( |
|
|