From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 33013 invoked by alias); 7 May 2018 16:23:46 -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 32993 invoked by uid 89); 7 May 2018 16:23:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-20.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY autolearn=ham version=3.3.2 spammy=party, Max X-HELO: mail-yb0-f170.google.com Received: from mail-yb0-f170.google.com (HELO mail-yb0-f170.google.com) (209.85.213.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 May 2018 16:23:44 +0000 Received: by mail-yb0-f170.google.com with SMTP id v12-v6so1153465ybl.10 for ; Mon, 07 May 2018 09:23:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ga0hZNkrBlZZQhaAf5pV58KilGsjPPPfe+f2DnYGG2w=; b=Ozgf/526xLr6HENN1Ig5ksZIumsZKQeO3YUVUJ7TS0UZCgvwOLvHTTmBTzJrkB/Kjf JuNc8nImX7YFNUB6Xn92PdFqjvL40v52rS2qSbsLvGY1mW23V+0QLVdO18LjF0gcXFWC rhPCyxBnWPYG450lPdZIQIMIlxSQcAi9j8XZdODltUYXqBuGKofvRfldfX+IA9LjbYmi 0T7JwbB2fS+0q223DVjBlnb2zeX8IbCt4lXhyxUNypDYy0HCxDwpNTap6QHpDzYmwU0v czmnq1Y+mQxPTy8k5phjcISrdR5TZC+CyDyp8NfgRhmbv5/rw5z3B3p2D/1EV3Ly2RN1 W3sQ== X-Gm-Message-State: ALQs6tCw6IITtXMdAMtukeu9LKNeYWVz8ZrqfZl0b42q/gcLE1jg3V07 87sr76H4cxGiSq4DSkwwahz1wuT6GSLmynNkAE8lJA== X-Google-Smtp-Source: AB8JxZrmWnV/orqf1YGkq7uKoiINeLsjdk2iby59chAJM+evP4YLdcQu7+hHXU1vCw7OO2N2TIJyWKHlH+1OIo4iQrg= X-Received: by 2002:a25:a261:: with SMTP id b88-v6mr22783387ybi.239.1525710222289; Mon, 07 May 2018 09:23:42 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:3752:0:0:0:0:0 with HTTP; Mon, 7 May 2018 09:23:41 -0700 (PDT) In-Reply-To: <20180426024154.5913-1-jcmvbkbc@gmail.com> References: <20180426024154.5913-1-jcmvbkbc@gmail.com> From: Max Filippov Date: Mon, 07 May 2018 16:23:00 -0000 Message-ID: Subject: Re: [PATCH] gdb: xtensa: handle privileged registers To: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2018-05/txt/msg00171.txt.bz2 On Wed, Apr 25, 2018 at 7:41 PM, Max Filippov wrote: > gdb/ > 2018-04-25 Max Filippov > > * xtensa-linux-tdep.c (xtensa-tdep.h): New include. > (xtensa_linux_init_abi): Limit tdep->num_regs by > tdep->num_nopriv_regs. > * xtensa-tdep.c (xtensa_derive_tdep): Calculate > tdep->num_nopriv_regs and only copy it to tdep->num_regs if it's > not initialized. > --- > gdb/xtensa-linux-tdep.c | 6 ++++++ > gdb/xtensa-tdep.c | 12 ++++-------- > 2 files changed, 10 insertions(+), 8 deletions(-) Ping? The fix was verified by the reporting party ( https://github.com/zephyrproject-rtos/zephyr/issues/4309#issuecomment-387017968 ) If there are no objections I'd like to commit it. > diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c > index a9b30c73f7bf..b62085de2fcb 100644 > --- a/gdb/xtensa-linux-tdep.c > +++ b/gdb/xtensa-linux-tdep.c > @@ -18,6 +18,7 @@ > along with this program. If not, see . */ > > #include "defs.h" > +#include "xtensa-tdep.h" > #include "osabi.h" > #include "linux-tdep.h" > #include "solib-svr4.h" > @@ -97,6 +98,11 @@ xtensa_linux_gdb_signal_to_target (struct gdbarch *gdbarch, > static void > xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) > { > + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > + > + if (tdep->num_nopriv_regs < tdep->num_regs) > + tdep->num_regs = tdep->num_nopriv_regs; > + > linux_init_abi (info, gdbarch); > > set_solib_svr4_fetch_link_map_offsets > diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c > index a1ecf5f56a42..01f96165dc8d 100644 > --- a/gdb/xtensa-tdep.c > +++ b/gdb/xtensa-tdep.c > @@ -3145,16 +3145,12 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep) > max_size = rmap->byte_size; > if (rmap->mask != 0 && tdep->num_regs == 0) > tdep->num_regs = n; > - /* Find out out how to deal with priveleged registers. > - > - if ((rmap->flags & XTENSA_REGISTER_FLAGS_PRIVILEGED) != 0 > - && tdep->num_nopriv_regs == 0) > - tdep->num_nopriv_regs = n; > - */ > if ((rmap->flags & XTENSA_REGISTER_FLAGS_PRIVILEGED) != 0 > - && tdep->num_regs == 0) > - tdep->num_regs = n; > + && tdep->num_nopriv_regs == 0) > + tdep->num_nopriv_regs = n; > } > + if (tdep->num_regs == 0) > + tdep->num_regs = tdep->num_nopriv_regs; > > /* Number of pseudo registers. */ > tdep->num_pseudo_regs = n - tdep->num_regs; > -- > 2.11.0 > -- Thanks. -- Max