diff --git a/include/QF/progs.h b/include/QF/progs.h index c393be5a5..c08bf12d5 100644 --- a/include/QF/progs.h +++ b/include/QF/progs.h @@ -1710,7 +1710,9 @@ typedef enum { prd_trace, prd_breakpoint, 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_error, // lower level error thann prd_runerror } prdebug_t; diff --git a/libs/gamecode/pr_exec.c b/libs/gamecode/pr_exec.c index 425ec5f64..b0a7cb820 100644 --- a/libs/gamecode/pr_exec.c +++ b/libs/gamecode/pr_exec.c @@ -458,6 +458,10 @@ PR_ExecuteProgram (progs_t *pr, func_t fnum) Sys_PushSignalHook (signal_hook, pr); Sys_PushErrorHandler (error_handler, pr); + if (pr->debug_handler) { + pr->debug_handler (prd_subenter, &fnum, pr->debug_data); + } + if (!PR_CallFunction (pr, fnum)) { // called a builtin instead of progs code goto exit_program; @@ -1723,6 +1727,9 @@ op_call: } } exit_program: + if (pr->debug_handler) { + pr->debug_handler (prd_subexit, 0, pr->debug_data); + } pr->pr_argc = 0; Sys_PopErrorHandler (); Sys_PopSignalHook (); diff --git a/ruamoko/qwaq/main.c b/ruamoko/qwaq/main.c index 8c9650786..bbd66bac1 100644 --- a/ruamoko/qwaq/main.c +++ b/ruamoko/qwaq/main.c @@ -233,7 +233,7 @@ run_progs (void *data) PR_ExecuteProgram (thread->pr, thread->main_func); PR_PopFrame (thread->pr); 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); return thread;