Browse Source

Merge pull request #1046 from yann300/debug_pane

bug fix: storage view in debug pane broken for long values.
cl-refactor
Gav Wood 10 years ago
parent
commit
4808053df0
  1. 13
      libethcore/CommonJS.cpp
  2. 2
      libethcore/CommonJS.h
  3. 4
      mix/qml/Debugger.qml

13
libethcore/CommonJS.cpp

@ -97,7 +97,7 @@ std::string fromRaw(h256 _n, unsigned* _inc)
return ""; return "";
} }
std::string prettyU256(u256 _n) std::string prettyU256(u256 _n, bool _abridged)
{ {
unsigned inc = 0; unsigned inc = 0;
std::string raw; std::string raw;
@ -110,11 +110,16 @@ std::string prettyU256(u256 _n)
{ {
Address a = right160(_n); Address a = right160(_n);
std::string n = a.abridged(); std::string n;
if (_abridged)
n = a.abridged();
else
n = toHex(a.ref());
if (n.empty()) if (n.empty())
s << "0x" << a; s << "0";
else else
s << n << "(0x" << a.abridged() << ")"; s << _n << "(0x" << n << ")";
} }
else if ((raw = fromRaw((h256)_n, &inc)).size()) else if ((raw = fromRaw((h256)_n, &inc)).size())
return "\"" + raw + "\"" + (inc ? " + " + std::to_string(inc) : ""); return "\"" + raw + "\"" + (inc ? " + " + std::to_string(inc) : "");

2
libethcore/CommonJS.h

@ -59,7 +59,7 @@ bytes unpadded(bytes _s);
/// Remove all 0 byte on the head of @a _s. /// Remove all 0 byte on the head of @a _s.
bytes unpadLeft(bytes _s); bytes unpadLeft(bytes _s);
/// Convert u256 into user-readable string. Returns int/hex value of 64 bits int, hex of 160 bits FixedHash. As a fallback try to handle input as h256. /// Convert u256 into user-readable string. Returns int/hex value of 64 bits int, hex of 160 bits FixedHash. As a fallback try to handle input as h256.
std::string prettyU256(u256 _n); std::string prettyU256(u256 _n, bool _abridged = true);
/// Convert h256 into user-readable string (by directly using std::string constructor). /// Convert h256 into user-readable string (by directly using std::string constructor).
std::string fromRaw(h256 _n, unsigned* _inc = nullptr); std::string fromRaw(h256 _n, unsigned* _inc = nullptr);
/// Convert string to Address (h160), returns empty address if (_a.size != 40). /// Convert string to Address (h160), returns empty address if (_a.size != 40).

4
mix/qml/Debugger.qml

@ -598,9 +598,11 @@ Rectangle {
Layout.minimumWidth: parent.width / 2 Layout.minimumWidth: parent.width / 2
Layout.maximumWidth: parent.width / 2 Layout.maximumWidth: parent.width / 2
Text { Text {
maximumLineCount: 1
clip: true
anchors.leftMargin: 5 anchors.leftMargin: 5
width: parent.width - 5 width: parent.width - 5
wrapMode: Text.NoWrap wrapMode: Text.WrapAnywhere
anchors.left: parent.left anchors.left: parent.left
font.family: "monospace" font.family: "monospace"
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter

Loading…
Cancel
Save