From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3088 invoked by alias); 25 Oct 2011 17:19:07 -0000 Received: (qmail 3076 invoked by uid 22791); 25 Oct 2011 17:19:06 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,TW_EG X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 25 Oct 2011 17:18:50 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RIkeH-0005fV-Gw from pedro_alves@mentor.com ; Tue, 25 Oct 2011 10:18:49 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 25 Oct 2011 18:18:46 +0100 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFA/commit/ia64-linux] Allow libunwind to fetch register 0 Date: Tue, 25 Oct 2011 17:27:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.1; x86_64; ; ) Cc: Joel Brobecker References: <1319561563-20201-1-git-send-email-brobecker@adacore.com> In-Reply-To: <1319561563-20201-1-git-send-email-brobecker@adacore.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201110251818.43576.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2011-10/txt/msg00664.txt.bz2 On Tuesday 25 October 2011 17:52:43, Joel Brobecker wrote: > gdb/ia64-linux-nat.c | 11 +++++++++++ > 1 files changed, 11 insertions(+), 0 deletions(-) > > diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c > index 65e077b..f43e91e 100644 > --- a/gdb/ia64-linux-nat.c > +++ b/gdb/ia64-linux-nat.c > @@ -681,6 +681,17 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum) > PTRACE_TYPE_RET *buf; > int pid, i; > > + /* r0 cannot be fetched but is always zero. */ > + if (regnum == 0) IA64_GR0_REGNUM? > + { > + const char r0_value[8] = {0x00, 0x00, 0x00, 0x00, > + 0x00, 0x00, 0x00, 0x00}; FYI, in C, this is equivalent to: const char r0_value[8] = { 0 }; I'd write it as: const char zero[8] = { 0 }; > + > + gdb_assert (sizeof (r0_value) == register_size (gdbarch, regnum)); > + regcache_raw_supply (regcache, regnum, r0_value); > + return; > + } > + I don't speak ia64, but this is the right direction. I think we should make ia64_cannot_fetch_register return true for gr0 too though. Your new code in ia64_linux_fetch_register would then be moved a bit further down after the ia64_cannot_fetch_register check. It may be there's no code that trip on the below issue, but it's best to avoid leaving the issue latent. -- Pedro Alves