Browse Source

Fix for storage display in debugger.

cl-refactor
Gav Wood 11 years ago
parent
commit
1bc06c4db1
  1. 15
      alethzero/MainWin.cpp
  2. 1
      alethzero/MainWin.h
  3. 2
      libethereum/State.cpp

15
alethzero/MainWin.cpp

@ -1390,15 +1390,22 @@ void Main::on_debugTimeline_valueChanged()
updateDebugger(); updateDebugger();
} }
QString prettyU256(eth::u256 _n) QString Main::prettyU256(eth::u256 _n) const
{ {
ostringstream s; ostringstream s;
if (_n >> 32 == 0) if (_n >> 32 == 0)
s << hex << "0x" << (unsigned)_n; s << hex << "0x" << (unsigned)_n;
else if (_n >> 200 == 0) else if (_n >> 200 == 0)
s << "0x" << (h160)right160(_n); {
Address a = right160(_n);
QString n = pretty(a);
if (n.isNull())
s << "0x" << a;
else
s << "<b>" << n.toHtmlEscaped().toStdString() << "</b> (" << a.abridged() << ")";
}
else if (fromRaw((h256)_n).size()) else if (fromRaw((h256)_n).size())
s << "\"" << fromRaw((h256)_n).toStdString() << "\""; return "\"" + fromRaw((h256)_n).toHtmlEscaped() + "\"";
else else
s << "0x" << (h256)_n; s << "0x" << (h256)_n;
return QString::fromStdString(s.str()); return QString::fromStdString(s.str());
@ -1458,7 +1465,7 @@ void Main::updateDebugger()
ostringstream out; ostringstream out;
out << s.cur.abridged(); out << s.cur.abridged();
if (i) if (i)
out << " @0x" << hex << s.curPC; out << " " << c_instructionInfo.at(s.inst).name << " @0x" << hex << s.curPC;
ui->callStack->addItem(QString::fromStdString(out.str())); ui->callStack->addItem(QString::fromStdString(out.str()));
} }
} }

1
alethzero/MainWin.h

@ -140,6 +140,7 @@ private:
void updateBlockCount(); void updateBlockCount();
QString pretty(eth::Address _a) const; QString pretty(eth::Address _a) const;
QString prettyU256(eth::u256 _n) const;
void populateDebugger(eth::bytesConstRef r); void populateDebugger(eth::bytesConstRef r);
void initDebugger(); void initDebugger();

2
libethereum/State.cpp

@ -891,7 +891,7 @@ map<u256, u256> State::storage(Address _id) const
// Then merge cached storage over the top. // Then merge cached storage over the top.
for (auto const& i: it->second.storage()) for (auto const& i: it->second.storage())
if (i.second) if (i.second)
ret.insert(i); ret[i.first] = i.second;
else else
ret.erase(i.first); ret.erase(i.first);
} }

Loading…
Cancel
Save