diff options
author | John Gilmore <gnu@cygnus> | 1991-08-20 03:02:39 +0000 |
---|---|---|
committer | John Gilmore <gnu@cygnus> | 1991-08-20 03:02:39 +0000 |
commit | 5e5215eba77007511fb040ac842a935ec624b4a6 (patch) | |
tree | f658e7a0e4541ed5640fb9e5c5f998f272b19498 /gdb | |
parent | 24e2462158f159377ed7f0c2fe96683c3e1063c9 (diff) | |
download | gdb-5e5215eba77007511fb040ac842a935ec624b4a6.zip gdb-5e5215eba77007511fb040ac842a935ec624b4a6.tar.gz gdb-5e5215eba77007511fb040ac842a935ec624b4a6.tar.bz2 |
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 11 | ||||
-rwxr-xr-x | gdb/mcheck.c | 9 | ||||
-rw-r--r-- | gdb/sparc-tdep.c | 20 | ||||
-rw-r--r-- | gdb/tm-sparc.h | 4 | ||||
-rw-r--r-- | gdb/utils.c | 2 |
5 files changed, 40 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4556f3c..70ea3f0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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(). diff --git a/gdb/mcheck.c b/gdb/mcheck.c index 2c4d2fc..611a378 100755 --- a/gdb/mcheck.c +++ b/gdb/mcheck.c @@ -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 diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index b718e4c..12ad9c5 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -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. */ diff --git a/gdb/tm-sparc.h b/gdb/tm-sparc.h index 7f0fb4e..d89781b 100644 --- a/gdb/tm-sparc.h +++ b/gdb/tm-sparc.h @@ -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)) diff --git a/gdb/utils.c b/gdb/utils.c index 5fe3b1e..28a723b 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -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); } } |