From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01olkn2060.outbound.protection.outlook.com [40.92.99.60]) by sourceware.org (Postfix) with ESMTPS id F051838582B1 for ; Thu, 23 Jun 2022 13:12:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F051838582B1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P8MBdR72QsMFORhx0S+DIFC51PvMpn0VKnWJwdyix04TUoPdONbdFy+pDKvjtAIi8/YhZwyBe9Xj9YUAc76Q3dczlsDvIgPnBvLW3kVAY6j46Z1+C6t71nGufjqZB+ne/80t9b1QtPwFJOwf1NTkLN0P3PQf6XAEAmDfG6hFqt3DKHnr0LxwVABqmTaNte6xWLc2Dp48MFCI3L37Id924jxeRMhQVpDkpqZ0cYGEU0WiHOadb7vfY36VTtAVWV3CTBdeGyZOL0/ZZfe6V58zgNu/1/2+7AkOdUdd2dwt1i03B/fzeXhLEtCpLmwJAXMtiRZN3MSMUDjtBwBt/orq7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rE2LEPJZbwNrBwZxFif/8YLM5fCxxitrNZzNR9UlShw=; b=cTLKKD4u902bmH38eByNy3XfS6opU2NHyqloLl0mnRBjmrHSdla+B6stvnm8XRWTKpjPgQNYfTwBqh+pNq6GOLfRdfrJwGtqlrDBBZlxZR8vxw6g4fFALhI0nsrJwXV45ebRxVMOVFnGg9npsDah7DWjRssHQl1J8fTzJhVch8sexOLCcPT11fD8F23ci5nFO4GKGw8qvQev6y9kWD7XTGZgg7jUMq0e4g3NpS5FJg8r56pMYGI7Xeu2y8apftdfEUBi6uhIj4CZMFYww45kzgq1im/KYRQ7nHeyxCqQ/JOmljOqCaEO7TU6nHldQmytw6SgkvWPBOfaA9Mx+OPBuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:197::9) by TYYP286MB0986.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:e3::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.15; Thu, 23 Jun 2022 13:12:20 +0000 Received: from OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM ([fe80::fd8b:c4b8:61a8:3d0]) by OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM ([fe80::fd8b:c4b8:61a8:3d0%8]) with mapi id 15.20.5373.016; Thu, 23 Jun 2022 13:12:20 +0000 Message-ID: Subject: Re: [PATCH 1/2] gdb/testsuite: move get_maint_bp_addr to gdb-utils.exp From: Enze Li To: Andrew Burgess , gdb-patches@sourceware.org Cc: pedro@palves.net, enze.li@gmx.com Date: Thu, 23 Jun 2022 21:12:16 +0800 In-Reply-To: <87a6a6c7x6.fsf@redhat.com> References: <87a6a6c7x6.fsf@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.2 X-TMN: [SMFj+fBzzPVVjxns6nvxrj2hiGfoTqEH] X-ClientProxiedBy: SG2PR02CA0102.apcprd02.prod.outlook.com (2603:1096:4:92::18) To OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:197::9) X-Microsoft-Original-Message-ID: <5c2ff6ff025253bcc9a48eb91973988555309769.camel@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e4d0d70-4370-4cc3-1ff8-08da551a0133 X-MS-TrafficTypeDiagnostic: TYYP286MB0986:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /RCsGVKqH0XFUZb28pFAMP7OfKWICoTo/Dqv3K20lkhhAdfknBGdYyqVFllvlpENaKikobdEkOUcbXDEXgBTqR3gDHmqi0WQwhxpSFrP809KrR9yxNHPIwFXNHl1tV/iMEOBRPtfo5iFiJGVUFXZ1kjEwjaHIcDw7MzOHKe9gKkMy1kSZ8brdrGUuDMuR4iIlYucY4CANzW6P2kLGPedmLkRKf54x08KTrm5Ce1xQ6+M2upuvDYhSeO1NB4eG7bErAzc4eoDJiBwpT00wTwjZjj44u8LHeaI6NBIItq33Vfq2pL2m88k1x6TxwZ0H+XtKnAfukPoH7ol4SMyCXJR6r0zxEB5z6dwJEydfB5FZI6dp3jzOXpA2aFie7d6ukwsCcDLSh6E7eEPuxPuboTw4znkptpqmUvZ2OaWfOPMULcNvvoLU1ttVlkvRTKnrj70dqJ+qpryu/vgqXCwQdGDV7KE8hH6FEkw78D8tYOKMoHoVdp4RmfFPgq79AeasChAHfHRkDPSZw5m6uBA1BEINURMoDCdTWtLmLtSu9rnssuAxEROaCc5G82gddr2B/TWpjyFgCPWkpNIMbMMvvLQ7TSsaR1KTqre3rmTnw0DuDJ0fIYOqjb9mikx7Q4Wzmg+ X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?U2lrWDZLRzFpcWZ0U0R2d1RGckdZNWZLZi9QdEFYUlZLUWVqSmVXc1daZ203?= =?utf-8?B?QVEvOForV0h2c3YycUg1Q1I3Tm5GZUVJR3EwTWQ3ZEJRcjJLekdYVU9NVmwr?= =?utf-8?B?V2pGRU9USHRMaWtrUWVqWFpPS0lnVnpiMGQ3QWpwMlE5VThjTGU3d3FXNWpO?= =?utf-8?B?aG9kRktDRWZVeG1qMnFKQklZU0RjYVl5bVBtem9hanlMamU2YTE4RXl2aml0?= =?utf-8?B?Nk5mNWxVNzkxQm5LL3cyM1RTQkNP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-CrossTenant-AuthSource: OS3P286MB2152.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 13:12:20.8359 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYYP286MB0986 X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2022 13:12:27 -0000 Hi Andrew, Thanks for your review. Naming is a hard thing for me. gdb_get_bp_addr seems to have more features than before, and starting with 'gdb' looks good. =F0=9F=99=82 V2 of this patch is on the way. Best Regards, Enze On Tue, 2022-06-21 at 17:12 +0100, Andrew Burgess wrote: > Enze Li via Gdb-patches writes: >=20 > > The get_maint_bp_addr procedure will be shared by other test suite, > > so > > move it to gdb-utils.exp. > > --- > > =C2=A0gdb/testsuite/gdb.base/clear_non_user_bp.exp | 23 ---------------= - > > ---- > > =C2=A0gdb/testsuite/lib/gdb-utils.exp=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 23 > > ++++++++++++++++++++ > > =C2=A02 files changed, 23 insertions(+), 23 deletions(-) > >=20 > > diff --git a/gdb/testsuite/gdb.base/clear_non_user_bp.exp > > b/gdb/testsuite/gdb.base/clear_non_user_bp.exp > > index 26d7a31fa47..399a3a0f0dc 100644 > > --- a/gdb/testsuite/gdb.base/clear_non_user_bp.exp > > +++ b/gdb/testsuite/gdb.base/clear_non_user_bp.exp > > @@ -16,29 +16,6 @@ > > =C2=A0# Regression test for PR gdb/7161.=C2=A0 Test that GDB cannot del= ete > > non-user > > =C2=A0# breakpoints with clear command. > > =C2=A0 > > -# get_maint_bp_addr num > > -# > > -# Purpose: > > -#=C2=A0=C2=A0=C2=A0 Get address of the specified internal breakpoint w= hen using > > command > > -#=C2=A0=C2=A0=C2=A0 "maint info breakpoints $num". > > -# > > -# Parameter: > > -#=C2=A0=C2=A0=C2=A0 The parameter "num" indicates the number of the in= ternal > > breakpoint > > -#=C2=A0=C2=A0=C2=A0 to get.=C2=A0 Note that this parameter must be a n= egative number. > > -#=C2=A0=C2=A0=C2=A0 E.g., -1 means that we're gonna get the first inte= rnal > > breakpoint. > > -# > > -# Return: > > -#=C2=A0=C2=A0=C2=A0 Internal breakpoint address. > > -# > > -proc get_maint_bp_addr { num } { > > -=C2=A0=C2=A0=C2=A0 gdb_test_multiple "maint info break $num" "find add= ress of > > internal bp $num" { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0-re -wrap ".*(0x\[0-9a-f\]+)= .*" { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return $e= xpect_out(1,string) > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > -=C2=A0=C2=A0=C2=A0 } > > -=C2=A0=C2=A0=C2=A0 return "" > > -} > > - > > =C2=A0# get_first_maint_bp_num > > =C2=A0# > > =C2=A0# Purpose: > > diff --git a/gdb/testsuite/lib/gdb-utils.exp > > b/gdb/testsuite/lib/gdb-utils.exp > > index ffdfb75557c..bf2863722ce 100644 > > --- a/gdb/testsuite/lib/gdb-utils.exp > > +++ b/gdb/testsuite/lib/gdb-utils.exp > > @@ -72,3 +72,26 @@ proc style {str style} { > > =C2=A0=C2=A0=C2=A0=C2=A0 } > > =C2=A0=C2=A0=C2=A0=C2=A0 return "\033\\\[${style}m${str}\033\\\[m" > > =C2=A0} > > + > > +# get_maint_bp_addr num > > +# > > +# Purpose: > > +#=C2=A0=C2=A0=C2=A0 Get address of the specified internal breakpoint w= hen using > > command > > +#=C2=A0=C2=A0=C2=A0 "maint info breakpoints $num". > > +# > > +# Parameter: > > +#=C2=A0=C2=A0=C2=A0 The parameter "num" indicates the number of the in= ternal > > breakpoint > > +#=C2=A0=C2=A0=C2=A0 to get.=C2=A0 Note that this parameter must be a n= egative number. > > +#=C2=A0=C2=A0=C2=A0 E.g., -1 means that we're gonna get the first inte= rnal > > breakpoint. > > +# > > +# Return: > > +#=C2=A0=C2=A0=C2=A0 Internal breakpoint address. > > +# > > +proc get_maint_bp_addr { num } { > > +=C2=A0=C2=A0=C2=A0 gdb_test_multiple "maint info break $num" "find add= ress of > > internal bp $num" { > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0-re -wrap ".*(0x\[0-9a-f\]+)= .*" { > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return $e= xpect_out(1,string) > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > +=C2=A0=C2=A0=C2=A0 } > > +=C2=A0=C2=A0=C2=A0 return "" > > +} >=20 > Before the get_maint_bp_addr name gets spread around too much, I > think > we should rename this.=C2=A0 I'd propose maybe gdb_get_bp_addr.=C2=A0 The > comment > should be reworked to remove the mention of negative values, as I > believe this function will work just as well with positive values. >=20 > I think the comment should also be expanded to indicate that > (currently) > this function will only take integer values for NUM, and will return > the > first address for a particular breakpoint, e.g. we can't say > 'get_maint_bp_addr 1.2' to get the address of the second location of > breakpoint #1. >=20 > I don't think that we need to make the actual implementation of > get_maint_bp_addr better right now, but if we give the function a > good > name, and explain the limitations in the comments, then, if we ever > need > to, we can improve the function later. >=20 > Thanks, > Andrew >=20 > > --=20 > > 2.36.1 >=20