From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72820 invoked by alias); 12 Oct 2017 01:29:07 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 72811 invoked by uid 89); 12 Oct 2017 01:29:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:clients X-HELO: mail-wm0-f66.google.com Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 12 Oct 2017 01:29:04 +0000 Received: by mail-wm0-f66.google.com with SMTP id q124so3082035wmb.5 for ; Wed, 11 Oct 2017 18:29:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=XCsU5AB6IBrdq+SGa4NUBRCKOCzh9+APfRsY95r91+0=; b=hB1DL1W7qqQFwyrPPwqlvnsPQzR/Re3e7lDgOQzanClOVt+tdHyloLHMvKsUp8ICad 2WEkJmX3pM8Y8MSVFzImlt+dwVNkJzoZotV4tB2pquvxYypRIW3xOB5o82+uS7E6GcCe 0p21/GrXpsL0Hv8vnsQg9IQbNxbM9alAnJ05SDGpwG5BoViVuN5xmvzc18tgNUkCu5wC OEzjoArpi0IrtdcVGFf6ikNdHM/A3ohBlspE655j6ZDgh/ZT4a9Oaxlc8J3podr7Dib5 AsM8S3sM+aUP//qrPPDj+5qyhECDkibApfiitPD5eK5upCtlJbfv45Rg1nZ2HamuSYsT sQfw== X-Gm-Message-State: AMCzsaXa22e5dv4Mro8IGT0eSmrhTmI7Vq0po4h5UiqH3lX7oWEPGRTy W8SUELeiu51BAscXEYQndHo= X-Google-Smtp-Source: AOwi7QCS6epqQOS9DivmpGavJNIM+5U+UlJuyYaPCWfXmFiTNlUez6YyskmwNoiIFjqIqGjw44N1uA== X-Received: by 10.223.176.199 with SMTP id j7mr633943wra.58.1507771742147; Wed, 11 Oct 2017 18:29:02 -0700 (PDT) Received: from 1170ee0b50d5 (static.42.136.251.148.clients.your-server.de. [148.251.136.42]) by smtp.gmail.com with ESMTPSA id p128sm24080349wmb.1.2017.10.11.18.29.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Oct 2017 18:29:01 -0700 (PDT) Date: Thu, 12 Oct 2017 01:29:00 -0000 From: Yao Qi To: Anton Kolesov Cc: gdb-patches@sourceware.org, Francois Bedard Subject: Re: [PATCH 1/3] arc: Add XML target descriptions for Linux targets Message-ID: <20171012012859.GJ8425@1170ee0b50d5> References: <20171011145633.19343-1-Anton.Kolesov@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171011145633.19343-1-Anton.Kolesov@synopsys.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00307.txt.bz2 On 17-10-11 17:56:31, Anton Kolesov wrote: > Add XML target descriptions for Linux targets. Compared to default Hi, I am converting existing GDB target descriptions in a more flexible way to organize them. I've done the x86 target descriptions, and slowly converting tic6x and nios2 target descriptions. Could you please convert existing arc target descriptions first? It is definitely helpful to simplify this patch. I had a talk about my work in Cauldron. https://slideslive.com/38902354/a-flexible-gdb-target-description-for-processor-diversity If you want to convert existing arc target descriptions, I am happy to share some steps to do that. > Linux descriptions: > > - Explicitly specify CPU machine. > - Remove baremetal only ILINK{,1,2} registers. > - Add LP_START and LP_END registers for hardware loops - required to properly > evaluate possible next instruction during software single instruction > stepping. > - Add BTA register which contains branch target address - address of next > instruction when processor is in the delay slot. > - ARC HS description also adds R30, R58 and R59 registers, specific to this > architecture. IMO, it is not a good practise to linux and non-linux target descriptions have target features of the same name, but same target features have trivial differences, as you described above. The common practise we did is to define each target feature xml file, and use xi:include to "include" each target feature into target description. All existing target descriptions follow this approach. > > gdb/ChangeLog: > yyyy-mm-dd Anton Kolesov > > * arc-tdep (arc_tdesc_init): Use tdesc_arc_arcompact_linux and > tdesc_arc_v2_linux. > (_initialize_arc_tdep): Invoke initialize_tdesc_arc_v2_linux and > initialize_tdesc_arc_arcompact_linux. > * features/Makefile: Add targets to generate new files. > * features/arc-arcompact-linux.xml: New file. > * features/arc-v2-linux.xml: Likewise. > * features/arc-arcompact-linux.c: Generate. > * features/arc-v2-linux.c: Likewise. > * regformats/arc-arcompact-linux.dat: Likewise. > * regformats/arc-v2-linux.dat: Likewise. > --- > gdb/arc-tdep.c | 17 ++++++- > gdb/features/Makefile | 5 ++ > gdb/features/arc-arcompact-linux.c | 76 ++++++++++++++++++++++++++++ > gdb/features/arc-arcompact-linux.xml | 84 +++++++++++++++++++++++++++++++ > gdb/features/arc-v2-linux.c | 83 +++++++++++++++++++++++++++++++ > gdb/features/arc-v2-linux.xml | 91 ++++++++++++++++++++++++++++++++++ > gdb/regformats/arc-arcompact-linux.dat | 42 ++++++++++++++++ > gdb/regformats/arc-v2-linux.dat | 45 +++++++++++++++++ > 8 files changed, 441 insertions(+), 2 deletions(-) > create mode 100644 gdb/features/arc-arcompact-linux.c > create mode 100644 gdb/features/arc-arcompact-linux.xml > create mode 100644 gdb/features/arc-v2-linux.c > create mode 100644 gdb/features/arc-v2-linux.xml > create mode 100644 gdb/regformats/arc-arcompact-linux.dat > create mode 100644 gdb/regformats/arc-v2-linux.dat > > diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c > index 771d6df..a825917 100644 > --- a/gdb/arc-tdep.c > +++ b/gdb/arc-tdep.c > @@ -42,6 +42,8 @@ > /* Default target descriptions. */ > #include "features/arc-v2.c" > #include "features/arc-arcompact.c" > +#include "features/arc-v2-linux.c" > +#include "features/arc-arcompact-linux.c" > > /* The frame unwind cache for ARC. */ > > @@ -1799,13 +1801,22 @@ arc_tdesc_init (struct gdbarch_info info, const struct target_desc **tdesc, > { > if (is_arcv2) > { > - tdesc_loc = tdesc_arc_v2; > + /* Usually Linux-specific target description would be provided by > + the gdbserver, but it has to be selected manually when debugging > + core files. */ You need to implement gdbarch method core_read_description in arc-linux-tdep.c to return the right linux target description. It doesn't make much sense to pull in linux target description into arc-tdep.c. > + if (info.osabi == GDB_OSABI_LINUX) > + tdesc_loc = tdesc_arc_v2_linux; > + else > + tdesc_loc = tdesc_arc_v2; > if (arc_debug) > debug_printf ("arc: Using default register set for ARC v2.\n"); > } > else > { > - tdesc_loc = tdesc_arc_arcompact; > + if (info.osabi == GDB_OSABI_LINUX) > + tdesc_loc = tdesc_arc_arcompact_linux; > + else > + tdesc_loc = tdesc_arc_arcompact; > if (arc_debug) > debug_printf ("arc: Using default register set for ARCompact.\n"); > } > @@ -2172,6 +2183,8 @@ _initialize_arc_tdep (void) > > initialize_tdesc_arc_v2 (); > initialize_tdesc_arc_arcompact (); > + initialize_tdesc_arc_v2_linux (); > + initialize_tdesc_arc_arcompact_linux (); > > /* Register ARC-specific commands with gdb. */ > > diff --git a/gdb/features/Makefile b/gdb/features/Makefile > index 8a7f377..8d5e3d3 100644 > --- a/gdb/features/Makefile > +++ b/gdb/features/Makefile > @@ -44,6 +44,7 @@ > # make GDB=/path/to/gdb XMLTOC="xml files" cfiles > > WHICH = aarch64 \ > + arc-v2-linux arc-arcompact-linux \ WHICH is used to generate *.dat file from *.xml file. *.dat files are used to generate *.c files for GDBserver. We don't have arc-linux GDBserver support in this patch, don't need to include this change. This change can be included in your GDBserver support patches, if you have. > arm/arm-with-iwmmxt arm/arm-with-vfpv2 arm/arm-with-vfpv3 \ > arm/arm-with-neon \ > i386/i386 i386/i386-linux \ > @@ -84,6 +85,8 @@ WHICH = aarch64 \ > > # Record which registers should be sent to GDB by default after stop. > aarch64-expedite = x29,sp,pc > +arc-v2-linux-expedite = sp,pc > +arc-arcompact-linux-expedite = sp,pc Again, this is used by GDBserver, don't need this change now. Also, gdb/features/Makefile have something magic that you only need to define a generic one, arc-expedite = sp,pc. -- Yao (齐尧)