mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
[gamecode] Add VM enter/exit events
And rename prd_exit to prd_terminate (the idea is the host will terminate the VM). This makes it possible for the debugger to pause the VM before any code, even a builtin function, is executed. Breaks the debugger source window, but only because it's not updating on file change (I think).
This commit is contained in:
parent
1bd8e2ee85
commit
2d5df34234
3 changed files with 11 additions and 2 deletions
|
@ -1710,7 +1710,9 @@ typedef enum {
|
||||||
prd_trace,
|
prd_trace,
|
||||||
prd_breakpoint,
|
prd_breakpoint,
|
||||||
prd_watchpoint,
|
prd_watchpoint,
|
||||||
prd_exit, // not sent by VM
|
prd_subenter,
|
||||||
|
prd_subexit, // current invocation of PR_ExecuteProgram finished
|
||||||
|
prd_terminate, // not sent by VM
|
||||||
prd_runerror,
|
prd_runerror,
|
||||||
prd_error, // lower level error thann prd_runerror
|
prd_error, // lower level error thann prd_runerror
|
||||||
} prdebug_t;
|
} prdebug_t;
|
||||||
|
|
|
@ -458,6 +458,10 @@ PR_ExecuteProgram (progs_t *pr, func_t fnum)
|
||||||
Sys_PushSignalHook (signal_hook, pr);
|
Sys_PushSignalHook (signal_hook, pr);
|
||||||
Sys_PushErrorHandler (error_handler, pr);
|
Sys_PushErrorHandler (error_handler, pr);
|
||||||
|
|
||||||
|
if (pr->debug_handler) {
|
||||||
|
pr->debug_handler (prd_subenter, &fnum, pr->debug_data);
|
||||||
|
}
|
||||||
|
|
||||||
if (!PR_CallFunction (pr, fnum)) {
|
if (!PR_CallFunction (pr, fnum)) {
|
||||||
// called a builtin instead of progs code
|
// called a builtin instead of progs code
|
||||||
goto exit_program;
|
goto exit_program;
|
||||||
|
@ -1723,6 +1727,9 @@ op_call:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exit_program:
|
exit_program:
|
||||||
|
if (pr->debug_handler) {
|
||||||
|
pr->debug_handler (prd_subexit, 0, pr->debug_data);
|
||||||
|
}
|
||||||
pr->pr_argc = 0;
|
pr->pr_argc = 0;
|
||||||
Sys_PopErrorHandler ();
|
Sys_PopErrorHandler ();
|
||||||
Sys_PopSignalHook ();
|
Sys_PopSignalHook ();
|
||||||
|
|
|
@ -233,7 +233,7 @@ run_progs (void *data)
|
||||||
PR_ExecuteProgram (thread->pr, thread->main_func);
|
PR_ExecuteProgram (thread->pr, thread->main_func);
|
||||||
PR_PopFrame (thread->pr);
|
PR_PopFrame (thread->pr);
|
||||||
if (thread->pr->debug_handler) {
|
if (thread->pr->debug_handler) {
|
||||||
thread->pr->debug_handler (prd_exit, 0, thread->pr->debug_data);
|
thread->pr->debug_handler (prd_terminate, 0, thread->pr->debug_data);
|
||||||
}
|
}
|
||||||
thread->return_code = R_INT (thread->pr);
|
thread->return_code = R_INT (thread->pr);
|
||||||
return thread;
|
return thread;
|
||||||
|
|
Loading…
Reference in a new issue