Skip to content

Commit 40b5177

Browse files
committed
Reset instruction counter upon reset
This ensures the debugger never reports executing more instructions than it actually did when resetting.
1 parent df75a3b commit 40b5177

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/Debug/debugger.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,10 +1610,11 @@ bool Debugger::handleUpdateStackValue(const Module *m, uint8_t *bytes) const {
16101610
return true;
16111611
}
16121612

1613-
bool Debugger::reset(Module *m) const {
1613+
bool Debugger::reset(Module *m) {
16141614
auto *wasm =
16151615
static_cast<uint8_t *>(malloc(sizeof(uint8_t) * m->byte_count));
16161616
memcpy(wasm, m->bytes, m->byte_count);
1617+
instructions_executed = 0;
16171618
m->warduino->update_module(m, wasm, m->byte_count);
16181619
this->channel->write("Reset WARDuino.\n");
16191620
return true;

src/Debug/debugger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class Debugger {
201201

202202
bool handleUpdateStackValue(const Module *m, uint8_t *bytes) const;
203203

204-
bool reset(Module *m) const;
204+
bool reset(Module *m);
205205

206206
//// Handle out-of-place debugging
207207

0 commit comments

Comments
 (0)