{
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. */
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
/* 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
if (! putpacket(remcomOutBuffer))
return RETURN_TO_NEXT_DEBUGGER;
- if (frame->ExceptionNumber == TERMINATE_NLM_EVENT)
- {
- ResumeThread (mainthread);
- return RETURN_TO_PROGRAM;
- }
-
while (1)
{
error = 0;
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);
}
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 */