From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id YN+2HT4B+2RdARMAWB0awg (envelope-from ) for ; Fri, 08 Sep 2023 07:10:54 -0400 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=MQfyvovD; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 74CB01E0C3; Fri, 8 Sep 2023 07:10:54 -0400 (EDT) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 52FAD1E028 for ; Fri, 8 Sep 2023 07:10:52 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B06393858410 for ; Fri, 8 Sep 2023 11:10:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B06393858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694171451; bh=BsTU7AOdr0j4BQyM4rSigjLzjMQynBz8IZmQxUUV3/g=; 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=MQfyvovDFhKxs7QemqJHvks5x6vWOUe/cbR6vDdNaA6wHk7N6xaLNH/FcZ5dGrJ/n 9hT52RciBe/iWaVgz8OkKfSUSvyei2zge0knaQfCWl7uT4j1NWkh9YcfarRiG5u1hc Pxx3zC3+G9WJnSSlK8W2ZvUm9IWJD0IHpz93crI8= Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2051.outbound.protection.outlook.com [40.107.14.51]) by sourceware.org (Postfix) with ESMTPS id 9BCA33858426 for ; Fri, 8 Sep 2023 11:10:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9BCA33858426 Received: from DB7PR02CA0010.eurprd02.prod.outlook.com (2603:10a6:10:52::23) by DU0PR08MB9910.eurprd08.prod.outlook.com (2603:10a6:10:402::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.34; Fri, 8 Sep 2023 11:10:25 +0000 Received: from DBAEUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:52:cafe::5d) by DB7PR02CA0010.outlook.office365.com (2603:10a6:10:52::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30 via Frontend Transport; Fri, 8 Sep 2023 11:10:25 +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 DBAEUR03FT037.mail.protection.outlook.com (100.127.142.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.11 via Frontend Transport; Fri, 8 Sep 2023 11:10:25 +0000 Received: ("Tessian outbound c99fbc01d472:v175"); Fri, 08 Sep 2023 11:10:25 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6d0ddb633c76d357 X-CR-MTA-TID: 64aa7808 Received: from 11f94d46c2d0.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0B38ACF4-D457-4D7E-AF2A-74523E6DC838.1; Fri, 08 Sep 2023 11:10:19 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 11f94d46c2d0.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Sep 2023 11:10:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iyXUvKVuXLM7ykKSStwt0GkA+LnqyJb7AD/BI6JVqdrooGJyL+x4mMrXLfaR74oR+M67UJS2UCT8tKrb/bcdZvLXaxZjfZW72GnhD30fIaUqWKeE+UUia7bZbOor0U3zS/crstmoSyXX6kYzK5NuS++dwRraWAhNCHokWfhpoUUc0bCDQgfXY0gqbgZbBAoKKlciWRL4MjE3x+5+xzu/iTURvsZq7Nw8g0485VCKrNpDWcao7gPhHfzZ+4pjpOvAYeTz4tlD+iiHaN5VI7p9AJX1iXrE9c7G4b1Z0RuWR58oU1rc9cfX0vWnwU9qDj6A2Ah+qDdDF77MEWeVOhCsCw== 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=BsTU7AOdr0j4BQyM4rSigjLzjMQynBz8IZmQxUUV3/g=; b=iMryz1forcviCHoxVh9NY3UhYJAR/PNJdFHwgdydb3HGIoGERYN7h/TkIj7SX5aMYJNfVix7O0xhqOrtWDKUQDXgsvdgwf5z2SpBaKRD6koqLhvSY4BnbMCup4vaoYZKtDipvi19P+3Qtd7J7+4aRhuhjTMr1Cy7CSRuDJ6ji/Z9ScPJVldJAZ3qdkRMouA4TLGThjPJfKfH/anABukobTrmCQKA34eO2x6zSZWFz8eALvbXzBOk6g/vKvZV6KF+utq2N5KkmrqBaTkjIGmN40cE244tEIZxIR4AZvbocxCu31YX5dO0OFFvagcOkywvvwJdztOmuzA3NAy2RRKrjw== 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 PA4PR08MB6206.eurprd08.prod.outlook.com (2603:10a6:102:ea::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.30; Fri, 8 Sep 2023 11:10:17 +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.6768.029; Fri, 8 Sep 2023 11:10:17 +0000 Message-ID: Date: Fri, 8 Sep 2023 12:10:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH v5 13/16] [gdb/generic] corefile/bug: Fixup (gcore) core file target description reading order Content-Language: en-US To: gdb-patches@sourceware.org Cc: thiago.bauermann@linaro.org References: <20230907152018.1031257-1-luis.machado@arm.com> <20230907152018.1031257-14-luis.machado@arm.com> In-Reply-To: <20230907152018.1031257-14-luis.machado@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0031.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:151::18) To VI1PR08MB3919.eurprd08.prod.outlook.com (2603:10a6:803:c4::31) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: VI1PR08MB3919:EE_|PA4PR08MB6206:EE_|DBAEUR03FT037:EE_|DU0PR08MB9910:EE_ X-MS-Office365-Filtering-Correlation-Id: 6fcc55f9-a333-4ddc-c552-08dbb05c339e 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: 9FbbmKLj0+s8FgXHrtig6OHIHhvBYpK9hOB6HhatP/UkcCvKKckKFs9u49QOOTL2oqXVJvc1D+u1QF3R2vChuxgLkAnHYSXqZ/J/+sMA8Sml+vlfSuaEspb58f/frPhARmq7SwWtivMQ2Uhm6iUpJk8OrmKnR7KIjQHLdVAVDB1cwH3kULdyLJk5IaU+LFXzofeiP1QJqZ89dTN1TbbNx9uMSwhQDzlab8o4FavGaYhS6Hal1TBZzACQvJQxOfPCON/RsMZJTkfgmC9SIVcCG1Ihn0n84tldTEUFeiCxRoH8pSyqwv19+c6WDORJXv0DgvWgWgJhlf8cowBx0GoFuSHqhLmOXKZ8s7xyKvKU+cLcExNYGrtH510zWFfyroJ/q3nd4749R06jXiIRkIRLK8veJxlh4MYcbVjpJfjdGuQBkFo8jLEBxjhZoQQZtd4x4qZBD/YY7nzGThM4E2jI0VAT8UtO8S01HPDfp4onBlRuff/bCIpeHEpev1KcvYAkXWLS+asMQH6o+1OTwhChWWheX2g5SswabT/SdRQInIhCSkofFLahIhR5hM3TdGbz0hl9R+UFUPkev6a4KHLYLSzDY0ULMQPS3/OkRya/8foUj86S1PR/N8zWhK4UvIyDc87szDEmF92mU2JLZFpOn4JQgUoqaayT2DJZMcQ4zGU= 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)(396003)(39860400002)(376002)(136003)(366004)(346002)(1800799009)(186009)(451199024)(31686004)(6486002)(53546011)(6506007)(36756003)(31696002)(86362001)(38100700002)(2616005)(26005)(6512007)(83380400001)(478600001)(8676002)(8936002)(41300700001)(4326008)(5660300002)(2906002)(66476007)(44832011)(316002)(66946007)(66556008)(6916009)(41533002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6206 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: DBAEUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 3ffe62f8-87ae-4f0e-857b-08dbb05c2edf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sQKaG1KEOuLgU0uAUDIyFelfEp5Ny7ZAYUNYKhH6AAkdumQ+Hh+AItek2djB7GXL6vIqJb24YFe7uSxbE1OXkU4PZPEZgPnfU6ntpWHW203lsrQDHf1bNdIn4KLVtm6MbOAHqnQ1V52Qd9ws3I+rhwcrE8jpw4cHQ4Wcsim+jmgv9wZB1ID65SpZkiMrj10HOmwZi5dEMEELrhTKoehjwUdBHkSSwTO4DL3zf+B96LaVkVaTN2c8jengXI8jr8HGIQwoMUoUjWCPt/WfdE/K7mjT0y0RJhogu1KTTAcu+qvsEEA2hFMzptPXNSR9YLaYuZk1YQ3GBO8p7aGfdw1wC/VAK5ZC9zQVcute/MJqFNgiOaWV0RXQw1ZH7I69PSCQWtsrIiNjNo5dNWT658umxpfyImhw5Ahx64oZyMlhwoG8n6HF2yyT+QY6KXjmRSSPFieGN6q7oHFiAtYsfREVHS35EbjooA/Vutowb3Zz/+1rYbC1OdS0sqkfv/wuvpxJGkNXiRibaKnxkIB4WKyvgdhKmkVOESLhhmXAw91uPq5Ag1E3kWaMuOvLWTnRNZlquSWgK3XPI6wrtE2CUJQdFtAgaFLtbH3yPU0VTTAH9Y4y/OoafbA0cLJ4//GiIAiLTGEclgBayueq+9FoY2nteHBlBMGG2/3WjpFGYIITep/0fykLFnLXrD6OUdHsyK4pTC80r32euO+RfMEUJvlCWBXZa33GYFRB4wqxtpyBjJx7sod2evgwE7pyNPAJzV/JCxdQ/23Q30/00S2Q1/u+vahSa5cHnTKZgpM8PWCRF1g= 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)(136003)(39860400002)(396003)(346002)(376002)(451199024)(186009)(82310400011)(1800799009)(36840700001)(40470700004)(46966006)(6506007)(36860700001)(478600001)(6486002)(86362001)(53546011)(26005)(31696002)(5660300002)(6512007)(31686004)(83380400001)(336012)(81166007)(356005)(82740400003)(2906002)(36756003)(2616005)(47076005)(70586007)(6916009)(316002)(44832011)(70206006)(40460700003)(107886003)(40480700001)(8936002)(8676002)(4326008)(41300700001)(41533002)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2023 11:10:25.2111 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6fcc55f9-a333-4ddc-c552-08dbb05c339e 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: DBAEUR03FT037.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB9910 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 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" Could a global maintainer please go through this change and let me know if it is OK? It touches a generic part of gdb as well. This has the potential to cause some issues for some targets relying on the gdb xml core file note. On 9/7/23 16:20, Luis Machado via Gdb-patches wrote: > 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 target, it doesn't work correctly for AArch64 with SVE or SME > support. > > The correct approach for AArch64/Linux is 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. > > I think this should work for other architectures as well. If not, we may > need to adjust things so all architectures get the information that they > need for discovering the target description of the core file. > > Regression-tested on aarch64-linux Ubuntu 22.04/20.04. > --- > gdb/corelow.c | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > > diff --git a/gdb/corelow.c b/gdb/corelow.c > index 439270f5559..ae1641fe5d2 100644 > --- a/gdb/corelow.c > +++ b/gdb/corelow.c > @@ -1229,6 +1229,21 @@ core_target::thread_alive (ptid_t ptid) > const struct target_desc * > core_target::read_description () > { > + /* If the architecture provides a corefile target description hook, use > + it now. Even if the core file contains a target description in a note > + section, it is not useful for targets that can potentially have distinct > + descriptions for each thread. One example is AArch64's SVE/SME > + extensions that allow per-thread vector length changes, resulting in > + registers with different sizes. */ > + if (m_core_gdbarch && gdbarch_core_read_description_p (m_core_gdbarch)) > + { > + const struct target_desc *result; > + > + result = gdbarch_core_read_description (m_core_gdbarch, this, core_bfd); > + if (result != nullptr) > + return result; > + } > + > /* If the core file contains a target description note then we will use > that in preference to anything else. */ > bfd_size_type tdesc_note_size = 0; > @@ -1252,15 +1267,6 @@ core_target::read_description () > } > } > > - if (m_core_gdbarch && gdbarch_core_read_description_p (m_core_gdbarch)) > - { > - const struct target_desc *result; > - > - result = gdbarch_core_read_description (m_core_gdbarch, this, core_bfd); > - if (result != NULL) > - return result; > - } > - > return this->beneath ()->read_description (); > } >