diff --git a/include/dosexe.h b/include/dosexe.h index 4e5e92c0069..3fb33e15367 100644 --- a/include/dosexe.h +++ b/include/dosexe.h @@ -38,6 +38,8 @@ extern void MZ_KillModule( LPDOSTASK lpDosTask ); #endif /* linux */ +extern void (*ctx_debug_call)( int sig, CONTEXT* ); + extern HINSTANCE16 MZ_CreateProcess( LPCSTR name, LPCSTR cmdline, LPCSTR env, LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info ); extern int DOSVM_Enter( PCONTEXT context ); diff --git a/loader/dos/dosvm.c b/loader/dos/dosvm.c index 1ce89d8baee..093b159d08a 100644 --- a/loader/dos/dosvm.c +++ b/loader/dos/dosvm.c @@ -27,6 +27,8 @@ #include "ldt.h" #include "dosexe.h" +void (*ctx_debug_call)(int sig,CONTEXT*ctx)=NULL; + #ifdef MZ_SUPPORTED #include @@ -99,7 +101,7 @@ static int DOSVM_Process( LPDOSTASK lpDosTask, int fn, ret=-1; break; case VM86_UNKNOWN: /* unhandled GPF */ DOSVM_Dump(lpDosTask,fn,VM86); - ctx_debug(SIGSEGV,&context); + if (ctx_debug_call) ctx_debug_call(SIGSEGV,&context); else ret=-1; break; case VM86_INTx: TRACE(int,"DOS EXE calls INT %02x with AX=%04lx\n",VM86_ARG(fn),context.Eax); @@ -109,7 +111,7 @@ static int DOSVM_Process( LPDOSTASK lpDosTask, int fn, case VM86_PICRETURN: printf("Trapped due to pending PIC request\n"); break; case VM86_TRAP: - ctx_debug(SIGTRAP,&context); + if (ctx_debug_call) ctx_debug_call(SIGTRAP,&context); break; default: DOSVM_Dump(lpDosTask,fn,VM86); diff --git a/miscemu/main.c b/miscemu/main.c index 4ff9b2db253..82b2e5ff23d 100644 --- a/miscemu/main.c +++ b/miscemu/main.c @@ -130,6 +130,7 @@ int main( int argc, char *argv[] ) if (Options.debug) DEBUG_AddModuleBreakpoints(); + ctx_debug_call = ctx_debug; IF1632_CallLargeStack = (int (*)(int (*func)(), void *arg))CALL32_Init(); Yield16(); /* Start the first task */ MSG("WinMain: Should never happen: returned from Yield16()\n" );