From patchwork Mon Nov 20 15:37:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 24367 Received: (qmail 59355 invoked by alias); 20 Nov 2017 15:37:55 -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 59345 invoked by uid 89); 20 Nov 2017 15:37:55 -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, MIME_BASE64_BLANKS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-ve1eur01on0073.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (104.47.1.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 Nov 2017 15:37:52 +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.239.5; Mon, 20 Nov 2017 15:37:48 +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.0239.009; Mon, 20 Nov 2017 15:37:48 +0000 From: Alan Hayward To: Yao Qi CC: "gdb-patches@sourceware.org" , nd Subject: Re: [PATCH 2/4] gdbserver use aarch64_create_target_description Date: Mon, 20 Nov 2017 15:37:48 +0000 Message-ID: <6B24A0B2-B91D-4AE0-AAA3-158325FBC649@arm.com> References: <48281E67-64B6-4558-9790-CB4189187124@arm.com> <86po94ygg5.fsf@gmail.com> <83AC8291-7A68-4FC3-B1B4-9CA45EAA4E4F@arm.com> <86efpbwuuj.fsf@gmail.com> In-Reply-To: <86efpbwuuj.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:NaF1PxwKLIpwS9GHRXNiGjQWMzAOzLwRP2Gvcb5YLWelCbuJSjG8eCz1/yWrSgyDUyYZHbjR8vS050VexO+lXNub03CNOCea/pAKyrTqBB51kFeDGnPLYm09DpvPp4y4sOHRa25wwNiPOtOjiaNCaU45QsPlN5b3sWfCKO9vrckChL8hkrPlKcdFeCCg02zZvu2C7poPh2heX7YqiGQ0Fo073ToUDKu52uqJ8vYK6g0PVTvdMinRgcrVAhvLREmQP7mIge5sZf/TKYRYgJUxIDxE816gazyc0A0/TmqWnU/bAQC1EkVDwpzqN0f+QbBCiSteL/nxF7hXRPGeiG9qX0P+UIAUh/6KFtxw2OM2sJ4=; 5:VR5Iv5/HYJHbTBX+ISL2hQxkO4dk60CZ5NyCnR7ucpT9o3YazRxn/KWIbJULk4eknqZDLJYZxaigpmWuq3A/At8UCMDsmD4fWOogUFvhHtoaC+g8E86KCXUTgNpop8mStdp/S44mmGTEq5RuF3lcpgA2sogrxYAw659kaMGOw5E=; 24:WcVuI/Ah115Lxw2jyFSPfWBWp536SLfyE/KxMHAxvutktqR4wjzM+Q8uo4R0a1/i+QDMZ+dlViLH3wqytGQ+LTlWTZ0FEBDE0mkb/kwWH/w=; 7:oWLrABWa2rfETuBYZ/vav7gneNAgJsfpr1EciyhHdK0rB1uJ9VybImF9nY6Thz0zMiNYP0ZklG5Ce5aOUEORGUmgRh7zkQ3qqmDu5nDWZ2K1oM1CC2HW/aPlfnxcHJlpyvonSYmwI32I8ozloXUsw5Bhnxas4jWuwR7CcxjjM7cjzzycSXFvyPqPgIxzQ8WVy/B4Qp4/3tO6GqTaBPnC1Wo5z8jqDlv6uG0RMAoCagL3g2XF+yflOkXTEEO9fPiF x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 47096217-d0d0-4cc9-f940-08d5302ca750 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603199); SRVR:AM3PR08MB0103; x-ms-traffictypediagnostic: AM3PR08MB0103: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(250305191791016)(158342451672863)(180628864354917)(22074186197030); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3231022)(3002001)(10201501046)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123564025)(20161123562025)(20161123560025)(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: 04976078F0 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(346002)(376002)(199003)(24454002)(377424004)(189002)(39060400002)(6116002)(102836003)(105586002)(66066001)(106356001)(4326008)(97736004)(50986999)(6512007)(14454004)(82746002)(6306002)(575784001)(1411001)(86362001)(53546010)(33656002)(101416001)(76176999)(6246003)(53936002)(54356999)(189998001)(6436002)(68736007)(72206003)(36756003)(478600001)(229853002)(6486002)(2906002)(6916009)(2950100002)(5660300001)(25786009)(3280700002)(3660700001)(99286004)(3846002)(15760500003)(6506006)(81166006)(81156014)(8676002)(54906003)(2900100001)(7736002)(305945005)(93886005)(83716003)(4001150100001)(5250100002)(316002)(8936002)(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: <8D55F67E2580CF4691C4A38445D7FF27@eurprd08.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 47096217-d0d0-4cc9-f940-08d5302ca750 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Nov 2017 15:37:48.4557 (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 6 Nov 2017, at 10:43, Yao Qi wrote: > > Alan Hayward writes: > >> +%-arch-ipa.o: ../arch/%.c >> + $(IPAGENT_COMPILE) $< >> + $(POSTCOMPILE) > > Can we change it to "arch/%-ipa.o: ../arch/%.c"? because non-IPA version > of objects are compiled to arch/ directory, so it is better to move IPA > version of objects to arch directory too. Can you write a separate > patch to add this rule and build x86 ipa.o in arch/ directory? > …With the above change moved into another patch and committed, That leaves this patch as: 2017-11-20 Alan Hayward gdbserver/ * configure.srv: Add new files. * linux-aarch64-ipa.c (get_ipa_tdesc): Call aarch64_linux_read_description. * linux-aarch64-low.c (aarch64_linux_read_description): Merge with aarch64_arch_setup. (aarch64_arch_setup): Call aarch64_linux_read_description. * linux-aarch64-tdesc.c: New file. * linux-aarch64-tdesc.h: New file. diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv index 82c3dc237c3fb6baeb2a72cd9ed66d8c7556d72a..062df1b0e241097b0c9f4e0f5b4b534f42dc4457 100644 --- a/gdb/gdbserver/configure.srv +++ b/gdb/gdbserver/configure.srv @@ -27,9 +27,11 @@ 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" else srv_i386_linux_regobj="" srv_amd64_linux_regobj="" + srv_aarch64_linux_regobj="" fi ipa_ppc_linux_regobj="powerpc-32l-ipa.o powerpc-altivec32l-ipa.o powerpc-cell32l-ipa.o powerpc-vsx32l-ipa.o powerpc-isa205-32l-ipa.o powerpc-isa205-altivec32l-ipa.o powerpc-isa205-vsx32l-ipa.o powerpc-e500l-ipa.o powerpc-64l-ipa.o powerpc-altivec64l-ipa.o powerpc-cell64l-ipa.o powerpc-vsx64l-ipa.o powerpc-isa205-64l-ipa.o powerpc-isa205-altivec64l-ipa.o powerpc-isa205-vsx64l-ipa.o" @@ -50,13 +52,15 @@ srv_linux_obj="linux-low.o linux-osdata.o linux-procfs.o linux-ptrace.o linux-wa case "${target}" in aarch64*-*-linux*) - srv_regobj="aarch64.o" + srv_regobj="$srv_aarch64_linux_regobj" srv_regobj="${srv_regobj} arm-with-neon.o" srv_tgtobj="linux-aarch64-low.o aarch64-linux-hw-point.o" srv_tgtobj="$srv_tgtobj linux-aarch32-low.o" srv_tgtobj="${srv_tgtobj} arch/arm.o" srv_tgtobj="$srv_tgtobj aarch64-linux.o" srv_tgtobj="$srv_tgtobj arch/aarch64-insn.o" + srv_tgtobj="$srv_tgtobj arch/aarch64.o" + srv_tgtobj="$srv_tgtobj linux-aarch64-tdesc.o" srv_tgtobj="${srv_tgtobj} $srv_linux_obj" srv_xmlfiles="aarch64.xml" srv_xmlfiles="${srv_xmlfiles} aarch64-core.xml" @@ -65,7 +69,9 @@ case "${target}" in srv_xmlfiles="${srv_xmlfiles} arm/arm-with-neon.xml" srv_linux_regsets=yes srv_linux_thread_db=yes - ipa_obj="linux-aarch64-ipa.o aarch64-ipa.o" + ipa_obj="linux-aarch64-ipa.o" + ipa_obj="${ipa_obj} linux-aarch64-tdesc-ipa.o" + ipa_obj="${ipa_obj} arch/aarch64-ipa.o" ;; arm*-*-linux*) srv_regobj="reg-arm.o arm-with-iwmmxt.o" srv_regobj="${srv_regobj} arm-with-vfpv2.o" diff --git a/gdb/gdbserver/linux-aarch64-ipa.c b/gdb/gdbserver/linux-aarch64-ipa.c index ad1059029bb669f4fd6240d8ce8aef126879b6ff..28dc9776a1c8d273e8bc749296a57bc62b8619d5 100644 --- a/gdb/gdbserver/linux-aarch64-ipa.c +++ b/gdb/gdbserver/linux-aarch64-ipa.c @@ -25,10 +25,10 @@ #ifdef HAVE_GETAUXVAL #include #endif +#include "linux-aarch64-tdesc.h" /* Defined in auto-generated file aarch64.c. */ void init_registers_aarch64 (void); -extern const struct target_desc *tdesc_aarch64; /* Each register saved by the jump pad is in a 16 byte cell. */ #define FT_CR_SIZE 16 @@ -155,7 +155,7 @@ get_raw_reg (const unsigned char *raw_regs, int regnum) const struct target_desc * get_ipa_tdesc (int idx) { - return tdesc_aarch64; + return aarch64_linux_read_description (); } /* Allocate buffer for the jump pads. The branch instruction has a reach diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index b00d5c502d2be67daf0e7f48025647f191efef3b..dcce287974cb6afd2f530ce1257dbbf25ed25ddc 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -39,10 +39,10 @@ #include "gdb_proc_service.h" #include "arch/aarch64.h" +#include "linux-aarch64-tdesc.h" /* Defined in auto-generated files. */ void init_registers_aarch64 (void); -extern const struct target_desc *tdesc_aarch64; #ifdef HAVE_SYS_REG_H #include @@ -467,11 +467,10 @@ aarch64_linux_new_fork (struct process_info *parent, *child->priv->arch_private = *parent->priv->arch_private; } -/* Return the right target description according to the ELF file of - current thread. */ +/* Implementation of linux_target_ops method "arch_setup". */ -static const struct target_desc * -aarch64_linux_read_description (void) +static void +aarch64_arch_setup (void) { unsigned int machine; int is_elf64; @@ -482,17 +481,9 @@ aarch64_linux_read_description (void) is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine); if (is_elf64) - return tdesc_aarch64; + current_process ()->tdesc = aarch64_linux_read_description (); else - return tdesc_arm_with_neon; -} - -/* Implementation of linux_target_ops method "arch_setup". */ - -static void -aarch64_arch_setup (void) -{ - current_process ()->tdesc = aarch64_linux_read_description (); + current_process ()->tdesc = tdesc_arm_with_neon; aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread)); } diff --git a/gdb/gdbserver/linux-aarch64-tdesc.h b/gdb/gdbserver/linux-aarch64-tdesc.h new file mode 100644 index 0000000000000000000000000000000000000000..6d6731720c3b4123d16f179acc5087ffd2d9b454 --- /dev/null +++ b/gdb/gdbserver/linux-aarch64-tdesc.h @@ -0,0 +1,20 @@ +/* Low level support for aarch64, shared between gdbserver and IPA. + + Copyright (C) 2016-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 . */ + +const target_desc * aarch64_linux_read_description (); diff --git a/gdb/gdbserver/linux-aarch64-tdesc.c b/gdb/gdbserver/linux-aarch64-tdesc.c new file mode 100644 index 0000000000000000000000000000000000000000..8518ef73389ce9d7bd526de75716bd21dbef7959 --- /dev/null +++ b/gdb/gdbserver/linux-aarch64-tdesc.c @@ -0,0 +1,37 @@ +/* GNU/Linux/aarch64 specific target description, for the remote server + for GDB. + 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 "arch/aarch64.h" +#include "linux-aarch32-low.h" + +/* Create the aarch64 target description. */ + +const target_desc * +aarch64_linux_read_description () +{ + static target_desc *aarch64_tdesc = NULL; + target_desc **tdesc = &aarch64_tdesc; + + if (*tdesc == NULL) + *tdesc = aarch64_create_target_description (); + + return *tdesc; +}