From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54766 invoked by alias); 22 Oct 2018 02:26:34 -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 54752 invoked by uid 89); 22 Oct 2018 02:26:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=gdbpatches, gdb-patches, pushing X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 22 Oct 2018 02:26:33 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id w9M2QQOD017414 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 21 Oct 2018 22:26:31 -0400 Received: by simark.ca (Postfix, from userid 112) id 860041EA6D; Sun, 21 Oct 2018 22:26:26 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id A58A31E50C; Sun, 21 Oct 2018 22:26:25 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 22 Oct 2018 02:26:00 -0000 From: Simon Marchi To: Kevin Buettner Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Introduce gdbarch_num_cooked_regs In-Reply-To: <20181021142638.31d9889e@pinnacle.lan> References: <20181021190133.10362-1-simon.marchi@polymtl.ca> <20181021142638.31d9889e@pinnacle.lan> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.6 X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00470.txt.bz2 On 2018-10-21 17:26, Kevin Buettner wrote: > Hi Simon, > Hi Kevin, > LGTM, aside from a question and one formatting problem... > >> diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c >> index 1490ee28668a..b6e8f00a0ba1 100644 >> --- a/gdb/m68hc11-tdep.c >> +++ b/gdb/m68hc11-tdep.c >> @@ -854,10 +854,7 @@ m68hc11_frame_unwind_cache (struct frame_info >> *this_frame, >> >> /* Adjust all the saved registers so that they contain addresses >> and not >> offsets. */ >> - for (i = 0; >> - i < gdbarch_num_regs (gdbarch) >> - + gdbarch_num_pseudo_regs (gdbarch) - 1; >> - i++) >> + for (i = 0; i < gdbarch_num_cooked_regs (gdbarch); i++) >> if (trad_frame_addr_p (info->saved_regs, i)) >> { >> info->saved_regs[i].addr += this_base; > > The " - 1" in the original expression was a mistake, right? (I spent > a few minutes looking at the mc68hc11's pseudo register layout but > can't > find a reason for subtracting one.) I don't think I had noticed it, thanks for pointing it out. I took a look too and don't see any reason either. The saved_regs array is allocated with a size equal to the number of cooked registers. I dug up the patch that introduced this code, no comment about it: https://sourceware.org/ml/gdb-patches/2003-07/msg00483.html I'll add a comment about it in the commit log. >> diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c >> index 12382cddb357..9c34a070ae14 100644 >> --- a/gdb/tui/tui-regs.c >> +++ b/gdb/tui/tui-regs.c >> @@ -206,10 +206,7 @@ tui_show_register_group (struct reggroup *group, >> >> /* See how many registers must be displayed. */ >> nr_regs = 0; >> - for (regnum = 0; >> - regnum < gdbarch_num_regs (gdbarch) >> - + gdbarch_num_pseudo_regs (gdbarch); >> - regnum++) >> + for (regnum = 0; regnum < gdbarch_num_cooked_regs (gdbarch); >> regnum++) >> { >> const char *name; >> >> @@ -253,10 +250,7 @@ tui_show_register_group (struct reggroup *group, >> >> /* Now set the register names and values. */ >> pos = 0; >> - for (regnum = 0; >> - regnum < gdbarch_num_regs (gdbarch) >> - + gdbarch_num_pseudo_regs (gdbarch); >> - regnum++) >> + for (regnum = 0;regnum < gdbarch_num_cooked_regs (gdbarch); >> regnum++) > > Missing space between ; and "regnum". Fixed, thanks. I'm pushing the patch with those fixed. Simon