diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index e7a4a1415..dca675f79 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -977,9 +977,12 @@ void Main::initDebugger() dc->clear(); if (m_currentExecution) { + for (unsigned i = 0; i < m_currentExecution->ext().code.size(); ++i) + cnote << i << std::hex << (int)m_currentExecution->ext().code[i]; for (unsigned i = 0; i <= m_currentExecution->ext().code.size(); ++i) { byte b = i < m_currentExecution->ext().code.size() ? m_currentExecution->ext().code[i] : 0; + cnote << i << std::hex << (int)b; QString s = c_instructionInfo.at((Instruction)b).name; m_pcWarp[i] = dc->count(); ostringstream out; diff --git a/libethereum/AddressState.h b/libethereum/AddressState.h index 4efee6751..560401e46 100644 --- a/libethereum/AddressState.h +++ b/libethereum/AddressState.h @@ -52,6 +52,7 @@ public: bool isFreshCode() const { return !m_codeHash; } h256 codeHash() const { assert(m_codeHash); return m_codeHash; } + bool haveCode() const { return m_codeHash == EmptySHA3 || !m_codeHash || m_codeCache.size(); } bytes const& code() const { assert(m_codeHash == EmptySHA3 || !m_codeHash || m_codeCache.size()); return m_codeCache; } void setCode(bytesConstRef _code) { assert(!m_codeHash); m_codeCache = _code.toBytes(); } void noteCode(bytesConstRef _code) { assert(sha3(_code) == m_codeHash); m_codeCache = _code.toBytes(); } diff --git a/libethereum/Executive.cpp b/libethereum/Executive.cpp index 3e146c1d2..1e6a873f6 100644 --- a/libethereum/Executive.cpp +++ b/libethereum/Executive.cpp @@ -99,7 +99,8 @@ void Executive::call(Address _receiveAddress, Address _senderAddress, u256 _valu if (m_s.addressHasCode(_receiveAddress)) { m_vm = new VM(_gas); - m_ext = new ExtVM(m_s, _receiveAddress, _senderAddress, _originAddress, _value, _gasPrice, _data, &m_s.code(_receiveAddress)); + bytes const& c = m_s.code(_receiveAddress); + m_ext = new ExtVM(m_s, _receiveAddress, _senderAddress, _originAddress, _value, _gasPrice, _data, &c); } else m_endGas = _gas; diff --git a/libethereum/State.cpp b/libethereum/State.cpp index 124e02745..490825875 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -141,7 +141,7 @@ void State::ensureCached(std::map& _cache, Address _a, bo bool ok; tie(it, ok) = _cache.insert(make_pair(_a, s)); } - if (_requireCode && it != _cache.end() && !it->second.isFreshCode()) + if (_requireCode && it != _cache.end() && !it->second.isFreshCode() && !it->second.haveCode()) it->second.noteCode(it->second.codeHash() == EmptySHA3 ? bytesConstRef() : bytesConstRef(m_db.lookup(it->second.codeHash()))); } diff --git a/libethereum/Transaction.h b/libethereum/Transaction.h index fe37f2ee8..d9c092bfd 100644 --- a/libethereum/Transaction.h +++ b/libethereum/Transaction.h @@ -88,7 +88,7 @@ inline std::ostream& operator<<(std::ostream& _out, Transaction const& _t) _out << "<-" << _t.sender().abridged(); } catch (...) {} - _out << "}"; + _out << " #" << _t.data.size() << "}"; return _out; }