From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7977 invoked by alias); 28 Mar 2012 14:55:28 -0000 Received: (qmail 7906 invoked by uid 22791); 28 Mar 2012 14:55:24 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_EG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Mar 2012 14:55:07 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2SEt7xo029053 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 28 Mar 2012 10:55:07 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q2SEt6hP020323 for ; Wed, 28 Mar 2012 10:55:07 -0400 Subject: [PATCH] IA64: $fr0==0.0, $fr1==1.0 To: gdb-patches@sourceware.org From: Pedro Alves Date: Wed, 28 Mar 2012 14:55:00 -0000 Message-ID: <20120328145506.12240.32862.stgit@brno.lan> In-Reply-To: <4F730961.6030003@redhat.com> References: <4F730961.6030003@redhat.com> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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/msg00943.txt.bz2 > 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 * 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);