From: Joel Brobecker <brobecker@adacore.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA/commit/ia64-linux] Allow libunwind to fetch register 0
Date: Tue, 27 Mar 2012 23:03:00 -0000 [thread overview]
Message-ID: <20120327230317.GG2701@adacore.com> (raw)
In-Reply-To: <4F721594.8050601@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]
> > I will make the small changes you suggested at the beginning of
> > the patch. I just wanted to confirm something:
>
> <snip my own confusion>
>
> > 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
[-- Attachment #2: 0001-ia64-linux-Allow-libunwind-to-fetch-register-0.patch --]
[-- Type: text/x-diff, Size: 1921 bytes --]
From 1f2a3fee025f763f3e7c6f6147069b8a6008018e Mon Sep 17 00:00:00 2001
From: Joel Brobecker <brobecker@adacore.com>
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
next prev parent reply other threads:[~2012-03-27 23:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 16:55 Joel Brobecker
2011-10-25 17:27 ` Pedro Alves
2011-10-25 17:37 ` Pedro Alves
2011-10-25 20:49 ` Joel Brobecker
2011-10-26 0:27 ` Pedro Alves
2012-03-27 19:32 ` Pedro Alves
2012-03-27 23:03 ` Joel Brobecker [this message]
2012-03-28 12:52 ` Pedro Alves
2012-03-28 14:55 ` [PATCH] IA64: EC, the Epilog Count register, is available in ptrace Pedro Alves
2012-03-28 17:12 ` Joel Brobecker
2012-03-28 17:55 ` Pedro Alves
2012-03-28 14:55 ` [PATCH] IA64: $fr0==0.0, $fr1==1.0 Pedro Alves
2012-03-28 17:15 ` Joel Brobecker
2012-03-28 17:56 ` Pedro Alves
2012-03-28 17:10 ` [RFA/commit/ia64-linux] Allow libunwind to fetch register 0 Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120327230317.GG2701@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox