Skip to content

Commit

Permalink
fix: print stack trace on error
Browse files Browse the repository at this point in the history
  • Loading branch information
darlanalves committed Feb 27, 2024
1 parent 3beee16 commit cf9a45d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/include/vm_instructions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,12 @@ void vm_tick(void *p)
void _onInterruptTriggered(void *arg, byte pin)
{
Program *p = (Program *)arg;
p->counter = p->interruptHandlers[pin];
p->paused = false;

vm_tick(p);
if (p->callStackPush() != -1)
{
p->counter = p->interruptHandlers[pin];
p->paused = false;
vm_tick(p);
}
}

// ========= Instructions =========
Expand Down Expand Up @@ -270,6 +272,7 @@ void MOVE_TO_FLASH vm_halt(Program *p)
}

p->onHalt();
p->flush();
}

void MOVE_TO_FLASH vm_yield(Program *p)
Expand Down Expand Up @@ -806,7 +809,8 @@ void vm_next(Program *p)
break;

default:
_printf(p, "\n[!] Invalid operation: %d\n", next);
os_printf("[!] Invalid operation: %d\n", next);
p->stackTrace();
vm_halt(p);
}

Expand Down

0 comments on commit cf9a45d

Please sign in to comment.