From patchwork Wed Oct 1 09:50:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 3047 Received: (qmail 31854 invoked by alias); 1 Oct 2014 09:51:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 31843 invoked by uid 89); 1 Oct 2014 09:51:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 01 Oct 2014 09:51:08 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s919olAI008996 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 1 Oct 2014 05:50:47 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s919ofHp020753; Wed, 1 Oct 2014 05:50:42 -0400 Message-ID: <542BCE71.5080308@redhat.com> Date: Wed, 01 Oct 2014 10:50:41 +0100 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: Yao Qi , Andrew Pinski , "catalin.udma@freescale.com" CC: Richard Earnshaw , Philippe Waroquiers , "gdb-patches@sourceware.org" Subject: Re: [PATCH] aarch64/gdbserver: fix floating point registers display References: <1407835166-827-1-git-send-email-catalin.udma@freescale.com> <53E9E1C2.6010707@arm.com> <53E9EB9A.7000304@codesourcery.com> <1407932734.2182.67.camel@soleil> <53EB5C86.4030307@codesourcery.com> <53EB7965.8070208@arm.com> <53F4DC74.8080807@redhat.com> <85303e79d83947958b01132bc0613e72@BY2PR03MB175.namprd03.prod.outlook.com> <53F59F12.1010007@codesourcery.com> <53F618B3.5040508@redhat.com> In-Reply-To: <53F618B3.5040508@redhat.com> On 08/21/2014 05:05 PM, Pedro Alves wrote: > On 08/21/2014 08:26 AM, Yao Qi wrote: >> On 08/21/2014 02:56 PM, Andrew Pinski wrote: >>> If we revert the patch is someone going to fix big-endian support then >>> since that is the original why it was requested. >> >> I prefer to revert the patch, because it has problem. How to fix >> big-endian support is another issue. > > Agreed. It just seems to me that gdbserver needs to extract > the right 32-bits out of the ptrace buffer? I'm giving the gdb/regformats/ dir some TLC today, and while regenerating the .dat files stumbled on this. I've now reverted the patch from mainline and the 7.8 branch, with the patch below. Catalin, can I get you to file a PR for the floating point issue, and add it to: https://sourceware.org/gdb/wiki/GDB_7.8_Release ? (that PR list is what goes into the 7.8.1 release announcement.) Thanks. -------- From 63fcc8bcd98a8cd9672dd8672f663662f8caa811 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 1 Oct 2014 10:44:08 +0100 Subject: [PATCH] Aarch64: Make CPSR a 32-bit register again in the target description This reverts commit a4d9ba85 - 'AARCH64: Change cpsr type to be 64bit.'. Even though Linux's ptrace exposes CPSR as 64-bit, CPSR is really 32-bit, and basing GDB's fundamentals on a particular OS's ptrace(2) implementation is a bad idea. In addition, while that commit intended to fix big endian Aarch64, it ended up breaking floating point debugging against GDBserver, for both big and little endian, because it changed the CPSR to be 64-bit in the features/aarch64-core.xml file, but missed regenerating the regformats/aarch64.dat file. If we generate it now, we see this: diff --git c/gdb/regformats/aarch64.dat w/gdb/regformats/aarch64.dat index afe1028..0d32183 100644 --- c/gdb/regformats/aarch64.dat +++ w/gdb/regformats/aarch64.dat @@ -35,7 +35,7 @@ expedite:x29,sp,pc 64:x30 64:sp 64:pc -32:cpsr +64:cpsr 128:v0 128:v1 128:v2 IOW, that commit left regformats/aarch64.dat still considering CPSR as 32-bits. regformats/aarch64.dat is used by GDBserver for its internal regcache layout, and for the g/G packet register block. See the generated aarch64.c file in GDBserver's build dir. So the target description xml file that GDBserver reports to GDB is now claiming that CPSR is 64-bit, but what GDBserver actually puts in the g/G register packets is 32-bits. Because GDB thinks CPSR is 64-bit (because that's what the XML description says), GDB will be reading the remaining 32-bit bits of CPSR out of v0 (the register immediately afterwards), and then all the registers that follow CPSR in the register packet end up wrong in GDB, because they're being read from the wrong offsets... gdb/ 2014-10-01 Pedro Alves * features/aarch64-core.xml (cpsr): Change back to 32-bit. * features/aarch64.c: Regenerate. --- gdb/ChangeLog | 5 +++++ gdb/features/aarch64-core.xml | 2 +- gdb/features/aarch64.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 242fe26..f16db06 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-10-01 Pedro Alves + + * features/aarch64-core.xml (cpsr): Change back to 32-bit. + * features/aarch64.c: Regenerate. + 2014-09-11 Pedro Alves PR gdb/17347 diff --git a/gdb/features/aarch64-core.xml b/gdb/features/aarch64-core.xml index dbec6dc..9b45a22 100644 --- a/gdb/features/aarch64-core.xml +++ b/gdb/features/aarch64-core.xml @@ -42,5 +42,5 @@ - + diff --git a/gdb/features/aarch64.c b/gdb/features/aarch64.c index 31a148e..1e9a99d 100644 --- a/gdb/features/aarch64.c +++ b/gdb/features/aarch64.c @@ -50,7 +50,7 @@ initialize_tdesc_aarch64 (void) tdesc_create_reg (feature, "x30", 30, 1, NULL, 64, "int"); tdesc_create_reg (feature, "sp", 31, 1, NULL, 64, "data_ptr"); tdesc_create_reg (feature, "pc", 32, 1, NULL, 64, "code_ptr"); - tdesc_create_reg (feature, "cpsr", 33, 1, NULL, 64, "int"); + tdesc_create_reg (feature, "cpsr", 33, 1, NULL, 32, "int"); feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.fpu"); field_type = tdesc_named_type (feature, "ieee_double");