From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0m0JJyWRY2RXzgsAWB0awg (envelope-from ) for ; Tue, 16 May 2023 10:20:21 -0400 Received: by simark.ca (Postfix, from userid 112) id 943D61E11E; Tue, 16 May 2023 10:20:21 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=lFq65i24; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-8.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RDNS_DYNAMIC,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0E2A01E0D6 for ; Tue, 16 May 2023 10:20:21 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7C5E83857005 for ; Tue, 16 May 2023 14:20:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C5E83857005 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684246820; bh=cSxf2ty13o/C7wLgBNZClGMUPHx/t+XKsvsxSdi/wjU=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=lFq65i241VlcO37W57Hm5yvHJx+nb+2iXNDCWeyQR/nxKC6OCWSOrGEiQPJWwxOIm ku1lAGou/QWNgE9q/47CzKmlB1TIJVEwI2iswJZqx0H7jgKk8k7ap4BhjzLfldzhAG 8gty8z1RyE1D1ee6SJNBxSKNR5vGLJGKhbsyDPuw= Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2049.outbound.protection.outlook.com [40.107.13.49]) by sourceware.org (Postfix) with ESMTPS id DCE233858C83 for ; Tue, 16 May 2023 14:19:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DCE233858C83 Received: from AM5PR0402CA0004.eurprd04.prod.outlook.com (2603:10a6:203:90::14) by AM8PR08MB6402.eurprd08.prod.outlook.com (2603:10a6:20b:363::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.32; Tue, 16 May 2023 14:19:53 +0000 Received: from AM7EUR03FT016.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:90:cafe::d1) by AM5PR0402CA0004.outlook.office365.com (2603:10a6:203:90::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30 via Frontend Transport; Tue, 16 May 2023 14:19:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT016.mail.protection.outlook.com (100.127.140.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.15 via Frontend Transport; Tue, 16 May 2023 14:19:53 +0000 Received: ("Tessian outbound e13c2446394c:v136"); Tue, 16 May 2023 14:19:52 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 16e5924893704180 X-CR-MTA-TID: 64aa7808 Received: from eff66c79aae8.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E2A23025-C443-4791-9FE9-8A4E0B5F203F.1; Tue, 16 May 2023 14:19:45 +0000 Received: from EUR01-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id eff66c79aae8.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 16 May 2023 14:19:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QFVfnNPwR/PVGAldA5+vO21lEWAKfqfdatbNycht7FsSaWW4gfY6iGXgNs5Zvu6ua3y7RGbYCGmWcke36vePWM6riaR9CBq6UaUXZTZBo7WhAjkSlj7CUlwNQxdqOTAP5J0bB2s4Z8qMB6z5aVWb3nVCgbVOYaOhBr2iCGHJkv6bVTToUOIKH7DLEPdXBSUNZaICxVhaPPksg/u4vODEA7JPzctHyiVb6toGeb9ZOl+UKvoko7Cbt08TfLqpxKHoB3OtT+0G/kIZKzW1LC1xYD02OzI9vPpGyxErk9ExUEbd1C3SxqTYj/aLrVNEdw+wIitvfxr5+Jrs2I5yehdFDw== 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=cSxf2ty13o/C7wLgBNZClGMUPHx/t+XKsvsxSdi/wjU=; b=MbdO3066hGaqpxoOBIfxF0wX3XScqCtGjUZFx3too6BPJ5s8MiBTbYqxBC+V9uQZ4afNXbxc8irBhyZ108fyoGJi7TpCnkLVkdvxFTg3YLoeK1f08D4mDrkdrtFrjQbic6Yieqs8Ba9CF04ybFhJSo0RLmlHtkF46ScFoXFr3vOpTJAfFiJan3r+6vq/p+BJbFQTfGPSdtYjetAV1ilZtLnqJJBNgkZoY4tvFXm1ajk4zB82PirRcLX1i1OJ/bQYbgYX46INfzmzBNGgnAxZmKV9ghGwZopUQzsZdwjR3Y1fwJRgTRNXupPRwAFlqzsTcJgDfLaoqEth7FsgxPmKCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) by AS8PR08MB6344.eurprd08.prod.outlook.com (2603:10a6:20b:319::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.32; Tue, 16 May 2023 14:19:44 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c6b8:4dc0:6f9:7f40]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::c6b8:4dc0:6f9:7f40%3]) with mapi id 15.20.6387.030; Tue, 16 May 2023 14:19:43 +0000 Message-ID: Date: Tue, 16 May 2023 15:19:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v3] gdb: Fix false match issue in skip_prologue_using_linetable To: Tom de Vries , Kevin Buettner , Tom de Vries via Gdb-patches Cc: WANG Rui References: <20230418120939.29102-1-tdevries@suse.de> <1a4148e1-1376-3bc6-e398-4c611922c58f@suse.de> <20230421110346.7ca9b163@f37-zws-nv> <276f25d7-ab32-268f-0875-70cab6180e8d@suse.de> <6663707c-4297-c2f2-a0bd-f3e84fc62aad@suse.de> Content-Language: en-US In-Reply-To: <6663707c-4297-c2f2-a0bd-f3e84fc62aad@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0247.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:350::6) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|AS8PR08MB6344:EE_|AM7EUR03FT016:EE_|AM8PR08MB6402:EE_ X-MS-Office365-Filtering-Correlation-Id: 161b8fc4-9c3c-49d9-9550-08db56189df3 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 54OF3lFNu+1g090Cmc3dqRwdqehSbl1B6PJsdW7JHwKjfJ2hV0LB77fyc02qtek9eYNlidTXLDqL40CAHwQUtT8gLO5lfCCL0HRohDMnXI9K9162YEqWq3KZMh2rYPfHkzo8jx3yPhIsL3ya4F/7PjcHW7qihHpLR7nqKYBSteMsyWn74gYjM0Sva5qMKnvNO1HxFnMzZ4YG+z49MtgXScosR/5+hhvIprLkwWwEVWPDF/uIYugoT3SY5K2ENTJ9ghG3TB48618dOLFjxgF/oEHsPk2llIhDYcR4OKItYs9WoZPrPXMWHUuvG9/cWZuokKVbM8eppab/ZVedk0eD+NuMkS/mjBCYZ3lFbSZ/qoxSJ4nWivPyonj4rqEsnNvKUQEWG0QVGfAOqf9O7gnhYRlZ5jR51YB9hXoJhRp65YF5n0QSZZi6J7jOheIfe5x28f63u5gREMIJauS0JjfH+XVPpmZWN4VN8Q8bx69E6RFd+nYHQX/qQZxbrngpC8yWQvUsMw1P9g8acajQn8MAt0MYSzBy6BPigOBs6o5KfQcyPjJC/bphQjHREHqVreR5MlkU0a4iXz8j+57nXiiDKBi+Lz5VMiKk0Nxm+lRl4sC/49hVvSVoZEMNR/LRirXIxa8q9/AgglGF2/QD7zRxGZe4tOs/T1HlfkLZXaG4U7s= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR08MB3919.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(39860400002)(366004)(396003)(376002)(451199021)(2616005)(66556008)(966005)(2906002)(6486002)(66476007)(66946007)(83380400001)(478600001)(110136005)(53546011)(186003)(8676002)(8936002)(44832011)(6506007)(6512007)(5660300002)(41300700001)(4326008)(26005)(316002)(86362001)(31696002)(38100700002)(36756003)(31686004)(66899021)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6344 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: f663c475-0291-46e4-426a-08db561897d8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bs+Q41fZFjv4R01tKnGWInpqUx1MZTorvldXEmNBjnfLYUe88BsKPwkw431ipRaEgeR/gZdlxp9UagO1zdkb3et8P5jK4vD1jRMKC60pl9RC87Bd0wsSq6kat9cUoyelQeUcacsLDT+1Rypv6P1zJaNdnawIPAOjjt+PBsp4VQHXKGgb9BOfmy/dbzpTCWb79graiu/sLwoofWskS6gz53kM0Ljtj4loBZkvaDLGVvdSuXE6in5Tv5h0QcFM04sHudKBIX2GVei9b1/14ot5L3KvRI0C7/HcnVzqB21blzQdhZ58fPcrTORui77GB9KuyF1gQyi0be5XhYS3IdJSoyxKs8Y63usoT9giAE5DGDETevuQ7S3zGkjaQVgDFQ8vIoFJu6qWCHVAIyBwA4L623wZXsRtOnLpAsTnznl+eGUQlrAlRN2F8GuwwX/lA4SnteFhR8KgoFl85MxOvpXfP4xOTocK2hO9wXW6sLtwglgWJR/472tdjjkal7qpqmZU+0MVW5OvVh+p8MAPyBE9BdLQBa2wxBT/WZ3lHrAdTvEGIg7dVekYMNGAG+9u1cu52t3zuU60s2k7d2Zm6iNiYez7TTWSPseGo2w+7S/J1CVY5q4huAKrn8oifqaZWFJcIGsDzCnyVWmNEZOhpvCfU7LvOQZVGsIceg/9bR7AGWZtVH8asJhXpXl8kgUDSIeTR3ek69bSUs1f5edTXL4sMiHmFexpnNaWY2s4zfUExvKaRftfbVPC4sWycxXkAbLahqch63No2uC7MUaov2CubhT/4T0S7hx9bjTIBQ43FbE= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(376002)(39860400002)(396003)(451199021)(36840700001)(40470700004)(46966006)(40460700003)(70586007)(70206006)(82740400003)(966005)(53546011)(26005)(6486002)(6512007)(2616005)(83380400001)(86362001)(31696002)(47076005)(82310400005)(6506007)(81166007)(336012)(356005)(36860700001)(186003)(110136005)(40480700001)(31686004)(44832011)(8936002)(8676002)(5660300002)(41300700001)(478600001)(36756003)(2906002)(66899021)(316002)(4326008)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2023 14:19:53.1309 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 161b8fc4-9c3c-49d9-9550-08db56189df3 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT016.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6402 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: , From: Luis Machado via Gdb-patches Reply-To: Luis Machado Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" On 4/24/23 15:15, Tom de Vries wrote: > On 4/24/23 14:53, Luis Machado wrote: >> On 4/22/23 09:01, Tom de Vries via Gdb-patches wrote: >>> On 4/21/23 20:03, Kevin Buettner wrote: >>>> Hi Tom, >>>> >>>> On Tue, 18 Apr 2023 14:15:06 +0200 >>>> Tom de Vries via Gdb-patches wrote: >>>> >>>>> On 4/18/23 14:09, Tom de Vries via Gdb-patches wrote: >>>>>> Co-Authored-By: WANG Rui (fix, tiny change [1]) >>>>>> Co-Authored-By: Tom de Vries (test-case) >>>>>> >>>>>> [1] https://www.gnu.org/prep/maintain/html_node/Legally-Significant.html >>>>> >>>>> I'm not used to deal with these matters, so I'd appreciate some >>>>> review/approval on this.  Is my copyright status assessment correct, and >>>>> did I write it up correctly? >>>> >>>> I refreshed my memory via the link you provided above.  Based on what >>>> is written there, I conclude that Wang Rui's change is not legally >>>> signficant for copyright purposes. >>>> >>>> Also, I've looked over the Rui's patch as well as your test case, and >>>> it looks good to me.  So... >>>> >>>> Approved-by: Kevin Buettner >>>> >>> >>> Hi Kevin, >>> >>> Thanks for review. >>> >>> Committed and also backported to gdb-13-branch, because it was a 12 -> 13 regression. >>> >>> Thanks, >>> - Tom >>> >> >> For some reason aarch64 is grumpy with this test, and it FAIL's the last comparison. >> >> Maybe aarch64 is broken in this regard? > > Hi Luis, > > thanks for reporting this. > > I could reproduce it on openSUSE Leap 15.4. > > I think there are two independent problems: > - the aarch64 prologue analyzer walks past the end of the function > - the test-case assumes that the prologue analyzer will return the first >   insn in foo, rather that some insn in foo. > > The WIP patch below addresses both issues, and allows the test-case to pass for me. > > [ FWIW, alternatively using some "maint set skip-prologue" value from this RFC ( https://sourceware.org/pipermail/gdb-patches/2022-August/191343.html ) could also suffice to ignore the first problem. ] > > Thanks, > - Tom > > ... > diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c > index ec0e51bdaf7..d974595e48f 100644 > --- a/gdb/aarch64-tdep.c > +++ b/gdb/aarch64-tdep.c > @@ -917,12 +917,13 @@ aarch64_analyze_prologue_test (void) >  static CORE_ADDR >  aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) >  { > -  CORE_ADDR func_addr, limit_pc; > +  CORE_ADDR func_addr, func_end_addr, limit_pc; > >    /* See if we can determine the end of the prologue via the symbol >       table.  If so, then return either PC, or the PC after the >       prologue, whichever is greater.  */ > -  if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) > +  bool func_addr_found = find_pc_partial_function (pc, NULL, &func_addr, &func_end_addr); > +  if (func_addr_found) >      { >        CORE_ADDR post_prologue_pc >         = skip_prologue_using_sal (gdbarch, func_addr); > @@ -941,7 +942,8 @@ aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) >    limit_pc = skip_prologue_using_sal (gdbarch, pc); >    if (limit_pc == 0) >      limit_pc = pc + 128;       /* Magic.  */ > - > +  limit_pc = std::min (limit_pc, func_end_addr - 4); > + >    /* Try disassembling prologue.  */ >    return aarch64_analyze_prologue (gdbarch, pc, limit_pc, NULL); >  } > diff --git a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp > index 488f85f9674..c506cfd55cc 100644 > --- a/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp > +++ b/gdb/testsuite/gdb.dwarf2/dw2-prologue-end-2.exp > @@ -95,15 +95,15 @@ if { $break_addr == "" } { > >  # Get the "foo_label" address. > > -set foo_label_addr "" > -gdb_test_multiple "print /x &foo_label" "" { > +set bar_label_addr "" > +gdb_test_multiple "print /x &bar_label" "" { >      -re -wrap "= ($hex)" { > -       set foo_label_addr $expect_out(1,string) > +       set bar_label_addr $expect_out(1,string) >         pass $gdb_test_name >      } >  } > > -if { $foo_label_addr == "" } { > +if { $bar_label_addr == "" } { >      return >  } > > @@ -115,4 +115,4 @@ gdb_test "print &foo_end == &bar_label" " = 1" >  # Check that the breakpoint is set at the expected address. Regression test >  # for PR30369. > > -gdb_assert { $break_addr == $foo_label_addr } > +gdb_assert { $break_addr < $bar_label_addr } > ... Sorry, I thought I had replied to this thread. Indeed the above patch addresses this problem with the aarch64 prologue skipper, and it also fixes things for arm. For arm I suspect we might need the same fix to the prologue skipper that the patch addresses for aarch64. I can pick it up, refresh and submit if you're happy with it as well. Regards, Luis