Message ID | 20180928230437.4329-1-tpiepho@impinj.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 31230 invoked by alias); 28 Sep 2018 23:05:04 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 31216 invoked by uid 89); 28 Sep 2018 23:05:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=piepho, decoded, Piepho, trent X-HELO: NAM03-CO1-obe.outbound.protection.outlook.com Received: from mail-co1nam03on0102.outbound.protection.outlook.com (HELO NAM03-CO1-obe.outbound.protection.outlook.com) (104.47.40.102) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Sep 2018 23:05:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=impinj.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QK8AVO7HQCPvdhLa2VAbSlQbEpbbPuhgP4lly12V7z4=; b=EZojDxVBM87T3HOGNWhMDLOL9mmSE4fOxoPMvRQKAwOwuyflMGkMjOTjlR9aKwjrj6Sh9NEnznMaOxSlaO+sKfNd44sk95HehucmTxZctdGMLnIQ7etN0kw1SEuaabRVQzziqvdodW0XY+IsEBXGHfhCNF+S3xCvOX1gokJ7O+k= Received: from CY4PR0601MB3697.namprd06.prod.outlook.com (52.132.101.36) by CY4PR0601MB3585.namprd06.prod.outlook.com (52.132.100.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 28 Sep 2018 23:04:57 +0000 Received: from CY4PR0601MB3697.namprd06.prod.outlook.com ([fe80::30a4:b4ca:8b09:7e87]) by CY4PR0601MB3697.namprd06.prod.outlook.com ([fe80::30a4:b4ca:8b09:7e87%2]) with mapi id 15.20.1164.024; Fri, 28 Sep 2018 23:04:57 +0000 From: Trent Piepho <tpiepho@impinj.com> To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org> CC: Trent Piepho <tpiepho@impinj.com> Subject: [PATCH] Record ARM THUMB2 PLD/PLI cache instructions Date: Fri, 28 Sep 2018 23:04:57 +0000 Message-ID: <20180928230437.4329-1-tpiepho@impinj.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=tpiepho@impinj.com; received-spf: None (protection.outlook.com: impinj.com does not designate permitted sender hosts) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 |
Commit Message
Trent Piepho
Sept. 28, 2018, 11:04 p.m. UTC
These weren't decoded correctly and trigger an unknown instruction error when recording. The ARM format was handled, but not the 32-bit THUMB2 format. Since they are only hints that may affect cache state, there is nothing to record. gdb/ChangeLog 2018-09-28 Trent Piepho <tpiepho@impinj.com> PR gdb/23725 * gdb/arm-tdep.c (thumb2_record_ld_mem_hints): Decode thumb2 PLD/PLI --- gdb/arm-tdep.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Comments
On 2018-09-28 7:04 p.m., Trent Piepho wrote: > These weren't decoded correctly and trigger an unknown instruction error > when recording. The ARM format was handled, but not the 32-bit THUMB2 > format. > > Since they are only hints that may affect cache state, there is nothing > to record. > > gdb/ChangeLog > 2018-09-28 Trent Piepho <tpiepho@impinj.com> > > PR gdb/23725 > * gdb/arm-tdep.c (thumb2_record_ld_mem_hints): Decode thumb2 PLD/PLI > --- > gdb/arm-tdep.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c > index c3280ee211..90936ada8e 100644 > --- a/gdb/arm-tdep.c > +++ b/gdb/arm-tdep.c > @@ -12683,6 +12683,14 @@ thumb2_record_ld_mem_hints (insn_decode_record *thumb2_insn_r) > record_buf); > return ARM_RECORD_SUCCESS; > } > + else > + { > + if (bits (thumb2_insn_r->arm_insn, 20, 22) == 0x1) > + { > + /* Handle PLD, PLI affect only caches, so nothing to record */ > + return ARM_RECORD_SUCCESS; > + } > + } > > return ARM_RECORD_FAILURE; > } > Hi Trent, Thanks for the patch. After staring at the ARM architecture reference manual enough, I think this is fine. In the manual, however, in table "Table A5-20 Load byte, memory hints", some encodings with Rt == 0b1111 decode to "UNPREDICTABLE". Should the record fail for those? I think currently with your patch we will accept them. I am thinking it would be good to fail, because since we can't know the side effects of such instruction, we risk showing some false information if we just assume nothing has changed. If you are motivated, it would be nice to add a test for this instruction in arm_record_test, but I won't require it, since the current state is that this test isn't meant to test all possible instruction, and I don't want to impose that burden on you. Simon
On Sun, 2018-09-30 at 10:21 -0400, Simon Marchi wrote: > On 2018-09-28 7:04 p.m., Trent Piepho wrote: > > These weren't decoded correctly and trigger an unknown instruction error > > when recording. The ARM format was handled, but not the 32-bit THUMB2 > > format. > > > > Since they are only hints that may affect cache state, there is nothing > > to record. > > > > gdb/ChangeLog > > 2018-09-28 Trent Piepho <tpiepho@impinj.com> > > > > PR gdb/23725 > > * gdb/arm-tdep.c (thumb2_record_ld_mem_hints): Decode thumb2 PLD/PLI > > --- > > gdb/arm-tdep.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c > > index c3280ee211..90936ada8e 100644 > > --- a/gdb/arm-tdep.c > > +++ b/gdb/arm-tdep.c > > @@ -12683,6 +12683,14 @@ thumb2_record_ld_mem_hints (insn_decode_record *thumb2_insn_r) > > record_buf); > > return ARM_RECORD_SUCCESS; > > } > > + else > > + { > > + if (bits (thumb2_insn_r->arm_insn, 20, 22) == 0x1) > > + { > > + /* Handle PLD, PLI affect only caches, so nothing to record */ > > + return ARM_RECORD_SUCCESS; > > + } > > + } > > > > return ARM_RECORD_FAILURE; > > } > > > > Hi Trent, > > Thanks for the patch. After staring at the ARM architecture reference manual enough, I > think this is fine. > > In the manual, however, in table "Table A5-20 Load byte, memory hints", some encodings with > Rt == 0b1111 decode to "UNPREDICTABLE". Should the record fail for those? I think currently > with your patch we will accept them. I am thinking it would be good to fail, because since > we can't know the side effects of such instruction, we risk showing some false information if > we just assume nothing has changed. I'm not sure what document this is from, but in https://static.docs.arm .com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf Table A6-20 is titled as above. Rather than this, I used the thumb2 supplement I found here: http://her mes.wings.cs.wisc.edu/files/Thumb-2SupplementReferenceManual.pdf Section 3.3.3 had the most useful table and exhaustive list of possible encodings for this type of thumb2 instruction. I see now that not every possible addressing mode is supported for PLD/PLI, and there are ways to encode a reserved addressing mode for all instructions of this type. I've prepared a follow on patch that should provide an exhaustive check for PLD and PLI instructions. It also enhances the check for other instructions of this general format, but I've not verified that the code is exhaustive there. It is at least better than it was. > If you are motivated, it would be nice to add a test for this instruction in arm_record_test, > but I won't require it, since the current state is that this test isn't meant to test all > possible instruction, and I don't want to impose that burden on you. I might that be THAT motivated, since I've never even used that test feature.
On 2018-10-01 18:05, Trent Piepho wrote: >> In the manual, however, in table "Table A5-20 Load byte, memory >> hints", some encodings with >> Rt == 0b1111 decode to "UNPREDICTABLE". Should the record fail for >> those? I think currently >> with your patch we will accept them. I am thinking it would be good >> to fail, because since >> we can't know the side effects of such instruction, we risk showing >> some false information if >> we just assume nothing has changed. > > I'm not sure what document this is from, but in https://static.docs.arm > .com/ddi0406/c/DDI0406C_C_arm_architecture_reference_manual.pdf > > Table A6-20 is titled as above. > > Rather than this, I used the thumb2 supplement I found here: http://her > mes.wings.cs.wisc.edu/files/Thumb-2SupplementReferenceManual.pdf > > Section 3.3.3 had the most useful table and exhaustive list of possible > encodings for this type of thumb2 instruction. Not sure which section 3.3.3 you are referring to. But I must have been using an outdated version of the manual, in the version you linked there is indeed no unpredictable encodings. > I see now that not every possible addressing mode is supported for > PLD/PLI, and there are ways to encode a reserved addressing mode for > all instructions of this type. > > I've prepared a follow on patch that should provide an exhaustive check > for PLD and PLI instructions. It also enhances the check for other > instructions of this general format, but I've not verified that the > code is exhaustive there. It is at least better than it was. > >> If you are motivated, it would be nice to add a test for this >> instruction in arm_record_test, >> but I won't require it, since the current state is that this test >> isn't meant to test all >> possible instruction, and I don't want to impose that burden on you. > > I might that be THAT motivated, since I've never even used that test > feature. Err I'm not sure if you you meant that you are that motivated, or you are _not_ that motivated. In case you are, I'll be happy to provide any help you would need :). Simon
On Tue, 2018-10-02 at 13:19 -0400, Simon Marchi wrote: > On 2018-10-01 18:05, Trent Piepho wrote: > > > In the manual, however, in table "Table A5-20 Load byte, memory > > > hints", some encodings with > > > Rt == 0b1111 decode to "UNPREDICTABLE". Should the record fail for > > > those? I think currently > > > with your patch we will accept them. I am thinking it would be good > > > to fail, because since > > > we can't know the side effects of such instruction, we risk showing > > > some false information if > > > we just assume nothing has changed. > > > > > > Rather than this, I used the thumb2 supplement I found here: http://her > > mes.wings.cs.wisc.edu/files/Thumb-2SupplementReferenceManual.pdf > > > > Section 3.3.3 had the most useful table and exhaustive list of possible > > encodings for this type of thumb2 instruction. > > Not sure which section 3.3.3 you are referring to. But I must have been > using an outdated version of the manual, in the version you linked there > is indeed no unpredictable encodings. The Thumb-2SupplementReferenceManual.pdf file (link above, 1st google hit for file name). It's not a full manual, just a thumb2 description. I found the organization of the thumb2 decoding tables more useful in that one than in the other manual, the full manual on ARM's site. > > > If you are motivated, it would be nice to add a test for this > > > instruction in arm_record_test, > > > but I won't require it, since the current state is that this test > > > isn't meant to test all > > > possible instruction, and I don't want to impose that burden on you. > > > > I might that be THAT motivated, since I've never even used that test > > feature. > > Err I'm not sure if you you meant that you are that motivated, or you > are _not_ that motivated. In case you are, I'll be happy to provide any > help you would need :). Sorry, not that motivated. I wanted to make reverse debugging work on ARM, and it works for me now. Don't really want to dive into adding more to the self tests, which I've never used. There's really no call to do that on company time anyway, while for reverse debugging there was.
On 10/03/2018 01:34 AM, Trent Piepho wrote: > Sorry, not that motivated. I wanted to make reverse debugging work on > ARM, and it works for me now. Don't really want to dive into adding > more to the self tests, which I've never used. There's really no call > to do that on company time anyway, while for reverse debugging there > was. Those tests in question _are_ about reverse debugging, and adding tests can be considered (and often required) part of a patch. arm_record_test doesn't cover many instructions today because when record support was added, we didn't have the self testing infrastructure in place yet. See: https://sourceware.org/ml/gdb-patches/2017-03/msg00031.html Can't tell whether adding self tests for these instructions would be really useful, but if you ever want to try it, it's quite easy to trigger those tests -- type "maint selftest arm-record" in gdb. Thanks, Pedro Alves
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index c3280ee211..90936ada8e 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -12683,6 +12683,14 @@ thumb2_record_ld_mem_hints (insn_decode_record *thumb2_insn_r) record_buf); return ARM_RECORD_SUCCESS; } + else + { + if (bits (thumb2_insn_r->arm_insn, 20, 22) == 0x1) + { + /* Handle PLD, PLI affect only caches, so nothing to record */ + return ARM_RECORD_SUCCESS; + } + } return ARM_RECORD_FAILURE; }