From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2082.outbound.protection.outlook.com [40.107.20.82]) by sourceware.org (Postfix) with ESMTPS id 6A7D93857C48 for ; Tue, 5 Apr 2022 08:36:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6A7D93857C48 Received: from AM6PR0502CA0054.eurprd05.prod.outlook.com (2603:10a6:20b:56::31) by AM6PR08MB3126.eurprd08.prod.outlook.com (2603:10a6:209:42::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31; Tue, 5 Apr 2022 08:36:52 +0000 Received: from VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::f3) by AM6PR0502CA0054.outlook.office365.com (2603:10a6:20b:56::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.31 via Frontend Transport; Tue, 5 Apr 2022 08:36:52 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT057.mail.protection.outlook.com (10.152.19.123) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.19 via Frontend Transport; Tue, 5 Apr 2022 08:36:52 +0000 Received: ("Tessian outbound ac9bb5dd84f6:v118"); Tue, 05 Apr 2022 08:36:51 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c8f46aca33ffe151 X-CR-MTA-TID: 64aa7808 Received: from be99f9c29175.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A78C74B2-B73E-41F2-A222-62CFDE6D05D0.1; Tue, 05 Apr 2022 08:36:44 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id be99f9c29175.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 05 Apr 2022 08:36:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h8Srqp2m5kw2YU69K5SHCKQfYp7iQvZFFHbNq4sGZQUSYazYM8RjTUGqPfyDxTGV4Ob+kf3+lF8z2Cdl6bQ9PXWih9VF26OEdD4yIwxrAHYbbtQzOJvDiHiI4rM17zylgdUG1O/Oks4anFJeI7lQzASLGjU0fwQqd988bBMf00xBsdn7xVSKABc3mIglTf+nHplwpJJshwB/Xi5z1UXTGAJGcLMWdYIyYdatj0P969v3nrRtOcUTG2tUBHVoN6kEp42V/mJW/ifwcDERc9JMRQ/feSyP087sRMmYG8eLxKa7IHLSQuRHqIkcWAUC5nh9u8Ld3WIvsqrP2+NFDScFHQ== 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=EYTBf3tgQ+wVbScOaKK3AMNoOCHufdIhFugimvAcwgE=; b=Yhm1/jF0ixfWUdcSF33+VUXflwLk8XAm3eFzbPEE7obiUeO4rr6Tdz0tp29Ra9WTjHqecaRuX+c5pHxwBaDyIoRG+0JFFNqReAI47y2TiU6RvIEuXaZlN88fHvmqRd/4kTYFO4uxMcrdrZQTjL2mIJ3ozwle1YlXUa+n5zj/fmb4dYah8VAo7FEB8Sadi7RY7miP4vG1PZ0iLPCMjAQVCiP+ewEGPFvzaHEpxRHwa4IsvEB9qQgM25tLC4INT8iyif74vRY0M3P896xJJajHmuLo247iMsEpJT2hzPRh3kAcLBZ76Hfulqw4RYUddQBdNppBfgcFu2Lp8AjKklmIfA== 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 VI1PR08MB3280.eurprd08.prod.outlook.com (2603:10a6:803:3d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.25; Tue, 5 Apr 2022 08:36:38 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::905f:29ee:d858:516e]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::905f:29ee:d858:516e%7]) with mapi id 15.20.5123.031; Tue, 5 Apr 2022 08:36:38 +0000 Message-ID: <3d467cfa-1844-397c-931b-ffd832fa254f@arm.com> Date: Tue, 5 Apr 2022 09:36:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH, v2] Fix reverse stepping multiple contiguous PC ranges over the line table Content-Language: en-US To: will schmidt , gdb-patches@sourceware.org References: <7a429c919395db6ec4642803badca5dbb97bff66.camel@us.ibm.com> <20220331135246.7913-1-luis.machado@arm.com> From: Luis Machado In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0147.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9::15) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 96152c39-e6c0-4346-33de-08da16df6f22 X-MS-TrafficTypeDiagnostic: VI1PR08MB3280:EE_|VE1EUR03FT057:EE_|AM6PR08MB3126:EE_ X-Microsoft-Antispam-PRVS: 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: XXJM7XhmdJDY8uV3BmhxkRJ0tchkPXmvgNB6RviU79fMuW8UP9YN5nS5UvU0ckRxLHi+wvp/DJ3FfyiziM1htWxPp1ISroFAiWpD/GocuQ8kyAOV7++SefDyMhIAllsZZIi6AdHOO+wiIfWo0ypgN1cwrQJKrScOKByVuCZi3HxVMliLu0DmPf2QRwLNBYte2K7Msv+dchBDrvIMwKJm9nr024KY9M7YFZpRCGuWxSikTaS5i7FT323lcfTINAH3A+rL4kTHVfsEXuXFT69O75stqqvNVr5JblX3/pMW8EPzq11P/B7q/Bw/FcgF+fzVKcpNTFii0K3nVMy8LxUGt7nbd7UDWiqfs8j0ovfu51I2BxlcN2iFSqFEZ4SxAfCYiL+QQ64bjlM3Ii0i/R+YbEEhDC3pVxLKE6vClUgI0XL8i70UoIxEafP0OxXmqfEAS3tYtT5dLEKPV1WhBXuARMgmc08ixVpB8FDvQgaEYvRQHZXEcroYKxUXzb5Wp6n0Gch0SopnaTJscgeXUl5DCxu+Wjeow/86MhCdOzeEbxEh3UNtQEEiH2KVulDiG4xKrq0JA0T396RBmNPRaVNwv/5cVkXd3XLFEhADLooaN+M8qoMmtIsxx1r8kv2LtEYYdiU4UMMOz1l3AFolnaz6hkBhpegpjzBAaNTPKz+jBoUjAyVwF99/c0NKQxm3pGb0e8+54Z+vHgA4eQwzKBMoPbrJp9K4Iy+F5ji2MLnBiUIxOz3dXuwsM7p0HdvUakSPnrnEUK9gGLNFuye8HjndICFii7cHRynJHeVFtH6oWvlcQwACUawPwqUcHlXrXJ66 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:(13230001)(4636009)(366004)(53546011)(2616005)(44832011)(83380400001)(6512007)(31686004)(5660300002)(8936002)(6506007)(2906002)(36756003)(66556008)(8676002)(66476007)(66946007)(84970400001)(31696002)(6486002)(26005)(86362001)(508600001)(316002)(38100700002)(186003)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3280 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: VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b6ba0354-2876-4b46-8010-08da16df6675 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dK2KzjPtRn3FXxznzGcQG0rFUjzcebUW1EKJZ52LcH57OBucrud67H7bcYGr3geYnIiOhZju0YlFnSZi/y/pdnOXoWEvcYCl41+/Qbujlvtl/B+7arl3yhmcHyvvN1zIAHKMReGHo2EC4mYcFZ8A4R/uOYmY57ymMc2mB+nSCHuV7QNZx5mrpZ7Yq4xxDzkKk8KQ85WXdLzsPpqjoQ+ymXdNqadFz1y1VY4aOfL374FmXujRFs9HhtfF8B97CzBkaw4kB+mAIubdvSO28USi2CFXb0/GiEEGnLDMsRGucszSZVRGFYqvamFjgQjIRLqQLR8xHP7t8w82BUk8TwgQTBdx7IwiuAbT9KUUDZ8iX+boXlhH1x+rqzpQRw3tzOaMXan7eAe17rL8BbkPmQETctGn7ShjHnLDwLGoWW4uYwlT9AfSXxEHfR7H0gwoK7RkbOsfMplhvFr0LdukyT1dB0n5I1P/mdP0OpPev5Gd+UX1FmUovNUxpxmZWMHG5RzGgHkYUmWnBpcNVsKyyXPOTdIw7xWtxQ5ITOUz3mOG6dlIwm3IjNPBTGjVg/Jr0y9YL7Kd2YZP6vDAXg7CsdZhecxPk0OstH7RHUARWFKrnuP59ucfcEdoKsk1jc/RnDmLevRCW8MAji3Pc6Y4IwzJROFOY7x3Q9xYKpWWVJC2uxKN+rFbGS+td9e43NBJ2gBZE78h47uKoDDFRAkfU9ivDKgWxsx9Xkujqa3vo+3LvY/W23mB3OsjtsK+EqUCKcfGxy2ZG4e4dglAiK+f60COSE/EPka0xzHUAXBU3/2qJwI= 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:(13230001)(4636009)(40470700004)(36840700001)(46966006)(26005)(186003)(83380400001)(336012)(82310400005)(36756003)(31686004)(316002)(8676002)(70586007)(70206006)(47076005)(84970400001)(5660300002)(508600001)(86362001)(53546011)(40460700003)(8936002)(81166007)(356005)(2906002)(44832011)(6506007)(6512007)(31696002)(6486002)(2616005)(36860700001)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2022 08:36:52.3283 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96152c39-e6c0-4346-33de-08da16df6f22 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: VE1EUR03FT057.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3126 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Tue, 05 Apr 2022 08:37:01 -0000 On 4/4/22 17:55, will schmidt wrote: > On Thu, 2022-03-31 at 14:52 +0100, Luis Machado via Gdb-patches wrote: >> v2: >> - Check if both the line and symtab match for a particular line table entry. >> >> -- >> >> When running GDB's testsuite on aarch64-linux/Ubuntu 20.04 (also spotted on >> the ppc backend), I noticed some failures in gdb.reverse/solib-precsave.exp >> and gdb.reverse/solib-reverse.exp. >> >> The failure happens around the following code: >> >> 38 b[1] = shr2(17); /* middle part two */ >> 40 b[0] = 6; b[1] = 9; /* generic statement, end part two */ >> 42 shr1 ("message 1\n"); /* shr1 one */ >> >> Normal execution: >> >> - step from line 38 will land on line 40. >> - step from line 40 will land on line 42. >> >> Reverse execution: >> >> - step from line 42 will land on line 40. >> - step from line 40 will land on line 40. >> - step from line 40 will land on line 38. >> >> The problem here is that line 40 contains two contiguous but distinct >> PC ranges in the line table, like so: >> >> Line 40 - [0x7ec ~ 0x7f4] >> Line 40 - [0x7f4 ~ 0x7fc] > > > > > >> I'm not particularly happy with how we go back in the ranges (using "pc - 1"). >> Feedback would be welcome. > > I suppose there could be a loop of some sort that iterates backwards to > a valid line; though I'd think pc - 1 is sufficient? > Yes, it seems to do the job. >> >> Validated on aarch64-linux/Ubuntu 20.04/18.04. Carl Love has verified that it >> does fix a similar issue on ppc. >> >> Ubuntu 18.04 doesn't actually run into these failures because the compiler >> doesn't generate distinct PC ranges for the same line. >> >> I see similar failures on x86_64 in the gdb.reverse tests >> (gdb.reverse/step-reverse.exp and gdb.reverse/step-reverse.exp). Those are >> also fixed by this patch, although Carl's testcase doesn't fail for x86_64. >> >> There seems to be a corner case where a line table has only one instruction, >> and while stepping that doesn't take the same path through infrun. I think it >> needs some more investigation. Therefore this is a tentative patch for now. > > > Are you (or Carl) continuing to pursue that edge case? > Not at the moment unfortunately. I know that this needs to be handled in the fallthrough of process_event_stop_test. Carl's test doesn't seem to fail for x86_64 (at least for me). We need to polish the testcase a bit more so that we can cover that corner case as well. Also, this is more of a RFC at this point. You'll notice some debug print statement in the patch. It would be nice to turn those into permanent debug prints, as this code doesn't seem to print too much detail about what it is doing.