Hex/decimal cleanup for assembly output.

This commit is contained in:
chriseth 2015-05-15 15:36:14 +02:00
parent b124878c53
commit e50070035f

View File

@ -121,13 +121,13 @@ ostream& Assembly::streamAsm(ostream& _out, string const& _prefix, StringMap con
_out << " " << instructionInfo(i.instruction()).name << "\t" << i.getJumpTypeAsString(); _out << " " << instructionInfo(i.instruction()).name << "\t" << i.getJumpTypeAsString();
break; break;
case Push: case Push:
_out << " PUSH " << i.data(); _out << " PUSH " << hex << i.data();
break; break;
case PushString: case PushString:
_out << " PUSH \"" << m_strings.at((h256)i.data()) << "\""; _out << " PUSH \"" << m_strings.at((h256)i.data()) << "\"";
break; break;
case PushTag: case PushTag:
_out << " PUSH [tag" << i.data() << "]"; _out << " PUSH [tag" << dec << i.data() << "]";
break; break;
case PushSub: case PushSub:
_out << " PUSH [$" << h256(i.data()).abridged() << "]"; _out << " PUSH [$" << h256(i.data()).abridged() << "]";
@ -139,7 +139,7 @@ ostream& Assembly::streamAsm(ostream& _out, string const& _prefix, StringMap con
_out << " PUSHSIZE"; _out << " PUSHSIZE";
break; break;
case Tag: case Tag:
_out << "tag" << i.data() << ": " << endl << _prefix << " JUMPDEST"; _out << "tag" << dec << i.data() << ": " << endl << _prefix << " JUMPDEST";
break; break;
case PushData: case PushData:
_out << " PUSH [" << hex << (unsigned)i.data() << "]"; _out << " PUSH [" << hex << (unsigned)i.data() << "]";
@ -208,7 +208,7 @@ Json::Value Assembly::streamAsmJson(ostream& _out, StringMap const& _sourceCodes
break; break;
case PushTag: case PushTag:
collection.append( collection.append(
createJsonValue("PUSH [tag]", i.getLocation().start, i.getLocation().end, toStringInHex(i.data()))); createJsonValue("PUSH [tag]", i.getLocation().start, i.getLocation().end, string(i.data())));
break; break;
case PushSub: case PushSub:
collection.append( collection.append(
@ -223,19 +223,13 @@ Json::Value Assembly::streamAsmJson(ostream& _out, StringMap const& _sourceCodes
createJsonValue("PUSHSIZE", i.getLocation().start, i.getLocation().end)); createJsonValue("PUSHSIZE", i.getLocation().start, i.getLocation().end));
break; break;
case Tag: case Tag:
{
collection.append( collection.append(
createJsonValue("tag", i.getLocation().start, i.getLocation().end, string(i.data()))); createJsonValue("tag", i.getLocation().start, i.getLocation().end, string(i.data())));
collection.append( collection.append(
createJsonValue("JUMDEST", i.getLocation().start, i.getLocation().end)); createJsonValue("JUMDEST", i.getLocation().start, i.getLocation().end));
}
break; break;
case PushData: case PushData:
{ collection.append(createJsonValue("PUSH data", i.getLocation().start, i.getLocation().end, toStringInHex(i.data())));
Json::Value pushData;
pushData["name"] = "PUSH hex";
collection.append(createJsonValue("PUSH hex", i.getLocation().start, i.getLocation().end, toStringInHex(i.data())));
}
break; break;
default: default:
BOOST_THROW_EXCEPTION(InvalidOpcode()); BOOST_THROW_EXCEPTION(InvalidOpcode());