aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-nlmstub.c
diff options
context:
space:
mode:
authorJ.T. Conklin <jtc@acorntoolworks.com>1994-08-05 16:14:03 +0000
committerJ.T. Conklin <jtc@acorntoolworks.com>1994-08-05 16:14:03 +0000
commitd375ce178db997dd1eced9c66e8f2bcd67ac752f (patch)
tree282416d7108e1f071cb301d7f8f15157d515f66b /gdb/i386-nlmstub.c
parent284f4ee95b2397193863711d631d0bed18ffa101 (diff)
downloadgdb-d375ce178db997dd1eced9c66e8f2bcd67ac752f.zip
gdb-d375ce178db997dd1eced9c66e8f2bcd67ac752f.tar.gz
gdb-d375ce178db997dd1eced9c66e8f2bcd67ac752f.tar.bz2
* 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.
Diffstat (limited to 'gdb/i386-nlmstub.c')
-rw-r--r--gdb/i386-nlmstub.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/gdb/i386-nlmstub.c b/gdb/i386-nlmstub.c
index a11b833..1d0c9d6 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 */