From patchwork Thu Nov 23 16:29:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 24475 Received: (qmail 28756 invoked by alias); 23 Nov 2017 16:29:07 -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 28533 invoked by uid 89); 23 Nov 2017 16:29:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LOTSOFHASH, KAM_SHORT, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-HE1-obe.outbound.protection.outlook.com Received: from mail-he1eur01on0064.outbound.protection.outlook.com (HELO EUR01-HE1-obe.outbound.protection.outlook.com) (104.47.0.64) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 23 Nov 2017 16:29:05 +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.260.4; Thu, 23 Nov 2017 16:29:01 +0000 Received: from AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::48ab:82cd:a8b8:3a84]) by AM3PR08MB0101.eurprd08.prod.outlook.com ([fe80::48ab:82cd:a8b8:3a84%13]) with mapi id 15.20.0260.004; Thu, 23 Nov 2017 16:29:01 +0000 From: Alan Hayward To: Yao Qi CC: "gdb-patches@sourceware.org" , nd Subject: Re: [PATCH 4/4] Add xml selftests Date: Thu, 23 Nov 2017 16:29:01 +0000 Message-ID: <8E1DED12-D169-49CD-A9A3-388280EBDB60@arm.com> References: <86h8ugyenj.fsf@gmail.com> <8EE70574-8937-414B-9903-0E427D388B07@arm.com> <86a7zzwrs5.fsf@gmail.com> <86zi7eqps4.fsf@gmail.com> <86shd6qp5w.fsf@gmail.com> In-Reply-To: <86shd6qp5w.fsf@gmail.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:KKUEeapOBrfz25JBf+dqZy1Z4Pkhqaf5YkxaaaZ1It+U4rYpCR2HxWj+6IaglHinp5Ntyg7pLw/2F3cOuJJs6oPXZSKyF/SyLvBQvoHhKWePCqnynhF+vC6r9NXS7lX9ZbztBJnVqoUHpqcwplpglpZ+XbfelidAtMsCyctEb0RHLPE0ClSLBbFhsaLsbvfl0tUqrcMism7/rUPIgeO/yeNi+LTjk2nbs7vcsDPuRNs7w1JK7+Dpq/jT30pWl3gy2wQj+g22F21Se5FSKOSho5sMOsu9DSXx07B9E3m1saN+ZD1/3SuSgT+QMPNdeVduN0A3KfUaOmJZ33MkzNqR0QY3D/zgDP4v5l2v0Hznsg0=; 5:16dnrxu2kznMnvXkrFTwhiLs5KQBGqz4ZFLNINJCFkcYmZm1++b8z5pUTRb7o4gzsvA+dpF+5UNmrFO3f/isH9n9f2zVPqSHGMGLbtW51+6TL7UOuc0nJoaje1QTQ0PaGKR+xlfBvoD0M6xBRPDccxjZntDtRFEx2L+6CnmN6aA=; 24:qmi1OluDog2IXtK2dV5Z4Bkqx30gKRAt8fAQEInMOADY/wfamdGU/Pmr2h1bBGCK3kKm09urXdeG9oTYiysz0H7Rzmqjv3JCa9eSAaTQc4w=; 7:OScpJfypGsXssgcmgWNHlJckN2y1bC5YvOtse5mgHgueNeyU9wr95D0fhr/nRonGzI6Ylpv9zVIBEFa+RamAp0c9m9iHwq3iWAmJj74dgKsYWtFkpugpPDFY9qLurVdW8UgEApG9Xd8ryD8eJ3h+xxM0acz2vA9Yq8lsiY5aNOe3yTSaRZE4elKOs3aj7XXEwn/sxxMaX2xxSYjeKFebcW6qPJ8n0rFkKFcNdZZafrSJ/fW4OW53iQLPZUL3gBlo x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 90ba94c1-00cc-4695-4076-08d5328f4e16 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600025)(4604075)(2017052603199); SRVR:AM3PR08MB0103; x-ms-traffictypediagnostic: AM3PR08MB0103: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(250305191791016)(180628864354917)(22074186197030); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3231022)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123562025)(20161123558100)(20161123555025)(20161123560025)(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: 05009853EF x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(6009001)(366004)(39860400002)(346002)(376002)(377424004)(24454002)(189002)(199003)(305945005)(54906003)(53546010)(14454004)(4326008)(2950100002)(1411001)(6916009)(39060400002)(6512007)(53936002)(189998001)(6306002)(5250100002)(3280700002)(93886005)(8936002)(72206003)(2906002)(2900100001)(36756003)(478600001)(81166006)(81156014)(8676002)(7736002)(3660700001)(99286004)(5660300001)(106356001)(575784001)(86362001)(4001150100001)(101416001)(229853002)(105586002)(66066001)(3846002)(102836003)(6116002)(97736004)(82746002)(6246003)(83716003)(68736007)(33656002)(6486002)(76176999)(6436002)(25786009)(6506006)(54356999)(316002)(50986999)(2004002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR08MB0103; H:AM3PR08MB0101.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-ID: <9AE3FF2302F7074CB543A7B669A6B383@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90ba94c1-00cc-4695-4076-08d5328f4e16 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Nov 2017 16:29:01.3805 (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 > On 22 Nov 2017, at 16:00, Yao Qi wrote: > > > Hi Alan, > When you post the new version of patches, could you post the whole > series in the same email thread? These four patches are not in the same > thread, so I have to go through my inbox to find them one by one. > Will do for future patches. Reposting 4/4 (nothing has changed since original post, except for a rebase): 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-11-23 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 61023dd3bb946c2bfbfbc1b88e986030107acd26..6a0d4b744c89c39d5b62b7dcc12273fccb0c32e6 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/configure.srv b/gdb/gdbserver/configure.srv index 0136ec326c916b0f35e49bf1500876e4cb80ce1f..3171b9791cafff80458a0648df58fed913f20d03 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 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 6d6731720c3b4123d16f179acc5087ffd2d9b454..2dd969f5f0abcbe5b7aee56ec1a9319a7755dc62 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