Cleanup FRAME_CHAIN_VALID. Replace all macro's with functions.
+Mon Nov 30 11:18:48 1998 Andrew Cagney <cagney@chook>
+
+ * 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 <cagney@b1.cygnus.com>
* z8k-tdep.c (z8k_addr_bits_remove), w65-tdep.c
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 ();
/* 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
(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
(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
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. */
/* 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
/* 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
#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
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 */
#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) "
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 */
/* 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} */
#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,
/* 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"
#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
#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))))
#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)
#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
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).
#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. */
+Mon Nov 30 11:32:21 1998 Andrew Cagney <cagney@chook>
+
+ * gdbint.texinfo (FRAME_CHAIN_VALID_ALTERNATE):
+
Sat Nov 28 13:45:53 1998 Andrew Cagney <cagney@b1.cygnus.com>
* gdbint.texinfo (INNER_THAN): Update, now takes parameters.
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
/* 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
was compiled with gcc. */
int
-frame_chain_valid (chain, thisframe)
+hppa_frame_chain_valid (chain, thisframe)
CORE_ADDR chain;
struct frame_info *thisframe;
{
int
mon960_frame_chain_valid (chain, curframe)
- unsigned int chain;
+ CORE_ADDR chain;
struct frame_info *curframe;
{
struct symbol *sym;
int
nindy_frame_chain_valid (chain, curframe)
- unsigned int chain;
+ CORE_ADDR chain;
struct frame_info *curframe;
{
struct symbol *sym;
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 */
{