aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2014-10-10 15:57:13 +0100
committerPedro Alves <palves@redhat.com>2014-10-10 15:57:13 +0100
commit3437254d7b5bc57d3a298df8640ae2f55bdbff2a (patch)
treea4514be4368be36b4aa93ee54a9833c2361fe8fe /gdb/gdbarch.c
parent31cc0b807b2fde7d0110175418a6eea01a982489 (diff)
Split vDSO range lookup to a gdbarch hook
We have a case in solib-svr4.c where we could reuse symfile-mem.c's vDSO range lookup. Since symfile-mem.c is not present in all configurations solib-svr4.c is, move that lookup to a gdbarch hook. This has the minor (good) side effect that we stop even trying the target_auxv_search lookup against targets that don't have a concept of a vDSO, in case symfile-mem.c happens to be linked in the build (--enable-targets=all). Tested on x86_64 Fedora 20. gdb/ 2014-10-10 Pedro Alves <palves@redhat.com> * arch-utils.c (default_vsyscall_range): New function. * arch-utils.h (default_vsyscall_range): New declaration. * gdbarch.sh (vsyscall_range): New hook. * gdbarch.h, gdbarch.c: Regenerate. * linux-tdep.c (linux_vsyscall_range): New function. (linux_init_abi): Install linux_vsyscall_range as vsyscall_range gdbarch hook. * memrange.c (address_in_mem_range): New function. * memrange.h (address_in_mem_range): New declaration. * symfile-mem.c (find_vdso_size): Delete function. (add_vsyscall_page): Use gdbarch_vsyscall_range.
Diffstat (limited to 'gdb/gdbarch.c')
-rw-r--r--gdb/gdbarch.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index e96d651970..298435804b 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -315,6 +315,7 @@ struct gdbarch
gdbarch_insn_is_ret_ftype *insn_is_ret;
gdbarch_insn_is_jump_ftype *insn_is_jump;
gdbarch_auxv_parse_ftype *auxv_parse;
+ gdbarch_vsyscall_range_ftype *vsyscall_range;
};
/* Create a new ``struct gdbarch'' based on information provided by
@@ -407,6 +408,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->insn_is_call = default_insn_is_call;
gdbarch->insn_is_ret = default_insn_is_ret;
gdbarch->insn_is_jump = default_insn_is_jump;
+ gdbarch->vsyscall_range = default_vsyscall_range;
/* gdbarch_alloc() */
return gdbarch;
@@ -626,6 +628,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of insn_is_ret, invalid_p == 0 */
/* Skip verify of insn_is_jump, invalid_p == 0 */
/* Skip verify of auxv_parse, has predicate. */
+ /* Skip verify of vsyscall_range, invalid_p == 0 */
buf = ui_file_xstrdup (log, &length);
make_cleanup (xfree, buf);
if (length > 0)
@@ -1292,6 +1295,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: virtual_frame_pointer = <%s>\n",
host_address_to_string (gdbarch->virtual_frame_pointer));
fprintf_unfiltered (file,
+ "gdbarch_dump: vsyscall_range = <%s>\n",
+ host_address_to_string (gdbarch->vsyscall_range));
+ fprintf_unfiltered (file,
"gdbarch_dump: vtable_function_descriptors = %s\n",
plongest (gdbarch->vtable_function_descriptors));
fprintf_unfiltered (file,
@@ -4383,6 +4389,23 @@ set_gdbarch_auxv_parse (struct gdbarch *gdbarch,
gdbarch->auxv_parse = auxv_parse;
}
+int
+gdbarch_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->vsyscall_range != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_vsyscall_range called\n");
+ return gdbarch->vsyscall_range (gdbarch, range);
+}
+
+void
+set_gdbarch_vsyscall_range (struct gdbarch *gdbarch,
+ gdbarch_vsyscall_range_ftype vsyscall_range)
+{
+ gdbarch->vsyscall_range = vsyscall_range;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */