From 6654d750c7c584dd83b93f062c5628f15c675480 Mon Sep 17 00:00:00 2001 From: Alan Hayward Date: Fri, 24 Nov 2017 10:28:58 +0000 Subject: Add xml selftests for aarch64 target description. 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 | 5 ++++ gdb/aarch64-tdep.c | 2 ++ gdb/gdbserver/ChangeLog | 14 +++++++++ gdb/gdbserver/configure.srv | 1 + gdb/gdbserver/linux-aarch64-low.c | 4 +++ gdb/gdbserver/linux-aarch64-tdesc-selftest.c | 45 ++++++++++++++++++++++++++++ gdb/gdbserver/linux-aarch64-tdesc.h | 4 +++ 7 files changed, 75 insertions(+) create mode 100644 gdb/gdbserver/linux-aarch64-tdesc-selftest.c diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4cf7853..a982caa 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2017-11-24 Alan Hayward + * aarch64-tdep.c (_initialize_aarch64_tdep): Add target desc + selftest. + +2017-11-24 Alan Hayward + * aarch64-tdep.c (_initialize_aarch64_tdep): Remove init. * arch/aarch64.c (aarch64_create_target_description): Create new target description. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 61023dd..6a0d4b7 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -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 } diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 5f7e59d..2e6fb9e 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,5 +1,19 @@ 2017-11-24 Alan Hayward + * 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 + + * 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 + * linux-aarch64-ipa.c (initialize_low_tracepoint): Remove init. * linux-aarch64-low.c (initialize_low_arch): Remove init. * linux-aarch64-tdesc.c (aarch64_linux_read_description): Add init. diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 14967ff..087fd31 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -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" diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index 9682537..243d1e0 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -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 index 0000000..11284b0 --- /dev/null +++ b/gdb/gdbserver/linux-aarch64-tdesc-selftest.c @@ -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 . */ + +#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); +} diff --git a/gdb/gdbserver/linux-aarch64-tdesc.h b/gdb/gdbserver/linux-aarch64-tdesc.h index 6d67317..2dd969f 100644 --- a/gdb/gdbserver/linux-aarch64-tdesc.h +++ b/gdb/gdbserver/linux-aarch64-tdesc.h @@ -18,3 +18,7 @@ along with this program. If not, see . */ const target_desc * aarch64_linux_read_description (); + +#if GDB_SELF_TEST +void initialize_low_tdesc (); +#endif -- cgit v1.1