Add xml selftests for aarch64 target description.
authorAlan Hayward <alan.hayward@arm.com>
Fri, 24 Nov 2017 10:28:58 +0000 (10:28 +0000)
committerAlan Hayward <alan.hayward@arm.com>
Fri, 24 Nov 2017 11:18:19 +0000 (11:18 +0000)
gdb/
* aarch64-tdep.c (_initialize_aarch64_tdep): Add target desc
selftest.

gdbserver/
* configure.srv: Add linux-aarch64-tdesc-selftest.o.
* linux-aarch64-low.c (initialize_low_arch): Call init func.
* linux-aarch64-tdesc-selftest.c: New file.
* linux-aarch64-tdesc.h (initialize_low_tdesc): New declaration.

gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/gdbserver/ChangeLog
gdb/gdbserver/configure.srv
gdb/gdbserver/linux-aarch64-low.c
gdb/gdbserver/linux-aarch64-tdesc-selftest.c [new file with mode: 0644]
gdb/gdbserver/linux-aarch64-tdesc.h

index 4cf7853cad75f560c6573f8637bcfe6b71c43718..a982caab68b7eb556d47e3aae18efbcd30d401ca 100644 (file)
@@ -1,3 +1,8 @@
+2017-11-24  Alan Hayward  <alan.hayward@arm.com>
+
+       * aarch64-tdep.c (_initialize_aarch64_tdep): Add target desc
+       selftest.
+
 2017-11-24  Alan Hayward  <alan.hayward@arm.com>
 
        * aarch64-tdep.c (_initialize_aarch64_tdep): Remove init.
index 61023dd3bb946c2bfbfbc1b88e986030107acd26..6a0d4b744c89c39d5b62b7dcc12273fccb0c32e6 100644 (file)
@@ -3069,6 +3069,8 @@ When on, AArch64 specific debugging is enabled."),
                            selftests::aarch64_analyze_prologue_test);
   selftests::register_test ("aarch64-process-record",
                            selftests::aarch64_process_record_test);
+  selftests::record_xml_tdesc ("aarch64.xml",
+                              aarch64_create_target_description ());
 #endif
 }
 
index 5f7e59d11d882894ae6c199ad51b389764b9fa79..2e6fb9e6d42242e5135e6406c43f26d928ed383a 100644 (file)
@@ -1,3 +1,17 @@
+2017-11-24  Alan Hayward  <alan.hayward@arm.com>
+
+       * configure.srv: Add linux-aarch64-tdesc-selftest.o.
+       * linux-aarch64-low.c (initialize_low_arch): Call init func.
+       * linux-aarch64-tdesc-selftest.c: New file.
+       * linux-aarch64-tdesc.h (initialize_low_tdesc): New declaration.
+
+2017-11-24  Alan Hayward  <alan.hayward@arm.com>
+
+       * configure.srv: Add new file.
+       * linux-aarch64-low.c (initialize_low_arch): Call init func.
+       * linux-aarch64-tdesc-selftest.c: New file.
+       * linux-aarch64-tdesc.h (initialize_low_tdesc): New declaration.
+
 2017-11-24  Alan Hayward  <alan.hayward@arm.com>
 
        * linux-aarch64-ipa.c (initialize_low_tracepoint): Remove init.
index 14967ff52496e61438b49b00ec649c614cf5594d..087fd31426bc738fdae91dde4bd4d575d8b26224 100644 (file)
@@ -53,6 +53,7 @@ case "${target}" in
                        srv_regobj="arm-with-neon.o"
                        if $development; then
                          srv_regobj="${srv_regobj} aarch64.o"
+                         srv_regobj="${srv_regobj} linux-aarch64-tdesc-selftest.o"
                         fi
                        srv_tgtobj="linux-aarch64-low.o aarch64-linux-hw-point.o"
                        srv_tgtobj="$srv_tgtobj linux-aarch32-low.o"
index 9682537728847850d824c7eac949c68ab09226ac..243d1e0bbf3d31819136b0867953733379c9c437 100644 (file)
@@ -2998,4 +2998,8 @@ initialize_low_arch (void)
   initialize_low_arch_aarch32 ();
 
   initialize_regsets_info (&aarch64_regsets_info);
+
+#if GDB_SELF_TEST
+  initialize_low_tdesc ();
+#endif
 }
diff --git a/gdb/gdbserver/linux-aarch64-tdesc-selftest.c b/gdb/gdbserver/linux-aarch64-tdesc-selftest.c
new file mode 100644 (file)
index 0000000..11284b0
--- /dev/null
@@ -0,0 +1,45 @@
+/* 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 "server.h"
+#include "tdesc.h"
+#include "common/selftest.h"
+#include "linux-aarch64-tdesc.h"
+
+/* Defined in auto-generated file features/aarch64.c.  */
+void init_registers_aarch64 (void);
+extern const struct target_desc *tdesc_aarch64;
+
+namespace selftests {
+namespace tdesc {
+static void
+aarch64_tdesc_test ()
+{
+  const target_desc *tdesc = aarch64_linux_read_description ();
+  SELF_CHECK (*tdesc == *tdesc_aarch64);
+}
+}
+} // namespace selftests
+
+void
+initialize_low_tdesc ()
+{
+  init_registers_aarch64 ();
+
+  selftests::register_test ("aarch64-tdesc",
+                           selftests::tdesc::aarch64_tdesc_test);
+}
index 6d6731720c3b4123d16f179acc5087ffd2d9b454..2dd969f5f0abcbe5b7aee56ec1a9319a7755dc62 100644 (file)
@@ -18,3 +18,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 const target_desc * aarch64_linux_read_description ();
+
+#if GDB_SELF_TEST
+void initialize_low_tdesc ();
+#endif