From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15294 invoked by alias); 27 Mar 2012 23:03:41 -0000 Received: (qmail 15285 invoked by uid 22791); 27 Mar 2012 23:03:40 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,TW_EG X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Mar 2012 23:03:23 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 514E81C6598; Tue, 27 Mar 2012 19:03:22 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id rPmFuX7RqLZW; Tue, 27 Mar 2012 19:03:22 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 1AA391C6590; Tue, 27 Mar 2012 19:03:22 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 47265145616; Tue, 27 Mar 2012 16:03:17 -0700 (PDT) Date: Tue, 27 Mar 2012 23:03:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [RFA/commit/ia64-linux] Allow libunwind to fetch register 0 Message-ID: <20120327230317.GG2701@adacore.com> References: <1319561563-20201-1-git-send-email-brobecker@adacore.com> <201110251818.43576.pedro@codesourcery.com> <20111025204052.GR19246@adacore.com> <4F721594.8050601@redhat.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="yEPQxsgoJgBvi8ip" Content-Disposition: inline In-Reply-To: <4F721594.8050601@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2012-03/txt/msg00928.txt.bz2 --yEPQxsgoJgBvi8ip Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1007 > > I will make the small changes you suggested at the beginning of > > the patch. I just wanted to confirm something: > > > > > I will send a new patch... > > Do you have that new patch handy? Want to check it in? > I'm testing something on ia64-linux, and notice that gr0 shows up > as *unavailable*. Argh - I could have sworn I sent the new patch, but I cannot find it anyway in my sent box, or my repository on my laptop. And bad luck on the timing, as we've done an emergency shutdown of most of our machines due to some construction going on in our building (TMI?). Anyway, I didn't want you to wait, so I redid the changes. I just cannot compile or test them. I will do that tomorrow, hoping that the machines will be powered up again, and if that shows no regression, I will check it in. Given that the cannot_fetch_register gdbarch hook wasn't attached, my understanding is that there isn't anything else that really needs changing... Sorry about the delay... -- Joel --yEPQxsgoJgBvi8ip Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-ia64-linux-Allow-libunwind-to-fetch-register-0.patch" Content-length: 1922 >From 1f2a3fee025f763f3e7c6f6147069b8a6008018e Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Tue, 25 Oct 2011 12:17:08 -0400 Subject: [PATCH] [ia64-linux] Allow libunwind to fetch register 0 On ia64-linux, GDB sometimes prints the following error when trying to switch to a different task: (gdb) task 3 Register 0 is not available This is a random failure that sometimes happens, sometimes does not. The error comes from the fact that the libunwind library is requesting the value of register 0 (zero): This eventually leads us to ia64-linux-nat.c:ia64_linux_fetch_register. This function relies on ia64_cannot_fetch_register to determine whether or not we have access to the register's value. The ptrace interface does not provide the r0 value, and so we end up telling the regcache that this register's value is not available. And yet, for r0, we do not need to ask ptrace for its value, since it is always zero. So, the fix was to add a special rule for supplying a nul value when regnum == 0. gdb/ChangeLog: * ia64-linux-nat.c (ia64_linux_fetch_register): Add special handling for r0. --- gdb/ia64-linux-nat.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c index 19b827f..60b873b 100644 --- a/gdb/ia64-linux-nat.c +++ b/gdb/ia64-linux-nat.c @@ -680,6 +680,16 @@ 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 == IA64_GR0_REGNUM) + { + const gdb_byte zero[8] = { 0 }; + + gdb_assert (sizeof (zero) == register_size (gdbarch, regnum)); + regcache_raw_supply (regcache, regnum, zero); + return; + } + if (ia64_cannot_fetch_register (gdbarch, regnum)) { regcache_raw_supply (regcache, regnum, NULL); -- 1.7.1 --yEPQxsgoJgBvi8ip--