* target.h (TARGET_VIRTUAL_FRAME_POINTER): Delete, multi-arched.

* gdbarch.sh (TARGET_VIRTUAL_FRAME_POINTER): Add.
* gdbarch.h, gdbarch.c: Regenerate.

* arch-utils.h (legacy_virtual_frame_pointer): Declare.
* arch-utils.c: Include "gdb_assert.h".
(legacy_virtual_frame_pointer): Define.
* Makefile.in (arch-utils.o): Depends on gdb_assert.h.

* tracepoint.c (encode_actions): Make frame_reg an int.  Make
frame_offset a LONGEST.
* ax-gdb.c (gen_frame_args_address): Ditto.
(gen_frame_locals_address): Ditto.
* mn10300-tdep.c (mn10300_gdbarch_init): Initialize
virtual_frame_pointer.
(mn10300_virtual_frame_pointer): Make static.  Update parameter
list to match function signature.
* config/mn10300/tm-mn10300.h (TARGET_VIRTUAL_FRAME_POINTER): Delete.
This commit is contained in:
Andrew Cagney 2001-08-11 00:59:29 +00:00
parent 67c2c32c6b
commit 39d4ef0921
12 changed files with 113 additions and 19 deletions

View File

@ -1,3 +1,24 @@
2001-08-07 Andrew Cagney <ac131313@redhat.com>
* target.h (TARGET_VIRTUAL_FRAME_POINTER): Delete, multi-arched.
* gdbarch.sh (TARGET_VIRTUAL_FRAME_POINTER): Add.
* gdbarch.h, gdbarch.c: Regenerate.
* arch-utils.h (legacy_virtual_frame_pointer): Declare.
* arch-utils.c: Include "gdb_assert.h".
(legacy_virtual_frame_pointer): Define.
* Makefile.in (arch-utils.o): Depends on gdb_assert.h.
* tracepoint.c (encode_actions): Make frame_reg an int. Make
frame_offset a LONGEST.
* ax-gdb.c (gen_frame_args_address): Ditto.
(gen_frame_locals_address): Ditto.
* mn10300-tdep.c (mn10300_gdbarch_init): Initialize
virtual_frame_pointer.
(mn10300_virtual_frame_pointer): Make static. Update parameter
list to match function signature.
* config/mn10300/tm-mn10300.h (TARGET_VIRTUAL_FRAME_POINTER): Delete.
2001-08-10 Keith Seitz <keiths@redhat.com>
* gdb-events.sh: Add architecture_changed event.

View File

@ -1487,7 +1487,7 @@ tracepoint.o: tracepoint.c $(defs_h) $(symtab_h) $(frame_h) $(tracepoint_h) \
gdbarch.o: gdbarch.c $(defs_h) $(bfd_h) $(gdbcmd_h)
arch-utils.o: arch-utils.c $(defs_h) $(bfd_h) $(gdbcmd_h) \
$(arch_utils_h)
$(arch_utils_h) gdb_assert.h
gdbtypes.o: gdbtypes.c $(bfd_h) complaints.h $(defs_h) $(expression_h) \
$(gdbtypes_h) language.h objfiles.h $(symfile_h) $(symtab_h) $(target_h) \

View File

@ -38,6 +38,7 @@
#include "annotate.h"
#endif
#include "regcache.h"
#include "gdb_assert.h"
#include "version.h"
@ -322,6 +323,19 @@ cannot_register_not (int regnum)
{
return 0;
}
/* Legacy version of target_virtual_frame_pointer(). Assumes that
there is an FP_REGNUM and that it is the same, cooked or raw. */
void
legacy_virtual_frame_pointer (CORE_ADDR pc,
int *frame_regnum,
LONGEST *frame_offset)
{
gdb_assert (FP_REGNUM >= 0);
*frame_regnum = FP_REGNUM;
*frame_offset = 0;
}
/* Functions to manipulate the endianness of the target. */

View File

@ -122,4 +122,9 @@ void init_frame_pc_default (int fromleaf, struct frame_info *prev);
int cannot_register_not (int regnum);
/* Legacy version of target_virtual_frame_pointer(). Assumes that
there is an FP_REGNUM and that it is the same, cooked or raw. */
extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer;
#endif

View File

@ -454,7 +454,8 @@ gen_left_shift (struct agent_expr *ax, int distance)
static void
gen_frame_args_address (struct agent_expr *ax)
{
long frame_reg, frame_offset;
int frame_reg;
LONGEST frame_offset;
TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
ax_reg (ax, frame_reg);
@ -467,7 +468,8 @@ gen_frame_args_address (struct agent_expr *ax)
static void
gen_frame_locals_address (struct agent_expr *ax)
{
long frame_reg, frame_offset;
int frame_reg;
LONGEST frame_offset;
TARGET_VIRTUAL_FRAME_POINTER (ax->scope, &frame_reg, &frame_offset);
ax_reg (ax, frame_reg);

View File

@ -73,8 +73,3 @@ enum movm_register_bits {
};
#define INIT_FRAME_PC /* Not necessary */
/* Cons up virtual frame pointer for trace */
extern void mn10300_virtual_frame_pointer (CORE_ADDR, long *, long *);
#define TARGET_VIRTUAL_FRAME_POINTER(PC, REGP, OFFP) \
mn10300_virtual_frame_pointer ((PC), (REGP), (OFFP))

View File

@ -150,6 +150,7 @@ struct gdbarch
gdbarch_write_fp_ftype *write_fp;
gdbarch_read_sp_ftype *read_sp;
gdbarch_write_sp_ftype *write_sp;
gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer;
gdbarch_register_read_ftype *register_read;
gdbarch_register_write_ftype *register_write;
int num_regs;
@ -331,6 +332,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
0,
generic_get_saved_register,
0,
0,
@ -429,6 +431,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->write_fp = generic_target_write_fp;
gdbarch->read_sp = generic_target_read_sp;
gdbarch->write_sp = generic_target_write_sp;
gdbarch->virtual_frame_pointer = legacy_virtual_frame_pointer;
gdbarch->num_regs = -1;
gdbarch->sp_regnum = -1;
gdbarch->fp_regnum = -1;
@ -534,6 +537,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of write_fp, invalid_p == 0 */
/* Skip verify of read_sp, invalid_p == 0 */
/* Skip verify of write_sp, invalid_p == 0 */
/* Skip verify of virtual_frame_pointer, invalid_p == 0 */
/* Skip verify of register_read, has predicate */
/* Skip verify of register_write, has predicate */
if ((GDB_MULTI_ARCH >= 2)
@ -894,6 +898,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"TARGET_WRITE_SP(val)",
XSTRING (TARGET_WRITE_SP (val)));
#endif
#if defined (TARGET_VIRTUAL_FRAME_POINTER) && GDB_MULTI_ARCH
/* Macro might contain `[{}]' when not multi-arch */
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
"TARGET_VIRTUAL_FRAME_POINTER(pc, frame_regnum, frame_offset)",
XSTRING (TARGET_VIRTUAL_FRAME_POINTER (pc, frame_regnum, frame_offset)));
#endif
#ifdef NUM_REGS
fprintf_unfiltered (file,
"gdbarch_dump: NUM_REGS # %s\n",
@ -1564,6 +1575,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_WRITE_SP = 0x%08lx\n",
(long) current_gdbarch->write_sp
/*TARGET_WRITE_SP ()*/);
#endif
#ifdef TARGET_VIRTUAL_FRAME_POINTER
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
"gdbarch_dump: TARGET_VIRTUAL_FRAME_POINTER = 0x%08lx\n",
(long) current_gdbarch->virtual_frame_pointer
/*TARGET_VIRTUAL_FRAME_POINTER ()*/);
#endif
if (GDB_MULTI_ARCH)
fprintf_unfiltered (file,
@ -2497,6 +2515,24 @@ set_gdbarch_write_sp (struct gdbarch *gdbarch,
gdbarch->write_sp = write_sp;
}
void
gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset)
{
if (gdbarch->virtual_frame_pointer == 0)
internal_error (__FILE__, __LINE__,
"gdbarch: gdbarch_virtual_frame_pointer invalid");
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_virtual_frame_pointer called\n");
gdbarch->virtual_frame_pointer (pc, frame_regnum, frame_offset);
}
void
set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch,
gdbarch_virtual_frame_pointer_ftype virtual_frame_pointer)
{
gdbarch->virtual_frame_pointer = virtual_frame_pointer;
}
int
gdbarch_register_read_p (struct gdbarch *gdbarch)
{

View File

@ -400,6 +400,27 @@ extern void set_gdbarch_write_sp (struct gdbarch *gdbarch, gdbarch_write_sp_ftyp
#endif
#endif
/* Function for getting target's idea of a frame pointer. FIXME: GDB's
whole scheme for dealing with "frames" and "frame pointers" needs a
serious shakedown. */
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (TARGET_VIRTUAL_FRAME_POINTER)
#define TARGET_VIRTUAL_FRAME_POINTER(pc, frame_regnum, frame_offset) (legacy_virtual_frame_pointer (pc, frame_regnum, frame_offset))
#endif
typedef void (gdbarch_virtual_frame_pointer_ftype) (CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
extern void gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset);
extern void set_gdbarch_virtual_frame_pointer (struct gdbarch *gdbarch, gdbarch_virtual_frame_pointer_ftype *virtual_frame_pointer);
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (TARGET_VIRTUAL_FRAME_POINTER)
#error "Non multi-arch definition of TARGET_VIRTUAL_FRAME_POINTER"
#endif
#if GDB_MULTI_ARCH
#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (TARGET_VIRTUAL_FRAME_POINTER)
#define TARGET_VIRTUAL_FRAME_POINTER(pc, frame_regnum, frame_offset) (gdbarch_virtual_frame_pointer (current_gdbarch, pc, frame_regnum, frame_offset))
#endif
#endif
extern int gdbarch_register_read_p (struct gdbarch *gdbarch);
typedef void (gdbarch_register_read_ftype) (struct gdbarch *gdbarch, int regnum, char *buf);

View File

@ -388,6 +388,10 @@ f::TARGET_READ_FP:CORE_ADDR:read_fp:void:::0:generic_target_read_fp::0
f::TARGET_WRITE_FP:void:write_fp:CORE_ADDR val:val::0:generic_target_write_fp::0
f::TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:generic_target_read_sp::0
f::TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:generic_target_write_sp::0
# Function for getting target's idea of a frame pointer. FIXME: GDB's
# whole scheme for dealing with "frames" and "frame pointers" needs a
# serious shakedown.
f::TARGET_VIRTUAL_FRAME_POINTER:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset::0:legacy_virtual_frame_pointer::0
#
M:::void:register_read:int regnum, char *buf:regnum, buf:
M:::void:register_write:int regnum, char *buf:regnum, buf:

View File

@ -844,8 +844,10 @@ mn10300_frame_init_saved_regs (struct frame_info *frame)
plus any necessary offset to be applied to the register before
any frame pointer offsets. */
void
mn10300_virtual_frame_pointer (CORE_ADDR pc, long *reg, long *offset)
static void
mn10300_virtual_frame_pointer (CORE_ADDR pc,
int *reg,
LONGEST *offset)
{
struct frame_info *dummy = analyze_dummy_frame (pc, 0);
/* Set up a dummy frame_info, Analyze the prolog and fill in the
@ -1073,6 +1075,7 @@ mn10300_gdbarch_init (struct gdbarch_info info,
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, mn10300_dwarf2_reg_to_regnum);
set_gdbarch_do_registers_info (gdbarch, mn10300_do_registers_info);
set_gdbarch_fp_regnum (gdbarch, 31);
set_gdbarch_virtual_frame_pointer (gdbarch, mn10300_virtual_frame_pointer);
/* Breakpoints. */
set_gdbarch_breakpoint_from_pc (gdbarch, mn10300_breakpoint_from_pc);

View File

@ -1253,12 +1253,4 @@ extern void push_remote_target (char *name, int from_tty);
/* Blank target vector entries are initialized to target_ignore. */
void target_ignore (void);
/* Macro for getting target's idea of a frame pointer.
FIXME: GDB's whole scheme for dealing with "frames" and
"frame pointers" needs a serious shakedown. */
#ifndef TARGET_VIRTUAL_FRAME_POINTER
#define TARGET_VIRTUAL_FRAME_POINTER(ADDR, REGP, OFFP) \
do { *(REGP) = FP_REGNUM; *(OFFP) = 0; } while (0)
#endif /* TARGET_VIRTUAL_FRAME_POINTER */
#endif /* !defined (TARGET_H) */

View File

@ -1488,7 +1488,8 @@ encode_actions (struct tracepoint *t, char ***tdp_actions,
struct collection_list *collect;
struct cmd_list_element *cmd;
struct agent_expr *aexpr;
long frame_reg, frame_offset;
int frame_reg;
LONGEST frame_offset;
clear_collection_list (&tracepoint_list);