Jump into REPL when executing with --repl-on-error and an error occurs, when the REPL is builtin you will have access to the full stack then. (0.25.0)
This commit is contained in:
parent
41fa946f1c
commit
c71857a068
9 changed files with 309 additions and 7 deletions
8
src/vm.h
8
src/vm.h
|
|
@ -49,7 +49,7 @@ typedef struct {
|
|||
Value locals[MAX_FRAME_LOCALS];
|
||||
} Frame;
|
||||
|
||||
typedef struct {
|
||||
struct VM {
|
||||
Value stack[STACK_SIZE];
|
||||
int sp;
|
||||
|
||||
|
|
@ -68,7 +68,11 @@ typedef struct {
|
|||
int exit_code; // process exit code set by OP_EXIT
|
||||
|
||||
int trace_enabled; // when non-zero, print executed ops and stack
|
||||
} VM;
|
||||
int repl_on_error; // when non-zero, enter REPL on runtime error (preserve stack)
|
||||
int (*on_error_repl)(struct VM *vm); // optional hook to run REPL on error
|
||||
};
|
||||
|
||||
typedef struct VM VM;
|
||||
|
||||
// initialize VM (zero state)
|
||||
void vm_init(VM *vm);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue