* 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-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.
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) \
#include "annotate.h"
#endif
#include "regcache.h"
+#include "gdb_assert.h"
#include "version.h"
{
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;
+}
\f
/* Functions to manipulate the endianness of the target. */
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
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);
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);
};
#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))
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;
0,
0,
0,
+ 0,
generic_get_saved_register,
0,
0,
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;
/* 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)
"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",
"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,
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)
{
#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);
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:
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
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);
/* 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) */
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);