* i386-nlmstub.c (handle_exception): Point the PC at _exit() to
authorJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 5 Aug 1994 16:14:03 +0000 (16:14 +0000)
committerJ.T. Conklin <jtc@acorntoolworks.com>
Fri, 5 Aug 1994 16:14:03 +0000 (16:14 +0000)
  kill the program being debugged.  KillMe(), the undocumented
  call intended for this purpose, causes the server to hang.

gdb/ChangeLog
gdb/i386-nlmstub.c

index cdffbb87d5d17a3d506ee9e0ca0e721c5984d2ee..da4a79bd9fccc5afb974a3b476eadc52f1a7668d 100644 (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)
 
        * remote.c (read_frame): Calculate run length encoded checksum correctly.
index a11b83314b0a14aa8acab1b6db51e233f9296f02..1d0c9d684cae8ac94878de17e214a0fa5d347fe6 100644 (file)
@@ -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 */
This page took 0.033655 seconds and 4 git commands to generate.