aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-08-11 00:59:29 +0000
committerAndrew Cagney <cagney@redhat.com>2001-08-11 00:59:29 +0000
commit39d4ef0921acdfe6433b9630a37e3fc957b6d797 (patch)
tree12985cda58e21f7fe3912c620e17bbf2882a13a1
parent67c2c32c6b30dd3690964884a46b39cc6ee27486 (diff)
downloadgdb-39d4ef0921acdfe6433b9630a37e3fc957b6d797.zip
gdb-39d4ef0921acdfe6433b9630a37e3fc957b6d797.tar.gz
gdb-39d4ef0921acdfe6433b9630a37e3fc957b6d797.tar.bz2
* 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.
-rw-r--r--gdb/ChangeLog21
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/arch-utils.c14
-rw-r--r--gdb/arch-utils.h5
-rw-r--r--gdb/ax-gdb.c6
-rw-r--r--gdb/config/mn10300/tm-mn10300.h5
-rw-r--r--gdb/gdbarch.c36
-rw-r--r--gdb/gdbarch.h21
-rwxr-xr-xgdb/gdbarch.sh4
-rw-r--r--gdb/mn10300-tdep.c7
-rw-r--r--gdb/target.h8
-rw-r--r--gdb/tracepoint.c3
12 files changed, 113 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b6775a4..976e927 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 14544ed..7234e36 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -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) \
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 3da3c27..93da7c8 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -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. */
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 071b530..3a986af 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -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
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 3fe6677..7542454 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -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);
diff --git a/gdb/config/mn10300/tm-mn10300.h b/gdb/config/mn10300/tm-mn10300.h
index 5178015..7931d6d 100644
--- a/gdb/config/mn10300/tm-mn10300.h
+++ b/gdb/config/mn10300/tm-mn10300.h
@@ -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))
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index be5cccf..21645d9 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -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",
@@ -1565,6 +1576,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
(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_dump: register_read = 0x%08lx\n",
@@ -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)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 287ec83..69ad8e7 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -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);
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 3b0387e..a8c9089 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -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:
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index dd7674e..53f6ec9 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -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);
diff --git a/gdb/target.h b/gdb/target.h
index 457308c..7c97ba6 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -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) */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 692c9a2..6351377 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -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);