From patchwork Wed Oct 25 08:30:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 23802 Received: (qmail 52673 invoked by alias); 25 Oct 2017 08:31:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 45105 invoked by uid 89); 25 Oct 2017 08:30:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-DB5-obe.outbound.protection.outlook.com Received: from mail-db5eur01on0055.outbound.protection.outlook.com (HELO EUR01-DB5-obe.outbound.protection.outlook.com) (104.47.2.55) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 25 Oct 2017 08:30:50 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com (10.160.211.19) by AM3PR08MB0103.eurprd08.prod.outlook.com (10.160.211.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.156.4; Wed, 25 Oct 2017 08:30:32 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::2891:52f2:59:8e54]) by AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::2891:52f2:59:8e54%16]) with mapi id 15.20.0156.007; Wed, 25 Oct 2017 08:30:32 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd Subject: [PATCH 4/4] Add xml selftests Date: Wed, 25 Oct 2017 08:30:32 +0000 Message-ID: <5D4CBA87-0666-4FB9-B7B5-9414C3152C98@arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM3PR08MB0103; 6:Rh23FQmELBdUlFwI6tUQE7gHGjt9wH2dAAXM3pl+3dkmbFG/VdDfuE0MDUMh3S/EvfaSly9aGJdHmv0EmDU4fU3MmvykSUOAZSMerYph3bnrkYl3Oe36l6cEapkZzZd/VHP0Ff65EENuvXQ+0iYKpm6r+1UIsrMlmGbphQOz2kRXrjNal0J3ZntmiQy8R+/BwnR4W6Vg/jWt/fFEh+SY34iwTW49HNOMcPcSfsPFF4JOjIzFQDDBRretyRHV26Jx/l1D233gSlhzJZZADsW/nnI9gcOsg57NbuDWTfWyyOjcc2KhaPuPuK/0tWOfuA7vkPBs2pKMUfv0cQM490tTvw==; 5:kAzosPFffIYUw0yFoJWExOsnpchLpMms/ZWYt+QCe+DVFIHBK7OruPZ4cvOATATWlEgqywfJykYR6qSk0lbUOPpCT0RvZ3pjAcsT9i+7693HObQoHeirt6/DjOrWMQUk/Np8Dzv05wnTDq4WKd0ZWw==; 24:XIlTSnPV6To8DOYNzEFGW0KjYOHmyWVsN8cF9Li06RH6u5gsxOa0MBctzfzD7GFfgK5v+gU9rZNlJEOUaIs9ms/orrFuIw5ISYXwEeiOchs=; 7:x57gxdKvtFph7g5mVwMlQxIBQJFTMiEX3imOybfpBrEn4TRWOVUn2gQdZiEwTswxswjlbwJeu0kZR7nhDlQRHeHPrKuz+XOKMDbEefyMfqCzeloeLx1phUz8UZ59bi32WFnbpGVtnoNidwZG390o1lMB9z2efK9kcYWXjDMzGxI1/RdbX7H+a2ID8+Njla/wGwOpYEWg/SRZsvrJ0hkR3aAbf4tNsFOWEzeDNGHouX4= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 40504742-d03d-41d1-04ee-08d51b82a871 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081)(4534020)(4602075)(4627075)(201703031133081)(201702281549075)(2017052603199); SRVR:AM3PR08MB0103; x-ms-traffictypediagnostic: AM3PR08MB0103: nodisclaimer: True x-exchange-antispam-report-test: UriScan:(250305191791016)(180628864354917)(22074186197030); x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3231020)(3002001)(6055026)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123558100)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM3PR08MB0103; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM3PR08MB0103; x-forefront-prvs: 0471B73328 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(376002)(346002)(39860400002)(377424004)(199003)(189002)(3846002)(82746002)(4326008)(101416001)(575784001)(72206003)(4001150100001)(97736004)(33656002)(7736002)(5660300001)(316002)(86362001)(478600001)(189998001)(68736007)(25786009)(3660700001)(54356999)(2906002)(50986999)(2351001)(3280700002)(6436002)(6486002)(99286003)(6306002)(2900100001)(305945005)(6116002)(36756003)(102836003)(14454004)(6512007)(105586002)(2501003)(83716003)(81156014)(53936002)(66066001)(6506006)(5250100002)(8936002)(106356001)(81166006)(8676002)(5640700003)(6916009)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0103; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 40504742-d03d-41d1-04ee-08d51b82a871 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Oct 2017 08:30:32.6908 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0103 X-IsSubscribed: yes 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 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. diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c index 5d6f455319f3003240239f7977da9f994765f4d3..e99da65af559408158a3276ebfe81c5fa4b389d6 100644 --- a/gdb/aarch64-tdep.c +++ b/gdb/aarch64-tdep.c @@ -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 } diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 08d8e9875a148f931253bed2340498b6d94b9946..9863db0a85c3e0d55314cd0ef0669eba3b51dcca 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -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="" diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index 9682537728847850d824c7eac949c68ab09226ac..243d1e0bbf3d31819136b0867953733379c9c437 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 0000000000000000000000000000000000000000..11284b0b9f5cbef967cfc0ebed6463d2ca9030a5 --- /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 48314e934e0c1163fce400b368a3717a27239be8..7c56b703a057b19dc8c610ac2e49698fd0277d21 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 struct target_desc * aarch64_linux_read_description (); + +#if GDB_SELF_TEST +void initialize_low_tdesc (); +#endif