aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>2000-10-26 07:41:25 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>2000-10-26 07:41:25 +0000
commitf517ea4ebb7d0c85a5c7850757b2f1d6716e2dcf (patch)
tree7a72b4773df10c1d31950a0509650a314b8e6816 /gdb/gdbarch.c
parentba181e2f16dcf24ec7336b1f358f54fce72af42b (diff)
downloadgdb-f517ea4ebb7d0c85a5c7850757b2f1d6716e2dcf.zip
gdb-f517ea4ebb7d0c85a5c7850757b2f1d6716e2dcf.tar.gz
gdb-f517ea4ebb7d0c85a5c7850757b2f1d6716e2dcf.tar.bz2
* arch-utils.c, arch-utils.h (default_convert_from_func_ptr_addr):
New function. * gdbarch.sh (CONVERT_FROM_FUNC_PTR_ADDR): Add. * gdbarch.c, gdbarch.h: Regenerate. * valops.c (find_function_addr): Use CONVERT_FROM_FUNC_PTR_ADDR unconditionally. * config/rs6000/tm-rs6000.h (CONVERT_FROM_FUNC_PTR_ADDR): Delete definition. * config/powerpc/tm-linux.h (CONVERT_FROM_FUNC_PTR_ADDR): Remove undef. * rs6000-tdep.c (rs6000_convert_from_func_ptr_addr): Fix comment. (rs6000_gdbarch_init): Register rs6000_convert_from_func_ptr_addr if not ELFOSABI_LINUX.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 1bdf278..bd705f9 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -232,6 +232,7 @@ struct gdbarch
const struct floatformat * float_format;
const struct floatformat * double_format;
const struct floatformat * long_double_format;
+ gdbarch_convert_from_func_ptr_addr_ftype *convert_from_func_ptr_addr;
};
@@ -354,6 +355,7 @@ struct gdbarch startup_gdbarch =
0,
0,
0,
+ 0,
/* startup_gdbarch() */
};
@@ -429,6 +431,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->frame_args_skip = -1;
gdbarch->frameless_function_invocation = generic_frameless_function_invocation_not;
gdbarch->extra_stack_alignment_needed = 1;
+ gdbarch->convert_from_func_ptr_addr = default_convert_from_func_ptr_addr;
/* gdbarch_alloc() */
return gdbarch;
@@ -665,6 +668,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
gdbarch->double_format = default_double_format (gdbarch);
if (gdbarch->long_double_format == 0)
gdbarch->long_double_format = &floatformat_unknown;
+ /* Skip verify of convert_from_func_ptr_addr, invalid_p == 0 */
}
@@ -1293,6 +1297,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT # %s\n",
XSTRING (TARGET_LONG_DOUBLE_FORMAT));
#endif
+#ifdef CONVERT_FROM_FUNC_PTR_ADDR
+ fprintf_unfiltered (file,
+ "gdbarch_dump: %s # %s\n",
+ "CONVERT_FROM_FUNC_PTR_ADDR(addr)",
+ XSTRING (CONVERT_FROM_FUNC_PTR_ADDR (addr)));
+#endif
#ifdef TARGET_ARCHITECTURE
if (TARGET_ARCHITECTURE != NULL)
fprintf_unfiltered (file,
@@ -1949,6 +1959,13 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: TARGET_LONG_DOUBLE_FORMAT = %ld\n",
(long) TARGET_LONG_DOUBLE_FORMAT);
#endif
+#ifdef CONVERT_FROM_FUNC_PTR_ADDR
+ if (GDB_MULTI_ARCH)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: CONVERT_FROM_FUNC_PTR_ADDR = 0x%08lx\n",
+ (long) current_gdbarch->convert_from_func_ptr_addr
+ /*CONVERT_FROM_FUNC_PTR_ADDR ()*/);
+#endif
if (current_gdbarch->dump_tdep != NULL)
current_gdbarch->dump_tdep (current_gdbarch, file);
}
@@ -3737,6 +3754,23 @@ set_gdbarch_long_double_format (struct gdbarch *gdbarch,
gdbarch->long_double_format = long_double_format;
}
+CORE_ADDR
+gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr)
+{
+ if (gdbarch->convert_from_func_ptr_addr == 0)
+ internal_error ("gdbarch: gdbarch_convert_from_func_ptr_addr invalid");
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_convert_from_func_ptr_addr called\n");
+ return gdbarch->convert_from_func_ptr_addr (addr);
+}
+
+void
+set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
+ gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr)
+{
+ gdbarch->convert_from_func_ptr_addr = convert_from_func_ptr_addr;
+}
+
/* Keep a registrary of per-architecture data-pointers required by GDB
modules. */