* 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.
This commit is contained in:
J.T. Conklin 1994-08-05 16:14:03 +00:00
parent 284f4ee95b
commit d375ce178d
2 changed files with 30 additions and 15 deletions

View file

@ -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) Thu Aug 4 16:26:06 1994 Steve Chamberlain (sac@jonny.cygnus.com)
* remote.c (read_frame): Calculate run length encoded checksum correctly. * remote.c (read_frame): Calculate run length encoded checksum correctly.

View file

@ -627,6 +627,7 @@ handle_exception (frame)
{ {
int addr, length; int addr, length;
char *ptr; char *ptr;
static int killed = 0;
static struct DBG_LoadDefinitionStructure *ldinfo = 0; static struct DBG_LoadDefinitionStructure *ldinfo = 0;
static unsigned char first_insn[BREAKPOINT_SIZE]; /* The first instruction in the program. */ static unsigned char first_insn[BREAKPOINT_SIZE]; /* The first instruction in the program. */
@ -660,6 +661,17 @@ handle_exception (frame)
flush_i_cache (); flush_i_cache ();
return RETURN_TO_PROGRAM; 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 ENTER_DEBUGGER_EVENT:
case KEYBOARD_BREAK_EVENT: case KEYBOARD_BREAK_EVENT:
/* Pass some events on to the next debugger, in case it will handle /* 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 */ /* Random mem fault, report it */
do_status (remcomOutBuffer, frame); do_status (remcomOutBuffer, frame);
break; 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 /* FIXME: How do we know that this exception has anything to do with
@ -734,12 +741,6 @@ handle_exception (frame)
if (! putpacket(remcomOutBuffer)) if (! putpacket(remcomOutBuffer))
return RETURN_TO_NEXT_DEBUGGER; return RETURN_TO_NEXT_DEBUGGER;
if (frame->ExceptionNumber == TERMINATE_NLM_EVENT)
{
ResumeThread (mainthread);
return RETURN_TO_PROGRAM;
}
while (1) while (1)
{ {
error = 0; error = 0;
@ -829,7 +830,7 @@ handle_exception (frame)
if (hexToInt(&ptr,&addr)) if (hexToInt(&ptr,&addr))
{ {
/* registers[PC_REGNUM].lo = 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); while (1);
} }
@ -840,9 +841,17 @@ handle_exception (frame)
return RETURN_TO_PROGRAM; return RETURN_TO_PROGRAM;
case 'k': case 'k':
/* kill the program */ /* The undocumented netware call KillMe() is supposed to
KillMe (ldinfo); schedule the NLM to be killed when it next blocks. What
ResumeThread (mainthread); 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; return RETURN_TO_PROGRAM;
case 'q': /* Query message */ case 'q': /* Query message */