From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2076.outbound.protection.outlook.com [40.107.6.76]) by sourceware.org (Postfix) with ESMTPS id AC2BA3858C27 for ; Wed, 20 Sep 2023 14:01:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC2BA3858C27 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yzGN8N5y3A+PbBG7zldBy94a/KeFWe0aHU/ABxLHOWo=; b=Oxq1n4pLXbJOA13deVheUqY25TUnFME7m+mSEtYAcQUyzoPTKbag9NOonECQ109XaOakQq0d3IhZa4xbN3ndqD90shlIcvjgEb4vaPoN6E7x74Jno/ef/52+M6C5ijWU5nwkO+amMQZTPNRb6GWENUDGBeIheUqKpSrcYYJujW4= Received: from DU7PR01CA0023.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::20) by AS8PR08MB9019.eurprd08.prod.outlook.com (2603:10a6:20b:5c1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Wed, 20 Sep 2023 14:01:45 +0000 Received: from DBAEUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:50f:cafe::a8) by DU7PR01CA0023.outlook.office365.com (2603:10a6:10:50f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.29 via Frontend Transport; Wed, 20 Sep 2023 14:01:45 +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 DBAEUR03FT035.mail.protection.outlook.com (100.127.142.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.20 via Frontend Transport; Wed, 20 Sep 2023 14:01:45 +0000 Received: ("Tessian outbound 30c9f5e988c5:v175"); Wed, 20 Sep 2023 14:01:45 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 80771e4465a3a8a4 X-CR-MTA-TID: 64aa7808 Received: from 76806681ca7b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0D6960C3-725E-4910-8149-2A0A2F716FAD.1; Wed, 20 Sep 2023 14:01:38 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 76806681ca7b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 20 Sep 2023 14:01:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Na+E+T2J4IScJg5iMo/jVoigXNNoCdNtJP0NDpvEW0Qg3rClOCGEMIretqvLwA7es5jSNL88OFOBGn+udiDexysYR4sL8jDsDybGNVwJLdoxdmlFDQn+AiXDWdXNIhKzPrWCZ2ZrDfsnyh0QZazrZ/76O3ScIHWKs1IRhmsSvOgrBsNmNBkdVL22/2PvIeF4y1mzxaHSv5ac/j9E/9mOyeFj9u6hP3l2BL/KccEm4s9QLsh894dHo9zoYnMAOxmY6x3WDV3o5/Y4ir6zPu2Bg4Ff1NDOUYs+8+eRXG33iHCVzR/QFpVyUiV/hlBbXa3O0uoybGR2sh2nLPlBbvqfiw== 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=yzGN8N5y3A+PbBG7zldBy94a/KeFWe0aHU/ABxLHOWo=; b=mxYAn1HHNjWkfELjPUCLeiiJWUeomzj+eZw20eovtjgRj+O2eJ0bEwsjxhkeoHhMgIl/lo0UlWv37z64Oy55euPmDFAGw35BPGaTtx6usOUqJwXQE5Jp0Cu0gGDWT2A0JBqvWXob1WNiseFYMNg1UsNTEPF9Ou1WZ3Rq/KKnETH7L976TGmNtvhNzSo+NPEN3itnjrs5Ndhpx9PyCA2m/GECGEj4lFduEuv6ZJwPR+2wwsUcbdY9ArPKhUMzRet4BBZwVT28cUdHGAQMH+EFaxa8gO3eg86cd+YN2UyWSUAlg/E3+hs4BTei+lZkgQRU8f5OJOUkBv/HaRArxiQK/Q== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yzGN8N5y3A+PbBG7zldBy94a/KeFWe0aHU/ABxLHOWo=; b=Oxq1n4pLXbJOA13deVheUqY25TUnFME7m+mSEtYAcQUyzoPTKbag9NOonECQ109XaOakQq0d3IhZa4xbN3ndqD90shlIcvjgEb4vaPoN6E7x74Jno/ef/52+M6C5ijWU5nwkO+amMQZTPNRb6GWENUDGBeIheUqKpSrcYYJujW4= 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 AM8PR08MB6468.eurprd08.prod.outlook.com (2603:10a6:20b:360::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.27; Wed, 20 Sep 2023 14:01:34 +0000 Received: from VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7743:60fe:4859:2df2]) by VI1PR08MB3919.eurprd08.prod.outlook.com ([fe80::7743:60fe:4859:2df2%6]) with mapi id 15.20.6792.026; Wed, 20 Sep 2023 14:01:34 +0000 Message-ID: Date: Wed, 20 Sep 2023 15:01:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v7 15/18] [gdb/generic] corefile/bug: Add hook to control the use of target description notes from corefiles From: Luis Machado To: Simon Marchi , gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org References: <20230918212651.660141-1-luis.machado@arm.com> <20230918212651.660141-16-luis.machado@arm.com> <957943ea-a51a-4cdb-b86e-68d2fb85de9d@polymtl.ca> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0226.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a6::15) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|AM8PR08MB6468:EE_|DBAEUR03FT035:EE_|AS8PR08MB9019:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f4518b6-6c0d-42af-5c27-08dbb9e21fe7 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: P+slpd4rZhM6/EOBimKC7K5SCWx5/qeiEg0dRLCYADkdB+RzO30LlS+jGJVjpKcyeyatHVtwA5u8krNnjKIq5lqsRMJJDlvrl1D44nLR6fA8Kr8fJY7Y1oatYsQ8oDkwSWd+brxRbC4e6VxXqebg376U3KYX1pyx0Z8xwQMldiF9W/X7neT3AZoCDfYkN/wjrA1GaUAX08kQD5hayRq9xGDS5q5BpPu3FjNDxIW1ibjEqdjOBOzwbOyybOZ7PhgBJLbuzlSDLwrMQu6LTNc8L9+YLY/7PZlCuZoo17mRPL4rv3XTTvOL71Mt6jG3vCloN4JhxxFpSHWW0ahy6uC/IVaM1WoDsciCPOyBOQifNznFl3w2w6gFpQjFMQykZ39e7kS6/m6w0FIfj2XyO58IoiqtdPEg31YATQMPy6RxXPsB/dZD686sSAnZQjULOerrPBAjYXeeI4BxHk3IlAnsu3QfmWU4iQ0nrWBU6tMDYxwUy0WJx3lSCZv1taEnea6D+NEK9+sm6tbtNcZhyuVskWfQU/4TOqubSRa+0WYo1o6VMwvjlXeGn3kpR/smU/2czWP6VQozgzH0oO3Uknun9J2AX+2L0HlJODGDS0UOB9sAfSGHQEClPaUcWUYOYFAppxggUcrymYPahk93b/As/K9F/Z8+U70ZdrWwVszwJ50= 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:(13230031)(136003)(396003)(39860400002)(366004)(376002)(346002)(451199024)(186009)(1800799009)(36756003)(83380400001)(2906002)(38100700002)(6486002)(6506007)(31686004)(41300700001)(2616005)(66476007)(66556008)(66946007)(6512007)(316002)(53546011)(86362001)(26005)(478600001)(44832011)(6666004)(8936002)(5660300002)(8676002)(31696002)(4326008)(41533002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR08MB6468 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: DBAEUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: ee3aaf51-7895-4850-7d04-08dbb9e21952 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4SOcv6LKgH4SBxcCBmFh9mDJSmi+LZcJrFdosJ34/VDFe1htw6jD/bu39P0PKUhl4wieaJBBHybWY4JNFRexxBsNVliOp3qVeNVAmFCDrBaFTZ/YXxZoWRpsJ2IQfsHWkbtl9BUhCVS3jwBtVmOxqIZ+7XF7Y/Wc8S/7YP159Wkxz7WPMNOkJyRwvrZF7q5mg4QOixEifASBG9mOwY0e62VeO3WoZFUZydcCvt/iZ+eveH6lQ+HQ60/fnop/+p+wsppZVELBuON1gLh1UoGd8q2qAYM0pwBS7+NCLj7OohLAw7f/NIyvcQ4frHrzwtJYAoj4HDo/37g5GTvV3ccfvT3Gu4TLIMAOqxhdKVPwaM3txZkSh1JkgxahHd1ZUDcxPmv/6CdbLuCydt/3StccnRHCNrZFw381wXISybR9jbfmNosK3fkzjru3nr+YKHHhn6A9KH8oM2Q6NikKI/7Kv4/hFAm9Sxs9WgdbRvO5RRuqH9GGDQBAvZk+6kL4BKzqMFak4nJjK/wfCdQ69WRA9pRbMsLFLQ5DNZdV1LYHxvgX6mL4arPahp/Ai4GBuoMeVHdr8AVSyVHzDKlRw0mwh4aKZXzzOkp+DIfLXQvo7Ql8Iy7pcQNfEU5zu6Mji3kivR3T5PVkmEHnrcOjJOjSfPMyGmK4lT0z6m7HOuUTYBALbiOLo9/NMjFbg/1Tp9H7DISddlxQ7eOc4OJk4ojyI7agMM+C0oTWylKuep0EXH29QMxKwokhGurD/idY0aWBBSp84a08kdgQ6JQiscuIluL9IbMk4+XeLGFxFGObb+g= 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:(13230031)(4636009)(39860400002)(346002)(396003)(136003)(376002)(1800799009)(451199024)(82310400011)(186009)(40470700004)(36840700001)(46966006)(31696002)(40460700003)(70586007)(2906002)(6486002)(70206006)(83380400001)(6512007)(336012)(107886003)(26005)(36860700001)(47076005)(2616005)(41300700001)(316002)(8676002)(4326008)(6666004)(8936002)(5660300002)(6506007)(53546011)(44832011)(478600001)(86362001)(40480700001)(81166007)(36756003)(356005)(82740400003)(31686004)(41533002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2023 14:01:45.1904 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f4518b6-6c0d-42af-5c27-08dbb9e21fe7 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: DBAEUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB9019 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 9/20/23 06:49, Luis Machado wrote: > On 9/19/23 21:49, Simon Marchi wrote: >> On 9/18/23 17:26, Luis Machado wrote: >>> New entry in v7. >>> >>> --- >> >> Note: when you use `---` in a commit message, git-am drops whatever >> comes after that, so here we lose the commit message when applying. I >> think the intention is that you'd put whatever you don't want to appear >> in the commit message (like the "new in version X" notes) after the >> `---`. I'll try to do that from now on. >> > > Yeah, that's a bad marker indeed. Is that configuration-specific though? > Since I started playing with b4 only recently, I think I didn't run into a case of trying to apply a series containing this marker. I get the same, and what you mentioned makes sense. It is pretty handy, when trying to push a series, for git to take care of removing the update entries. Might be useful to do it as part of the gdb development workflow. >>> >>> Due to the nature of the AArch64 SVE/SME extensions in GDB, each thread >>> can potentially have distinct target descriptions/gdbarches. >>> >>> When loading a gcore-generated core file, at the moment GDB gives priority >>> to the target description dumped to NT_GDB_TDESC. Though technically correct >>> for most targets, it doesn't work correctly for AArch64 with SVE or SME >>> support. >>> >>> The correct approach for AArch64/Linux is to either have per-thread target >>> description notes in the corefiles or to rely on the >>> gdbarch_core_read_description hook, so it can figure out the proper target >>> description for a given thread based on the various available register notes. >>> >>> The former, although more correct, doesn't address the case of existing gdb's >>> that only output a single target description note. >>> >>> This patch goes for the latter, and adds a new gdbarch hook to conditionalize >>> the use of the corefile target description note. The hook is called >>> use_target_description_from_corefile_notes. >>> >>> The hook defaults to returning true, meaning targets will use the corefile >>> target description note. AArch64 Linux overrides the hook to return false >>> when it detects any of the SVE or SME register notes in the corefile. >>> >>> Otherwise it should be fine for AArch64 Linux to use the corefile target >>> description note. >>> >>> When we support per-thread target description notes, then we can augment >>> the AArch64 Linux hook to rely on those notes. >>> >>> Regression-tested on aarch64-linux Ubuntu 22.04/20.04. >> >> The question that came to mind when reading this is (I already asked you >> on IRC, but perhaps someone else has an idea): if GDB has to know how to >> infer target descriptions from the core file contents (the >> kernel-generated core files don't include target description notes, only >> GDB-generated core files do), what advantage do we have of storing and >> reading the target description in the core? Are there any scenarios >> where the target description note conveys something that GDB wouldn't >> figure out by analyzing the core file content? >> > > According to the original commit that added NT_GDB_TDESC, there are potential use case around > dumping a core file from a remote session. That remote target may potentially have more registers > than what gdb might be able to infer. > >>> diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py >>> index 846467b8d83..bbb9b188286 100644 >>> --- a/gdb/gdbarch_components.py >>> +++ b/gdb/gdbarch_components.py >>> @@ -2732,3 +2732,22 @@ Read core file mappings >>> predefault="default_read_core_file_mappings", >>> invalid=False, >>> ) >>> + >>> +Method( >>> + comment=""" >>> +Return true if the target description for all threads should be read from the >>> +target description core file note(s). Return false if the target description >>> +for all threads should be inferred from the core file contents/sections. >>> + >>> +The corefile's bfd is passed through OBFD. >>> + >>> +This hook should be used by targets that can have distinct target descriptions >>> +for each thread when the core file only holds a single target description >>> +note. >> >> I think the last paragraph should be left out. An arch could decide not >> to use the target description note for whatever reason it sees fit, this >> is just one example. The reason for AArch64 appears to be sufficiently >> described in the AArch64-specific files. >> > > Will do, thanks. > >>> +""", >>> + type="bool", >>> + name="use_target_description_from_corefile_notes", >>> + params=[("struct bfd *", "obfd")], >> >> Can you name the parameter core_bfd maybe? Just a bit more precise. >> > > That was my first try, but unfortunately core_bfd seems to be a macro, and it doesn't > play well in this context. Maybe a longer name that dodges the core_bfd macro? > > /* Binary File Diddler for the core file. */ > > #define core_bfd (current_program_space->cbfd.get ()) > FTR, I went with corefile_bfd to dodge the macro name. >> Otherwise: >> >> Approved-By: Simon Marchi >> >> Simon > I plan to push both these series (sme1/sme2) towards the end of the week. Thanks, Luis