Commit Message
This patch adds selftests for the new target descriptors.
Tested on a --enable-targets=all build and aarch64 build with board
files unix, native-gdbserver and unittest.exp.
Alan.
2017-10-25 Alan Hayward <alan.hayward@arm.com>
gdb/
* aarch64-tdep.c: Add target desc selftest.
gdbserver/
* 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.
@@ -3070,6 +3070,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
}
@@ -27,7 +27,7 @@ srv_hostio_err_objs="hostio-errno.o"
if $development; then
srv_i386_linux_regobj="i386-linux.o i386-avx-linux.o i386-avx-avx512-linux.o i386-avx-mpx-avx512-pku-linux.o i386-mpx-linux.o i386-avx-mpx-linux.o i386-mmx-linux.o linux-x86-tdesc-selftest.o"
srv_amd64_linux_regobj="amd64-linux.o amd64-avx-linux.o amd64-avx-avx512-linux.o amd64-avx-mpx-avx512-pku-linux.o amd64-mpx-linux.o amd64-avx-mpx-linux.o x32-linux.o x32-avx-linux.o x32-avx-avx512-linux.o"
- srv_aarch64_linux_regobj="aarch64.o"
+ srv_aarch64_linux_regobj="aarch64.o linux-aarch64-tdesc-selftest.o"
else
srv_i386_linux_regobj=""
srv_amd64_linux_regobj=""
@@ -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
}
new file mode 100644
@@ -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);
+}
@@ -18,3 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
const struct target_desc * aarch64_linux_read_description ();
+
+#if GDB_SELF_TEST
+void initialize_low_tdesc ();
+#endif