* mcheck.c: Avoid warning about undeclared abort fn.
authorJohn Gilmore <gnu@cygnus>
Tue, 20 Aug 1991 03:02:39 +0000 (03:02 +0000)
committerJohn Gilmore <gnu@cygnus>
Tue, 20 Aug 1991 03:02:39 +0000 (03:02 +0000)
* tm-sparc.h (PC_ADJUST):  Avoid calling error() from this;
it causes recursive calls to error() when used in cleanups.
To do so requires that we make it a function, so we do.
* sparc-tdep.c (sparc_pc_adjust):  New implem of PC_ADJUST.
* utils.c (do_cleanups):  Remove the current cleanup from the
chain *before* calling it, in case error() is called from it.
The result won't be pretty, but won't be an infinite loop either.

gdb/ChangeLog
gdb/mcheck.c
gdb/sparc-tdep.c
gdb/tm-sparc.h
gdb/utils.c

index 4556f3c21f462273fc4e37908e4a1b65ab42cfa9..70ea3f0a593bc6bef14420565ea2af3a8e51d858 100644 (file)
@@ -1,6 +1,13 @@
 Mon Aug 19 13:44:46 1991  John Gilmore  (gnu at cygint.cygnus.com)
 
-       * 
+       * mcheck.c:  Avoid warning about undeclared abort fn.
+       * tm-sparc.h (PC_ADJUST):  Avoid calling error() from this;
+       it causes recursive calls to error() when used in cleanups.
+       To do so requires that we make it a function, so we do.
+       * sparc-tdep.c (sparc_pc_adjust):  New implem of PC_ADJUST.
+       * utils.c (do_cleanups):  Remove the current cleanup from the
+       chain *before* calling it, in case error() is called from it.
+       The result won't be pretty, but won't be an infinite loop either.
 
 Mon Aug 19 00:41:04 1991  Michael Tiemann  (tiemann at cygint.cygnus.com)
 
@@ -147,7 +154,7 @@ Tue Aug  6 17:16:15 1991  Roland H. Pesch  (pesch at cygint.cygnus.com)
 
 Fri Aug  2 00:13:06 1991  John Gilmore  (gnu at cygint.cygnus.com)
 
-       * values.c (basetype_addr):  When reading target memory, use the
+       * values.c (baseclass_addr):  When reading target memory, use the
        length of the basetype, not the upper type.  We've only malloc'd
        enough space for the basetype, leading to errors in free().
 
index 2c4d2fc1642393fb9400486ad321a28047fabe27..611a378ee9689cfa318c87ea54ade8fa54b369e5 100755 (executable)
@@ -28,8 +28,15 @@ static void EXFUN((*old_free_hook), (PTR ptr));
 static PTR EXFUN((*old_malloc_hook), (size_t size));
 static PTR EXFUN((*old_realloc_hook), (PTR ptr, size_t size));
 
+/* FIXME.  We cannot *declare* abort() as either being void or being
+   int, because if the system declares it as the other, we get a fatal
+   error.  It's senseless to configure the system for whether abort is
+   void or int.  So we simply fail to declare it, which works on all
+   systems, but might produce a warning on yours.  Please ignore the warning
+   and raise your middle finger in the general direction of the ANSI C
+   committee in tribute.  */
 /* Function to call when something awful happens. */
-static void EXFUN((*abortfunc), (void)) = abort;
+static void EXFUN((*abortfunc), (void)) = (void (*)()) abort;
 
 /* Arbitrary magical numbers.  */
 #define MAGICWORD      0xfedabeeb
index b718e4c88833ab2085866c262f0422d5a55118ac..12ad9c564a2f49f82b86e53dfb24ce3eeab53b92 100644 (file)
@@ -614,6 +614,26 @@ sparc_pop_frame ()
                                        read_pc ()));
 }
 
+/* On the Sun 4 under SunOS, the compile will leave a fake insn which
+   encodes the structure size being returned.  If we detect such
+   a fake insn, step past it.  */
+
+CORE_ADDR
+sparc_pc_adjust(pc)
+     CORE_ADDR pc;
+{
+  long insn;
+  int err;
+
+  err = target_read_memory (pc + 8, (char *)&insn, sizeof(long));
+  SWAP_TARGET_AND_HOST (&insn, sizeof(long));
+  if ((err == 0) && (insn & 0xfffffe00) == 0)
+    return pc+12;
+  else
+    return pc+8;
+}
+
+
 /* Structure of SPARC extended floating point numbers.
    This information is not currently used by GDB, since no current SPARC
    implementations support extended float.  */
index 7f0fb4e6fba47f37414e4209556dc7c99d69d696..d89781b8849cef80dd7ebf2e49781eb55448e6d3 100644 (file)
@@ -84,8 +84,8 @@ extern CORE_ADDR skip_prologue ();
    encodes the structure size being returned.  If we detect such
    a fake insn, step past it.  */
 
-#define PC_ADJUST(pc) ((read_memory_integer (pc + 8, 4) & 0xfffffe00) == 0 ? \
-                      pc+12 : pc+8)
+#define PC_ADJUST(pc) sparc_pc_adjust(pc)
+extern CORE_ADDR sparc_pc_adjust();
 
 #define SAVED_PC_AFTER_CALL(frame) PC_ADJUST (read_register (RP_REGNUM))
 
index 5fe3b1ebc108d397787e75a7acea4be4788f2870..28a723bfbdd3445b0b36b94e96e4c5439407722c 100644 (file)
@@ -134,8 +134,8 @@ do_cleanups (old_chain)
   register struct cleanup *ptr;
   while ((ptr = cleanup_chain) != old_chain)
     {
+      cleanup_chain = ptr->next;       /* Do this first incase recursion */
       (*ptr->function) (ptr->arg);
-      cleanup_chain = ptr->next;
       free (ptr);
     }
 }
This page took 0.030486 seconds and 4 git commands to generate.