Add aarch64_create_target_description
authorAlan Hayward <alan.hayward@arm.com>
Fri, 24 Nov 2017 10:00:54 +0000 (10:00 +0000)
committerAlan Hayward <alan.hayward@arm.com>
Fri, 24 Nov 2017 11:18:19 +0000 (11:18 +0000)
gdb/
* Makefile.in: Add new files.
* aarch64-linux-nat.c (aarch64_linux_read_description): Call
aarch64_read_description.
* aarch64-linux-tdep.c (aarch64_linux_core_read_description):
Call aarch64_read_description.
* aarch64-tdep.c (aarch64_read_description): New function.
(aarch64_gdbarch_init): Call aarch64_read_description.
* aarch64-tdep.h (aarch64_read_description): New function.
* arch/aarch64.c: New file.
* configure.tgt: Add new files.

gdb/ChangeLog
gdb/Makefile.in
gdb/aarch64-linux-nat.c
gdb/aarch64-linux-tdep.c
gdb/aarch64-tdep.c
gdb/aarch64-tdep.h
gdb/arch/aarch64.c [new file with mode: 0644]
gdb/arch/aarch64.h
gdb/configure.tgt

index c464f295ebfda4b29110e754767fdf6a6297f65e..f7ad590d18847bab56f2ec67a4f286817464455d 100644 (file)
@@ -1,3 +1,17 @@
+
+2017-11-24  Alan Hayward  <alan.hayward@arm.com>
+
+       * Makefile.in: Add new files.
+       * aarch64-linux-nat.c (aarch64_linux_read_description): Call
+       aarch64_read_description.
+       * aarch64-linux-tdep.c (aarch64_linux_core_read_description):
+       Call aarch64_read_description.
+       * aarch64-tdep.c (aarch64_read_description): New function.
+       (aarch64_gdbarch_init): Call aarch64_read_description.
+       * aarch64-tdep.h (aarch64_read_description): New function.
+       * arch/aarch64.c: New file.
+       * configure.tgt: Add new files.
+
 2017-11-24  Yao Qi  <yao.qi@linaro.org>
 
        * mi/mi-main.c (register_changed_p): Update.
index 0a1a76954135926eccf2309325217d992b82f285..ec9900ca1dfef843f0c3357c34615bc41926f6df 100644 (file)
@@ -783,6 +783,7 @@ ALL_64_TARGET_OBS = \
        amd64-sol2-tdep.o \
        amd64-tdep.o \
        amd64-windows-tdep.o \
+       arch/aarch64.o \
        arch/aarch64-insn.o \
        arch/amd64.o \
        ia64-linux-tdep.o \
@@ -1515,6 +1516,7 @@ HFILES_NO_SRCDIR = \
        xml-syscall.h \
        xml-tdesc.h \
        xtensa-tdep.h \
+       arch/aarch64.h \
        arch/aarch64-insn.h \
        arch/arm.h \
        arch/i386.h \
index de18eddbaba248e89ad81c47629e834982601931..9e317c04e4b9a8d9b8c96e70dbe4261cb9a24206 100644 (file)
@@ -501,7 +501,7 @@ aarch64_linux_read_description (struct target_ops *ops)
   if (ret == 0)
     return tdesc_arm_with_neon;
   else
-    return tdesc_aarch64;
+    return aarch64_read_description ();
 }
 
 /* Convert a native/host siginfo object, into/from the siginfo in the
index b6052bafd6d47e594b1452b565371f9bc1d84200..c2c2c309338a2ec814b615ac6c728bab7d5a4736 100644 (file)
@@ -244,7 +244,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch,
   if (target_auxv_search (target, AT_HWCAP, &aarch64_hwcap) != 1)
     return NULL;
 
-  return tdesc_aarch64;
+  return aarch64_read_description ();
 }
 
 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
index 85cabfd215cf61f504f5ffb6e88789ee80628452..541a909edaaa1937294b1bb4375ecdd7de3d4c3c 100644 (file)
@@ -2828,6 +2828,20 @@ aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
   return 1;
 }
 
+/* Get the correct target description.  */
+
+const target_desc *
+aarch64_read_description ()
+{
+  static target_desc *aarch64_tdesc = NULL;
+  target_desc **tdesc = &aarch64_tdesc;
+
+  if (*tdesc == NULL)
+    *tdesc = aarch64_create_target_description ();
+
+  return *tdesc;
+}
+
 /* Initialize the current architecture based on INFO.  If possible,
    re-use an architecture from ARCHES, which is a list of
    architectures already created during this debugging session.
@@ -2851,7 +2865,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
 
   /* Ensure we always have a target descriptor.  */
   if (!tdesc_has_registers (tdesc))
-    tdesc = tdesc_aarch64;
+    tdesc = aarch64_read_description ();
 
   gdb_assert (tdesc);
 
index 2597443560f9caf9f7ce0d95cf3325a423b91e02..d9cbd353f3feaea12fb4a07cf4944f305326fc8f 100644 (file)
@@ -75,7 +75,7 @@ struct gdbarch_tdep
   int (*aarch64_syscall_record) (struct regcache *regcache, unsigned long svc_number);
 };
 
-extern struct target_desc *tdesc_aarch64;
+const target_desc *aarch64_read_description ();
 
 extern int aarch64_process_record (struct gdbarch *gdbarch,
                                struct regcache *regcache, CORE_ADDR addr);
diff --git a/gdb/arch/aarch64.c b/gdb/arch/aarch64.c
new file mode 100644 (file)
index 0000000..95d9906
--- /dev/null
@@ -0,0 +1,30 @@
+/* Copyright (C) 2017 Free Software Foundation, Inc.
+
+   This file is part of GDB.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+
+#include "aarch64.h"
+
+extern struct target_desc *tdesc_aarch64;
+
+/* Create the aarch64 target description.  */
+
+target_desc *
+aarch64_create_target_description ()
+{
+  return tdesc_aarch64;
+}
+
index b52740529b182bd63744022e552c3cdb3bc16759..ebb78c4fa80b4b659f85797dc0a0d84e83de4bba 100644 (file)
 #ifndef ARCH_AARCH64_H
 #define ARCH_AARCH64_H
 
+#include "tdesc.h"
+
+target_desc *aarch64_create_target_description ();
+
 /* Register numbers of various important registers.  */
 enum aarch64_regnum
 {
index 1fce0798e24e162d7c456d7b881b298334ff0fbc..daec0a7bcd31944679b87fb4c3775dedc15dfd21 100644 (file)
@@ -114,7 +114,7 @@ aarch64*-*-freebsd*)
 
 aarch64*-*-linux*)
        # Target: AArch64 linux
-       gdb_target_obs="aarch64-linux-tdep.o \
+       gdb_target_obs="aarch64-linux-tdep.o arch/aarch64.o\
                        arch/arm.o arch/arm-linux.o arch/arm-get-next-pcs.o \
                        arm-tdep.o arm-linux-tdep.o \
                        glibc-tdep.o linux-tdep.o solib-svr4.o \