string eth::disassemble(bytes const& _mem) { stringstream ret; uint numerics = 0; for (auto it = _mem.begin(); it != _mem.end(); ++it) { byte n = *it; auto iit = c_instructionInfo.find((Instruction)n); if (numerics || iit == c_instructionInfo.end() || (byte)iit->first != n) // not an instruction or expecting an argument... { if (numerics) numerics--; ret << "0x" << hex << (int)n << " "; } else { auto const& ii = iit->second; ret << ii.name << " "; numerics = ii.additional; } } return ret.str(); }
bytes(const bytes& o) { std::copy(o.begin(), o.end(), data); }