Cleanup FRAME_CHAIN_VALID. Replace all macro's with functions.
This commit is contained in:
Andrew Cagney 1998-11-30 10:56:16 +00:00
parent 8743fc885f
commit b696009406
26 changed files with 112 additions and 51 deletions

View File

@ -1,3 +1,35 @@
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

View File

@ -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 ();

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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. */

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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 */

View File

@ -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} */

View File

@ -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,

View File

@ -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"

View File

@ -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

View File

@ -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))))

View File

@ -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)

View File

@ -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

View File

@ -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).

View File

@ -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. */

View File

@ -1,3 +1,7 @@
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.

View File

@ -1261,18 +1261,15 @@ 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
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}.
Define this to be an expression that returns zero if the given frame is
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_FIND_SAVED_REGS
stack.c

View File

@ -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

View File

@ -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;
{

View File

@ -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;

View File

@ -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;

View File

@ -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 */
{