Browse Source

Fixes for state debugging.

cl-refactor
Gav Wood 11 years ago
parent
commit
5f62e249b0
  1. 2
      README.md
  2. 9
      alethzero/MainWin.cpp
  3. 1
      alethzero/MainWin.h

2
README.md

@ -12,7 +12,7 @@ See the [Wiki](https://github.com/ethereum/cpp-ethereum/wiki) for build instruct
### Testing
To run the tests, make sure you clone the tests repository from github.com/ethereum to tests is a sibling to cpp-ethereum-build.
To run the tests, make sure you clone the tests repository from github.com/ethereum to tests as a sibling to cpp-ethereum.
### Yet To Do

9
alethzero/MainWin.cpp

@ -876,13 +876,13 @@ void Main::on_blocks_currentItemChanged()
Transaction t = st.pending()[txi];
auto r = t.rlp();
m_pcWarp.clear();
m_history.clear();
debugFinished();
bool done = m_currentExecution->setup(&r);
if (!done)
{
auto startGas = m_currentExecution->vm().gas();
for (; !done; done = m_currentExecution->go(1))
m_history.append(WorldState({m_currentExecution->vm().curPC(), m_currentExecution->vm().gas(), m_currentExecution->vm().stack(), m_currentExecution->vm().memory(), m_currentExecution->state().storage(m_currentExecution->ext().myAddress)}));
m_history.append(WorldState({m_currentExecution->vm().curPC(), m_currentExecution->vm().gas(), startGas - m_currentExecution->vm().gas(), m_currentExecution->vm().stack(), m_currentExecution->vm().memory(), m_currentExecution->state().storage(m_currentExecution->ext().myAddress)}));
initDebugger();
updateDebugger();
}
@ -1221,9 +1221,10 @@ void Main::on_debug_clicked()
m_pcWarp.clear();
m_history.clear();
bool ok = true;
auto gasBegin = m_currentExecution->vm().gas();
while (ok)
{
m_history.append(WorldState({m_currentExecution->vm().curPC(), m_currentExecution->vm().gas(), m_currentExecution->vm().stack(), m_currentExecution->vm().memory(), m_currentExecution->state().storage(m_currentExecution->ext().myAddress)}));
m_history.append(WorldState({m_currentExecution->vm().curPC(), m_currentExecution->vm().gas(), gasBegin - m_currentExecution->vm().gas(), m_currentExecution->vm().stack(), m_currentExecution->vm().memory(), m_currentExecution->state().storage(m_currentExecution->ext().myAddress)}));
ok = !m_currentExecution->go(1);
}
initDebugger();

1
alethzero/MainWin.h

@ -46,6 +46,7 @@ struct WorldState
{
eth::u256 curPC;
eth::u256 gas;
eth::u256 gasUsed;
eth::u256s stack;
eth::bytes memory;
std::map<eth::u256, eth::u256> storage;

Loading…
Cancel
Save