Skip to content

Commit d45ce80

Browse files
MaartenS11tolauwae
andauthored
Fix stepOver using hardcoded immediate sizes (#304)
Co-authored-by: Tom Lauwaerts <[email protected]>
1 parent a72a245 commit d45ce80

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Debug/debugger.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,16 @@ void Debugger::handleSTEPOver(const Module *m, RunningState *program_state) {
458458
this->skipBreakpoint = m->pc_ptr;
459459
uint8_t const opcode = *m->pc_ptr;
460460
if (opcode == 0x10) { // step over direct call
461-
this->mark = m->pc_ptr + 2;
461+
uint8_t *ptr_cpy = m->pc_ptr + 1;
462+
read_LEB_32(&ptr_cpy);
463+
this->mark = m->pc_ptr + (ptr_cpy - m->pc_ptr);
462464
*program_state = WARDUINOrun;
463465
// warning: ack will be BP hit
464466
} else if (opcode == 0x11) { // step over indirect call
465-
this->mark = m->pc_ptr + 3;
467+
uint8_t *ptr_cpy = m->pc_ptr + 1;
468+
read_LEB_32(&ptr_cpy);
469+
read_LEB_32(&ptr_cpy);
470+
this->mark = m->pc_ptr + (ptr_cpy - m->pc_ptr);
466471
*program_state = WARDUINOrun;
467472
} else {
468473
// normal step

0 commit comments

Comments
 (0)