diff --git a/include/dosexe.h b/include/dosexe.h index 4e5e92c0069f5ccf41ca1aa5502e67663df53e2d..3fb33e153673d49d89f8dce2bb77f5ff7717247f 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 1ce89d8baeeaaeda1c78738cf980c1141d85509f..093b159d08a27442c49e1e65c1782b1b2dd878fa 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 <sys/mman.h> @@ -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 4ff9b2db2538e6be1a032d40df4c4a37e1e0aa74..82b2e5ff23dc883143d08806c7cb6c4b2ec4d9fe 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" );