[AArch64] Implement gdbarch_core_read_description
authorJiong Wang <jiong.wang@arm.com>
Wed, 9 Aug 2017 16:43:00 +0000 (17:43 +0100)
committerJiong Wang <jiong.wang@arm.com>
Wed, 9 Aug 2017 16:46:06 +0000 (17:46 +0100)
Recommit with missing header files added.

gdb/
* aarch64-linux-tdep.c: Include "auxv.h" and "elf/common.h".
(aarch64_linux_core_read_description): New function.
(aarch64_linux_init_abi): Register gdbarch_core_read_description.

gdb/ChangeLog
gdb/aarch64-linux-tdep.c

index 7841101d111ed17ae23b9ba9a871f6f1b0fb7166..4e30810d3ba36ff7773e7e6603105794a5deddfc 100644 (file)
@@ -1,3 +1,9 @@
+2017-08-09  Jiong Wang  <jiong.wang@arm.com>
+
+       * aarch64-linux-tdep.c: Include "auxv.h" and "elf/common.h".
+       (aarch64_linux_core_read_description): New function.
+       (aarch64_linux_init_abi): Register gdbarch_core_read_description.
+
 2017-08-09  Pedro Alves  <palves@redhat.com>
 
        * cp-name-parser.y (cp_comp_to_string): Return a
index d2ca70a99b1d8ca88729d55c1bb30c0047bc53b0..847454f1d14a89cd7e5733f212a03f60783bcd89 100644 (file)
@@ -45,6 +45,8 @@
 
 #include "record-full.h"
 #include "linux-record.h"
+#include "auxv.h"
+#include "elf/common.h"
 
 /* Signal frame handling.
 
@@ -231,6 +233,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 +1034,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);