From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] IA64: $fr0==0.0, $fr1==1.0
Date: Wed, 28 Mar 2012 14:55:00 -0000 [thread overview]
Message-ID: <20120328145506.12240.32862.stgit@brno.lan> (raw)
In-Reply-To: <4F730961.6030003@redhat.com>
> I see that $f0 (always 0.0) and $f1 (always 1.0) could/should be given
> similar treatment:
>
> (gdb) info register $f0 $f1
> f0 *value not available*
> f1 *value not available*
>
(...)
> gcore.exp failures related to these issues.
(because when debugging a live process "info registers" shows 'value
not available', but when debugging a core, "info registers" shows 0.0
for those registers.
(I was lazy and got the raw bytes of 1.0 by using "info float" after
writing 1 to $fp2...)
With yours, and these patches applied, gcore.exp passes cleanly
on ia64-unknown-linux-gnu. Before, we had:
Running ../../../src/gdb/testsuite/gdb.base/gcore.exp ...
FAIL: gdb.base/gcore.exp: corefile restored general registers
FAIL: gdb.base/gcore.exp: corefile restored all registers
No regressions. WDYT?
2012-03-28 Pedro Alves <palves@redhat.com>
* ia64-linux-nat.c (supply_fpregset, ia64_linux_fetch_register):
Always supply $fr0 as 0.0 and $fr1 as 1.0.
---
gdb/ia64-linux-nat.c | 35 ++++++++++++++++++++++++++++++++++-
1 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 24bde2d..237f2c7 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -447,8 +447,20 @@ supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
{
int regi;
const char *from;
+ const gdb_byte f_zero[16] = { 0 };
+ const gdb_byte f_one[16] =
+ { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
- for (regi = IA64_FR0_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
+ /* Kernel generated cores have fr1==0 instead of 1.0. Older GDBs
+ did the same. So ignore whatever might be recorded in fpregset_t
+ for fr0/fr1 and always supply their expected values. */
+
+ /* fr0 is always read as zero. */
+ regcache_raw_supply (regcache, IA64_FR0_REGNUM, f_zero);
+ /* fr1 is always read as one (1.0). */
+ regcache_raw_supply (regcache, IA64_FR1_REGNUM, f_one);
+
+ for (regi = IA64_FR2_REGNUM; regi <= IA64_FR127_REGNUM; regi++)
{
from = (const char *) &((*fpregsetp)[regi - IA64_FR0_REGNUM]);
regcache_raw_supply (regcache, regi, from);
@@ -690,6 +702,27 @@ ia64_linux_fetch_register (struct regcache *regcache, int regnum)
return;
}
+ /* fr0 cannot be fetched but is always zero. */
+ if (regnum == IA64_FR0_REGNUM)
+ {
+ const gdb_byte f_zero[16] = { 0 };
+
+ gdb_assert (sizeof (f_zero) == register_size (gdbarch, regnum));
+ regcache_raw_supply (regcache, regnum, f_zero);
+ return;
+ }
+
+ /* fr1 cannot be fetched but is always one (1.0). */
+ if (regnum == IA64_FR1_REGNUM)
+ {
+ const gdb_byte f_one[16] =
+ { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0 };
+
+ gdb_assert (sizeof (f_one) == register_size (gdbarch, regnum));
+ regcache_raw_supply (regcache, regnum, f_one);
+ return;
+ }
+
if (ia64_cannot_fetch_register (gdbarch, regnum))
{
regcache_raw_supply (regcache, regnum, NULL);
next prev parent reply other threads:[~2012-03-28 14:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 16:55 [RFA/commit/ia64-linux] Allow libunwind to fetch register 0 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
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 ` Pedro Alves [this message]
2012-03-28 17:15 ` [PATCH] IA64: $fr0==0.0, $fr1==1.0 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=20120328145506.12240.32862.stgit@brno.lan \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/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