mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-08-05 21:50:21 +08:00
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.
This commit is contained in:
@ -187,33 +187,15 @@ symbol_file_add_from_memory_wrapper (struct ui_out *uiout, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Rummage through mappings to find the vsyscall page size. */
|
||||
|
||||
static int
|
||||
find_vdso_size (CORE_ADDR vaddr, unsigned long size,
|
||||
int read, int write, int exec, int modified,
|
||||
void *data)
|
||||
{
|
||||
struct symbol_file_add_from_memory_args *args = data;
|
||||
|
||||
if (vaddr == args->sysinfo_ehdr)
|
||||
{
|
||||
args->size = size;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Try to add the symbols for the vsyscall page, if there is one.
|
||||
This function is called via the inferior_created observer. */
|
||||
|
||||
static void
|
||||
add_vsyscall_page (struct target_ops *target, int from_tty)
|
||||
{
|
||||
CORE_ADDR sysinfo_ehdr;
|
||||
struct mem_range vsyscall_range;
|
||||
|
||||
if (target_auxv_search (target, AT_SYSINFO_EHDR, &sysinfo_ehdr) > 0
|
||||
&& sysinfo_ehdr != (CORE_ADDR) 0)
|
||||
if (gdbarch_vsyscall_range (target_gdbarch (), &vsyscall_range))
|
||||
{
|
||||
struct bfd *bfd;
|
||||
struct symbol_file_add_from_memory_args args;
|
||||
@ -236,14 +218,11 @@ add_vsyscall_page (struct target_ops *target, int from_tty)
|
||||
return;
|
||||
}
|
||||
args.bfd = bfd;
|
||||
args.sysinfo_ehdr = sysinfo_ehdr;
|
||||
args.size = 0;
|
||||
if (gdbarch_find_memory_regions_p (target_gdbarch ()))
|
||||
(void) gdbarch_find_memory_regions (target_gdbarch (),
|
||||
find_vdso_size, &args);
|
||||
args.sysinfo_ehdr = vsyscall_range.start;
|
||||
args.size = vsyscall_range.length;
|
||||
|
||||
args.name = xstrprintf ("system-supplied DSO at %s",
|
||||
paddress (target_gdbarch (), sysinfo_ehdr));
|
||||
paddress (target_gdbarch (), vsyscall_range.start));
|
||||
/* Pass zero for FROM_TTY, because the action of loading the
|
||||
vsyscall DSO was not triggered by the user, even if the user
|
||||
typed "run" at the TTY. */
|
||||
|
Reference in New Issue
Block a user