From b1a6c1cea365f80b90c0bca795c8d16fa0681560 Mon Sep 17 00:00:00 2001 From: Jiong Wang Date: Wed, 9 Aug 2017 15:37:20 +0100 Subject: [PATCH] [AArch64] Implement gdbarch_core_read_description Currently, AArch64 only have one target description which is tdesc_aarch64. So, we haven't implemented any target description detection mechanism for core file. This patch is an initial implementation of core_read_description method. Future features can use this to return selected description. gdb/ * aarch64-linux-tdep.c (aarch64_linux_core_read_description): New function. (aarch64_linux_init_abi): Register gdbarch_core_read_description. --- gdb/ChangeLog | 6 ++++++ gdb/aarch64-linux-tdep.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7841101d11..516e39a8ff 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2017-08-09 Jiong Wang + + * aarch64-linux-tdep.c (aarch64_linux_core_read_description): New + function. + (aarch64_linux_init_abi): Register gdbarch_core_read_description. + 2017-08-09 Pedro Alves * cp-name-parser.y (cp_comp_to_string): Return a diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index d2ca70a99b..c673151d35 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -231,6 +231,20 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch, NULL, cb_data); } +/* Implement the "core_read_description" gdbarch method. */ + +static const struct target_desc * +aarch64_linux_core_read_description (struct gdbarch *gdbarch, + struct target_ops *target, bfd *abfd) +{ + CORE_ADDR aarch64_hwcap = 0; + + if (target_auxv_search (target, AT_HWCAP, &aarch64_hwcap) != 1) + return NULL; + + return tdesc_aarch64; +} + /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ @@ -1018,6 +1032,8 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_iterate_over_regset_sections (gdbarch, aarch64_linux_iterate_over_regset_sections); + set_gdbarch_core_read_description + (gdbarch, aarch64_linux_core_read_description); /* SystemTap related. */ set_gdbarch_stap_integer_prefixes (gdbarch, stap_integer_prefixes);