]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* infrun.c (wait_for_inferior): Fix PC out of subroutine bounds
authorStu Grossman <grossman@cygnus>
Mon, 25 Oct 1993 22:24:02 +0000 (22:24 +0000)
committerStu Grossman <grossman@cygnus>
Mon, 25 Oct 1993 22:24:02 +0000 (22:24 +0000)
check to use prev_func_start/end instead of stop_func_start/end.
* remote-udi.c (store_register):  Invalidate NPC/PC_REGNUM after
changing PC.

gdb/ChangeLog
gdb/infrun.c
gdb/remote-udi.c

index 8625cf2826cb2dc7ce146ba1238196db3df0bc81..e8af83d2c171fad04b4af0bf5737be0c66e43548 100644 (file)
@@ -1,3 +1,10 @@
+Mon Oct 25 11:08:59 1993  Stu Grossman  (grossman at cygnus.com)
+
+       * infrun.c (wait_for_inferior):  Fix PC out of subroutine bounds
+       check to use prev_func_start/end instead of stop_func_start/end.
+       * remote-udi.c (store_register):  Invalidate NPC/PC_REGNUM after
+       changing PC.
+
 Mon Oct 25 14:57:45 1993  Jim Kingdon  (kingdon@lioth.cygnus.com)
 
        * gdbserver/{low-lynx.c,low-sparc.c,low-sun3.c}, standalone.c,
index 85ebb38f108699b5e3d90290c2ef1786e077e571..6e75dc17b5134016dbdf8dbc39bba41049433e66 100644 (file)
@@ -335,6 +335,7 @@ The same program may be running in another process.");
 static CORE_ADDR prev_pc;
 static CORE_ADDR prev_sp;
 static CORE_ADDR prev_func_start;
+static CORE_ADDR prev_func_end;
 static char *prev_func_name;
 
 \f
@@ -979,12 +980,11 @@ switch_thread:
              or the call instruction itself saves the PC on the stack.  */
           || prologue_pc != stop_func_start
           || stop_sp != prev_sp)
-         && (/* I think this can only happen if stop_func_start is zero
-                (e.g. stop_pc is in some objfile we don't know about).
-                If the stop_pc does that (ends up someplace unknown), it
-                must be some sort of subroutine call.  */
-             stop_pc < stop_func_start
-             || stop_pc >= stop_func_end
+         && (/* PC is out of bounds of the current function.   Note that this
+                seems sorta redundant w.r.t the prior test of stop_func_start
+                != prev_func_start...  */
+             stop_pc < prev_func_start
+             || stop_pc >= prev_func_end
 
              /* If we do a call, we will be at the start of a function.  */
              || stop_pc == stop_func_start
@@ -1201,6 +1201,7 @@ step_into_function:
                                          original pc would not have
                                          been at the start of a
                                          function. */
+      prev_func_end = stop_func_end;
       prev_func_name = stop_func_name;
       prev_sp = stop_sp;
 
@@ -1275,6 +1276,7 @@ step_into_function:
         loop.  */
       prev_pc = read_pc ();
       prev_func_start = stop_func_start;
+      prev_func_end = stop_func_end;
       prev_func_name = stop_func_name;
       prev_sp = stop_sp;
     }
index 536d7434f96fb744098b6d0d2c02181e753bc8cc..aaf752f0947025c982b7bec214185a971510f941 100644 (file)
@@ -573,6 +573,8 @@ udi_pc()
   UDIBool      HostEndian = 0;
   UDIError     err;
   int pc[2];
+  unsigned long myregs[256];
+  int i;
 
   From.Space = UDI29KPC;
   From.Offset = 0;
@@ -589,6 +591,21 @@ udi_pc()
   printf("other pc1 = 0x%x, pc0 = 0x%x\n", *(int *)&registers[4 * PC_REGNUM],
          *(int *)&registers[4 * NPC_REGNUM]);
 
+  /* Now, read all the registers globally */
+
+  From.Space = UDI29KGlobalRegs;
+  From.Offset = 0;
+  err = UDIRead(From, myregs, 256, 4, &CountDone, HostEndian);
+
+  printf ("err = %d, CountDone = %d\n", err, CountDone);
+
+  printf("\n");
+
+  for (i = 0; i < 256; i += 2)
+    printf("%d:\t%#10x\t%11d\t%#10x\t%11d\n", i, myregs[i], myregs[i],
+          myregs[i+1], myregs[i+1]);
+  printf("\n");
+
   return pc[0];
 }
 #endif
@@ -1437,6 +1454,11 @@ store_register (regno)
       To.Space = UDI29KPC;
       To.Offset = 0;           /* PC1 */
       result = UDIWrite (&From, To, Count, Size, &CountDone, HostEndian);
+
+      /* Writing to this loc actually changes the values of pc0 & pc1 */
+
+      register_valid[PC_REGNUM] = 0; /* pc1 */
+      register_valid[NPC_REGNUM] = 0; /* pc0 */
     }
   else         /* An unprotected or protected special register */
     {
@@ -1525,6 +1547,14 @@ void  convert32() {;}
 FILE* EchoFile = 0;            /* used for debugging */
 int   QuietMode = 0;           /* used for debugging */
 \f
+#ifdef NO_HIF_SUPPORT
+service_HIF(msg)
+     union msg_t *msg;
+{
+  return(0);                   /* Emulate a failure */
+}
+#endif
+\f
 /* Target_ops vector.  Not static because there does not seem to be
    any portable way to do a forward declaration of a static variable.
    The RS/6000 doesn't like "extern" followed by "static"; SunOS
@@ -1594,11 +1624,3 @@ _initialize_remote_udi ()
 {
   add_target (&udi_ops);
 }
-
-#ifdef NO_HIF_SUPPORT
-service_HIF(msg)
-union msg_t    *msg;
-{
-       return(0);      /* Emulate a failure */
-}
-#endif