From: J.T. Conklin Date: Fri, 5 Aug 1994 16:14:03 +0000 (+0000) Subject: * i386-nlmstub.c (handle_exception): Point the PC at _exit() to X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d375ce178db997dd1eced9c66e8f2bcd67ac752f;p=binutils-gdb.git * i386-nlmstub.c (handle_exception): Point the PC at _exit() to kill the program being debugged. KillMe(), the undocumented call intended for this purpose, causes the server to hang. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index cdffbb87d5d..da4a79bd9fc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +Fri Aug 5 09:08:34 1994 J.T. Conklin (jtc@phishhead.cygnus.com) + + * i386-nlmstub.c (handle_exception): Point the PC at _exit() to + kill the program being debugged. KillMe(), the undocumented + call intended for this purpose, causes the server to hang. + Thu Aug 4 16:26:06 1994 Steve Chamberlain (sac@jonny.cygnus.com) * remote.c (read_frame): Calculate run length encoded checksum correctly. diff --git a/gdb/i386-nlmstub.c b/gdb/i386-nlmstub.c index a11b83314b0..1d0c9d684ca 100644 --- a/gdb/i386-nlmstub.c +++ b/gdb/i386-nlmstub.c @@ -627,6 +627,7 @@ handle_exception (frame) { int addr, length; char *ptr; + static int killed = 0; static struct DBG_LoadDefinitionStructure *ldinfo = 0; static unsigned char first_insn[BREAKPOINT_SIZE]; /* The first instruction in the program. */ @@ -660,6 +661,17 @@ handle_exception (frame) flush_i_cache (); return RETURN_TO_PROGRAM; + case TERMINATE_NLM_EVENT: + if (!killed) + { + /* NetWare processes don't have an exit status so we + generate our own */ + sprintf (remcomOutBuffer, "W%02x", 0); + putpacket(remcomOutBuffer); + } + ResumeThread (mainthread); + return RETURN_TO_PROGRAM; + case ENTER_DEBUGGER_EVENT: case KEYBOARD_BREAK_EVENT: /* Pass some events on to the next debugger, in case it will handle @@ -717,11 +729,6 @@ handle_exception (frame) /* Random mem fault, report it */ do_status (remcomOutBuffer, frame); break; - - case TERMINATE_NLM_EVENT: - /* There is no way to get the exit status. */ - sprintf (remcomOutBuffer, "W%02x", 0); - break; /* We generate our own status */ } /* FIXME: How do we know that this exception has anything to do with @@ -734,12 +741,6 @@ handle_exception (frame) if (! putpacket(remcomOutBuffer)) return RETURN_TO_NEXT_DEBUGGER; - if (frame->ExceptionNumber == TERMINATE_NLM_EVENT) - { - ResumeThread (mainthread); - return RETURN_TO_PROGRAM; - } - while (1) { error = 0; @@ -829,7 +830,7 @@ handle_exception (frame) if (hexToInt(&ptr,&addr)) { /* registers[PC_REGNUM].lo = addr;*/ - fprintf (stderr, "Setting PC to 0x%x\n", addr); + ConsolePrintf("Setting PC to 0x%x\n", addr); while (1); } @@ -840,9 +841,17 @@ handle_exception (frame) return RETURN_TO_PROGRAM; case 'k': - /* kill the program */ - KillMe (ldinfo); - ResumeThread (mainthread); + /* The undocumented netware call KillMe() is supposed to + schedule the NLM to be killed when it next blocks. What + really happens is that the server hangs as it tries to + unload the NLM. + + So, since netware won't cooperate, we just point the PC + at the start of _exit() and continue, while noting that + we've killed the process. */ + + killed = 1; + frame->ExceptionPC = &_exit; return RETURN_TO_PROGRAM; case 'q': /* Query message */