From: Andrew Cagney Date: Mon, 30 Nov 1998 10:56:16 +0000 (+0000) Subject: CARP: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b69600940692d11967b2ae8ceabed2c6c2474c37;p=binutils-gdb.git CARP: Cleanup FRAME_CHAIN_VALID. Replace all macro's with functions. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 155ce629201..ce626292c2e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,35 @@ +Mon Nov 30 11:18:48 1998 Andrew Cagney + + * frame.h (FRAME_CHAIN_VALID): Default to + default_frame_chain_valid. + * blockframe.c (default_frame_chain_valid): New function. + + * frame.h (FRAME_CHAIN_VALID_ALTERNATIVE): Delete references + * blockframe.c (alternate_frame_chain_valid): New function. + * config/mips/tm-mipsv4.h, config/m88k/tm-delta88v4.h, + config/m68k/tm-monitor.h, config/m68k/tm-m68kv4.h, + config/i386/tm-i386v4.h, config/i386/tm-i386nw.h, + config/h8300/tm-h8300.h: Update. + + * blockframe.c (nonnull_frame_chain_valid): New function. + * config/m68k/tm-os68k.h, config/m68k/tm-vx68.h, + config/m68k/tm-apollo68b.h, config/i960/tm-vx960.h, + config/arc/tm-arc.h: Update FRAME_CHAIN_VALID. + + * hppa-tdep.c (frame_chain_valid, hppa_frame_chain_valid), + remote-vx29k.c (get_fp_contents, vx29k_frame_chain_valid), + arm-tdep.c (frame_chain_valid, arm_frame_chain_valid): Rename + functions so that they are name space clean. + * config/pa/tm-hppa.h, config/a29k/tm-vx29k.h, + config/arm/tm-arm.h: Update FRAME_CHAIN_VALID. + + * gould-tdep.c (gould_frame_chain_valid), d30v-tdep.c + (d30v_frame_chain_valid), d10v-tdep.c (d10v_frame_chain_valid): + New functions. + * config/gould/tm-np1.h, config/gould/tm-pn.h, + config/d30v/tm-d30v.h, config/d10v/tm-d10v.h: Update + FRAME_CHAIN_VALID. + Sun Nov 29 11:18:37 1998 Andrew Cagney * z8k-tdep.c (z8k_addr_bits_remove), w65-tdep.c diff --git a/gdb/config/a29k/tm-vx29k.h b/gdb/config/a29k/tm-vx29k.h index d85d9b2f0ce..487df82df86 100644 --- a/gdb/config/a29k/tm-vx29k.h +++ b/gdb/config/a29k/tm-vx29k.h @@ -209,12 +209,8 @@ extern int get_longjmp_target PARAMS ((CORE_ADDR *)); val = value_cast (builtin_type_int, val); \ } while (0) -#define SPECIAL_FRAME_CHAIN_FP get_fp_contents -#undef FRAME_CHAIN_VALID -#define FRAME_CHAIN_VALID(chain, thisframe) \ - (SPECIAL_FRAME_CHAIN_FP (chain, thisframe)) - -extern int SPECIAL_FRAME_CHAIN_FP (); +extern int vx29k_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); +#define FRAME_CHAIN_VALID(chain, thisframe) vx29k_frame_chain_valid (chain, thisframe) extern CORE_ADDR frame_saved_call_site (); diff --git a/gdb/config/arc/tm-arc.h b/gdb/config/arc/tm-arc.h index 043ead61037..e964bef1645 100644 --- a/gdb/config/arc/tm-arc.h +++ b/gdb/config/arc/tm-arc.h @@ -265,7 +265,7 @@ extern void arc_software_single_step PARAMS ((unsigned int, int)); /* FRAME_CHAIN_VALID returns zero if the given frame is the outermost one and has no caller. */ -#define FRAME_CHAIN_VALID(chain, thisframe) ((chain) != 0) +#define FRAME_CHAIN_VALID(chain, thisframe) nonnull_frame_chain_valid (chain, thisframe) /* A macro that tells us whether the function invocation represented by FI does not have a frame on the stack associated with it. If it diff --git a/gdb/config/d10v/tm-d10v.h b/gdb/config/d10v/tm-d10v.h index 1fc5052bc88..ef75bc5307f 100644 --- a/gdb/config/d10v/tm-d10v.h +++ b/gdb/config/d10v/tm-d10v.h @@ -213,8 +213,8 @@ extern void d10v_init_extra_frame_info PARAMS (( int fromleaf, struct frame_info (FRAMELESS) = frameless_look_for_prologue(FI) #define FRAME_CHAIN(FRAME) d10v_frame_chain(FRAME) -#define FRAME_CHAIN_VALID(chain,frame) \ - ((chain) != 0 && (frame) != 0 && (frame)->pc > IMEM_START) +extern int d10v_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); +#define FRAME_CHAIN_VALID(chain, thisframe) d10v_frame_chain_valid (chain, thisframe) #define FRAME_SAVED_PC(FRAME) ((FRAME)->return_pc) #define FRAME_ARGS_ADDRESS(fi) (fi)->frame #define FRAME_LOCALS_ADDRESS(fi) (fi)->frame diff --git a/gdb/config/d30v/tm-d30v.h b/gdb/config/d30v/tm-d30v.h index a9f6059f78a..7a69ca36d90 100644 --- a/gdb/config/d30v/tm-d30v.h +++ b/gdb/config/d30v/tm-d30v.h @@ -217,13 +217,8 @@ extern void d30v_init_extra_frame_info PARAMS (( int fromleaf, struct frame_info (FRAMELESS) = frameless_look_for_prologue(FI) #define FRAME_CHAIN(FRAME) d30v_frame_chain(FRAME) -#if 0 -#define FRAME_CHAIN_VALID(chain,fi) \ - ((chain) != 0 && (fi) != 0 && (fi)->return_pc != 0) -#else -#define FRAME_CHAIN_VALID(chain,fi) \ - ((chain) != 0 && (fi) != 0 && (fi)->frame <= chain) -#endif +extern int d30v_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); +#define FRAME_CHAIN_VALID(chain, thisframe) d30v_frame_chain_valid (chain, thisframe) #define FRAME_SAVED_PC(FRAME) ((FRAME)->return_pc) #define FRAME_ARGS_ADDRESS(fi) (fi)->frame #define FRAME_LOCALS_ADDRESS(fi) (fi)->frame diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h index bcdbb438fe0..34b95cc1f05 100644 --- a/gdb/config/h8300/tm-h8300.h +++ b/gdb/config/h8300/tm-h8300.h @@ -201,7 +201,7 @@ CORE_ADDR h8300_frame_chain PARAMS ((struct frame_info *)); the frame chain or following frames back into the startup code. See the comments in objfile.h */ -#define FRAME_CHAIN_VALID_ALTERNATE +#define FRAME_CHAIN_VALID(fp,fi) alternate_frame_chain_valid (fp, fi) /* Define other aspects of the stack frame. */ diff --git a/gdb/config/i386/tm-i386nw.h b/gdb/config/i386/tm-i386nw.h index 43a1e1a1496..e5cdadecb47 100644 --- a/gdb/config/i386/tm-i386nw.h +++ b/gdb/config/i386/tm-i386nw.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Stop backtracing when we wander into main. */ -#define FRAME_CHAIN_VALID_ALTERNATE +#define FRAME_CHAIN_VALID(fp,fi) alternate_frame_chain_valid (fp, fi) /* Offsets (in target ints) into jmp_buf. Not defined in any system header diff --git a/gdb/config/i386/tm-i386v4.h b/gdb/config/i386/tm-i386v4.h index 0a1e56df6f2..eafff0178c0 100644 --- a/gdb/config/i386/tm-i386v4.h +++ b/gdb/config/i386/tm-i386v4.h @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Use the alternate method of determining valid frame chains. */ -#define FRAME_CHAIN_VALID_ALTERNATE +#define FRAME_CHAIN_VALID(fp,fi) alternate_frame_chain_valid (fp, fi) /* Offsets (in target ints) into jmp_buf. Not defined in any system header file, so we have to step through setjmp/longjmp with a debugger and figure diff --git a/gdb/config/i960/tm-mon960.h b/gdb/config/i960/tm-mon960.h index 3e7902ab8f9..e441e052b5a 100644 --- a/gdb/config/i960/tm-mon960.h +++ b/gdb/config/i960/tm-mon960.h @@ -24,6 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "i960/tm-i960.h" +/* forward declarations */ +#ifdef __STDC__ +struct frame_info; +#endif + /* redefined from tm-i960.h */ /* Number of machine registers */ #undef NUM_REGS @@ -51,10 +56,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ since it differs between Nindy, Mon960 and VxWorks, the currently supported target types. */ -#define FRAME_CHAIN_VALID(chain, thisframe) \ - mon960_frame_chain_valid (chain, thisframe) - -extern int mon960_frame_chain_valid(); /* See i960-tdep.c */ +extern int mon960_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); +#define FRAME_CHAIN_VALID(chain, thisframe) mon960_frame_chain_valid (chain, thisframe) /* Sequence of bytes for breakpoint instruction */ diff --git a/gdb/config/i960/tm-nindy960.h b/gdb/config/i960/tm-nindy960.h index 094781fb65d..d0c46c0a39f 100644 --- a/gdb/config/i960/tm-nindy960.h +++ b/gdb/config/i960/tm-nindy960.h @@ -24,6 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "i960/tm-i960.h" +/* forward declarations */ +#ifdef __STDC__ +struct frame_info; +#endif + /* Override the standard gdb prompt when compiled for this target. */ #define DEFAULT_PROMPT "(gdb960) " @@ -80,8 +85,8 @@ nindy_before_main_loop(); /* In remote-nindy.c */ since it differs between NINDY and VxWorks, the two currently supported targets types. */ -#define FRAME_CHAIN_VALID(chain, thisframe) \ - nindy_frame_chain_valid (chain, thisframe) +extern int nindy_frame_chain_valid PARAMS ((CORE_ADDR, struct frame_info *)); +#define FRAME_CHAIN_VALID(chain, thisframe) nindy_frame_chain_valid (chain, thisframe) extern int nindy_frame_chain_valid(); /* See nindy-tdep.c */ diff --git a/gdb/config/i960/tm-vx960.h b/gdb/config/i960/tm-vx960.h index 2d56b43f868..17e28119b29 100644 --- a/gdb/config/i960/tm-vx960.h +++ b/gdb/config/i960/tm-vx960.h @@ -36,7 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* We are guaranteed to have a zero frame pointer at bottom of stack, too. */ -#define FRAME_CHAIN_VALID(chain, thisframe) (chain != 0) +#define FRAME_CHAIN_VALID(chain, thisframe) nonnull_frame_chain_valid (chain, thisframe) /* Breakpoint patching is handled at the target end in VxWorks. */ /* #define BREAKPOINT {0x00, 0x3e, 0x00, 0x66} */ diff --git a/gdb/config/m68k/tm-apollo68b.h b/gdb/config/m68k/tm-apollo68b.h index 760d4fc9a0a..ee10410d329 100644 --- a/gdb/config/m68k/tm-apollo68b.h +++ b/gdb/config/m68k/tm-apollo68b.h @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "m68k/tm-m68k.h" -#define FRAME_CHAIN_VALID(chain, thisframe) (chain != 0) +#define FRAME_CHAIN_VALID(chain, thisframe) nonnull_frame_chain_valid (chain, thisframe) /* These are the jmp_buf registers I could guess. There are 13 registers * in the buffer. There are 8 data registers, 6 general address registers, diff --git a/gdb/config/m68k/tm-m68kv4.h b/gdb/config/m68k/tm-m68kv4.h index 42f7d7fb6e9..67306073c80 100644 --- a/gdb/config/m68k/tm-m68kv4.h +++ b/gdb/config/m68k/tm-m68kv4.h @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Use the alternate method of determining valid frame chains. */ -#define FRAME_CHAIN_VALID_ALTERNATE +#define FRAME_CHAIN_VALID(fp,fi) alternate_frame_chain_valid (fp, fi) #include "tm-sysv4.h" #include "m68k/tm-m68k.h" diff --git a/gdb/config/m68k/tm-vx68.h b/gdb/config/m68k/tm-vx68.h index a194b9452e5..e601bda737c 100644 --- a/gdb/config/m68k/tm-vx68.h +++ b/gdb/config/m68k/tm-vx68.h @@ -33,23 +33,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "m68k/tm-m68k.h" -/* We are guaranteed to have a zero frame pointer at bottom of stack, too. */ -#undef FRAME_CHAIN -#undef FRAME_CHAIN_VALID - /* Takes the current frame-struct pointer and returns the chain-pointer to get to the calling frame. If our current frame pointer is zero, we're at the top; else read out the saved FP from memory pointed to by the current FP. */ +#undef FRAME_CHAIN #define FRAME_CHAIN(thisframe) ((thisframe)->frame? read_memory_integer ((thisframe)->frame, 4): 0) /* If the chain pointer is zero (either because the saved value fetched by FRAME_CHAIN was zero, or because the current FP was zero so FRAME_CHAIN never fetched anything), we are at the top of the stack. */ +/* We are guaranteed to have a zero frame pointer at bottom of stack, too. */ -#define FRAME_CHAIN_VALID(chain, thisframe) (chain != 0) +#undef FRAME_CHAIN_VALID +#define FRAME_CHAIN_VALID(chain, thisframe) nonnull_frame_chain_valid (chain, thisframe) /* FIXME, Longjmp information stolen from Sun-3 config. Dunno if right. */ /* Offsets (in target ints) into jmp_buf. Not defined by Sun, but at least diff --git a/gdb/config/m88k/tm-delta88v4.h b/gdb/config/m88k/tm-delta88v4.h index 7acdd5f435e..112a4a6d65b 100644 --- a/gdb/config/m88k/tm-delta88v4.h +++ b/gdb/config/m88k/tm-delta88v4.h @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "tm-sysv4.h" /* If we don't define this, backtraces go on forever. */ -#define FRAME_CHAIN_VALID_ALTERNATE 1 +#define FRAME_CHAIN_VALID(fp,fi) alternate_frame_chain_valid (fp, fi) #define IN_SIGTRAMP(pc, name) ((name) && (STREQ ("signalhandler", (name)) \ || STREQ("sigacthandler", (name)))) diff --git a/gdb/config/mips/tm-mipsv4.h b/gdb/config/mips/tm-mipsv4.h index 1a4a070b2aa..dd7aaa16d9b 100644 --- a/gdb/config/mips/tm-mipsv4.h +++ b/gdb/config/mips/tm-mipsv4.h @@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_BASE + 40 + 36 * 4) /* Use the alternate method of determining valid frame chains. */ -#define FRAME_CHAIN_VALID_ALTERNATE +#define FRAME_CHAIN_VALID(fp,fi) alternate_frame_chain_valid (fp, fi) /* Convert a DWARF register number to a gdb REGNUM. */ #define DWARF_REG_TO_REGNUM(num) ((num) < 32 ? (num) : (num)+FP0_REGNUM-32) diff --git a/gdb/config/sparc/tm-sparclite.h b/gdb/config/sparc/tm-sparclite.h index 525d15f3847..d841f89c356 100644 --- a/gdb/config/sparc/tm-sparclite.h +++ b/gdb/config/sparc/tm-sparclite.h @@ -38,7 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define DECR_PC_AFTER_HW_BREAK 4 -#define FRAME_CHAIN_VALID_ALTERNATE +#define FRAME_CHAIN_VALID(fp,fi) alternate_frame_chain_valid (fp, fi) #undef NUM_REGS #define NUM_REGS 80 diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index d0f2e80d922..f4b52f62295 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -36,6 +36,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ void d10v_frame_find_saved_regs PARAMS ((struct frame_info *fi, struct frame_saved_regs *fsr)); +int +d10v_frame_chain_valid (chain, frame) + CORE_ADDR chain; + struct frame_info *frame; /* not used here */ +{ + return ((chain) != 0 && (frame) != 0 && (frame)->pc > IMEM_START); +} + + /* Should we use EXTRACT_STRUCT_VALUE_ADDRESS instead of EXTRACT_RETURN_VALUE? GCC_P is true if compiled with gcc and TYPE is the type (which is known to be struct, union or array). diff --git a/gdb/d30v-tdep.c b/gdb/d30v-tdep.c index 1add1db54ec..2cdb25d2c96 100644 --- a/gdb/d30v-tdep.c +++ b/gdb/d30v-tdep.c @@ -92,6 +92,19 @@ static void print_flags_command PARAMS ((char *, int)); #define EXTRACT_IMM26(op) ((((op)&0x0ff00000) >> 2) | ((op)&0x0003ffff)) #define EXTRACT_IMM32(opl, opr) ((EXTRACT_UIMM6(opl) << 26)|EXTRACT_IMM26(opr)) + +int +d30v_frame_chain_valid (chain, fi) + CORE_ADDR chain; + struct frame_info *fi; /* not used here */ +{ +#if 0 + return ((chain) != 0 && (fi) != 0 && (fi)->return_pc != 0); +#else + return ((chain) != 0 && (fi) != 0 && (fi)->frame <= chain); +#endif +} + /* Discard from the stack the innermost frame, restoring all saved registers. */ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index ebc0663075b..5111e56c4ac 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +Mon Nov 30 11:32:21 1998 Andrew Cagney + + * gdbint.texinfo (FRAME_CHAIN_VALID_ALTERNATE): + Sat Nov 28 13:45:53 1998 Andrew Cagney * gdbint.texinfo (INNER_THAN): Update, now takes parameters. diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 1c5da1bcdc4..ff099dd58bb 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -1261,19 +1261,16 @@ address and produce the nominal address of the caller's frame. Presently only defined for HP PA. @item FRAME_CHAIN_VALID(chain,thisframe) + Define this to be an expression that returns zero if the given frame is -an outermost frame, with no caller, and nonzero otherwise. The default -definition is nonzero if the chain pointer is nonzero and given frame's -PC is not inside the startup file (such as @file{crt0.o}). The -alternate default definition (which is used if -FRAME_CHAIN_VALID_ALTERNATE is defined) is nonzero if the chain pointer -is nonzero and the given frame's PC is not in @code{main()} or a known +an outermost frame, with no caller, and nonzero otherwise. Three common +definitions are available. @code{default_frame_chain_valid} (the +default) is nonzero if the chain pointer is nonzero and given frame's PC +is not inside the startup file (such as @file{crt0.o}). +@code{alternate_frame_chain_valid} is nonzero if the chain pointer is +nonzero and the given frame's PC is not in @code{main()} or a known entry point function (such as @code{_start()}). -@item FRAME_CHAIN_VALID_ALTERNATE -Define this in order to use the alternate default definition of -@code{FRAME_CHAIN_VALID}. - @item FRAME_FIND_SAVED_REGS stack.c diff --git a/gdb/gould-tdep.c b/gdb/gould-tdep.c index 736ab4790a5..8cd2ee51e85 100644 --- a/gdb/gould-tdep.c +++ b/gdb/gould-tdep.c @@ -33,6 +33,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Number of elements in the opcode table. */ #define NOPCODES (sizeof gld_opcodes / sizeof gld_opcodes[0]) +int +gould_frame_chain_valid (chain, fi) + CORE_ADDR chain; + struct frame_info *fi; /* not used here */ +{ + return (chain != 0 && chain != (thisframe)->frame); +} + /* Both gcc and cc return small structs in registers (i.e. in GDB terminology, small structs don't use the struct return convention). */ int diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 2b11f91818d..03215cedc34 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -1185,7 +1185,7 @@ frame_chain (frame) was compiled with gcc. */ int -frame_chain_valid (chain, thisframe) +hppa_frame_chain_valid (chain, thisframe) CORE_ADDR chain; struct frame_info *thisframe; { diff --git a/gdb/i960-tdep.c b/gdb/i960-tdep.c index c2625c0b6af..f87d6bbfe47 100644 --- a/gdb/i960-tdep.c +++ b/gdb/i960-tdep.c @@ -791,7 +791,7 @@ next_insn (memaddr, pword1, pword2) int mon960_frame_chain_valid (chain, curframe) - unsigned int chain; + CORE_ADDR chain; struct frame_info *curframe; { struct symbol *sym; diff --git a/gdb/nindy-tdep.c b/gdb/nindy-tdep.c index 3fccd4f867f..2e0b10c6a94 100644 --- a/gdb/nindy-tdep.c +++ b/gdb/nindy-tdep.c @@ -34,7 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ int nindy_frame_chain_valid (chain, curframe) - unsigned int chain; + CORE_ADDR chain; struct frame_info *curframe; { struct symbol *sym; diff --git a/gdb/remote-vx29k.c b/gdb/remote-vx29k.c index 02554aaa31c..e6fc2c79495 100644 --- a/gdb/remote-vx29k.c +++ b/gdb/remote-vx29k.c @@ -176,7 +176,7 @@ vx_write_register (regno) contents when FRAME_CHAIN_VALID is invoked. */ int -get_fp_contents (chain, thisframe) +vx29k_frame_chain_valid (chain, thisframe) CORE_ADDR chain; struct frame_info *thisframe; /* not used here */ {