[v2,14/17,gdb/generic] corefile/bug: Fixup (gcore) core file target description reading order
Message ID | 20230519102508.14020-15-luis.machado@arm.com |
---|---|
State | New |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 17B8B3882031 for <patchwork@sourceware.org>; Fri, 19 May 2023 10:28:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17B8B3882031 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1684492084; bh=LZ2+i3DZIAhYdVLdS8HHfzM9+Lb/trJYF/SR+V1w3lE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=FikFgoZPbJK7K4tn1EXTb+dIcBRcUP/kjBJWsrVS9+FntgqgCWcTsB9qkgtXFWile Y3n+a9Unj70MAQsxGWKOVgOmODe9KPgqT13n9LqKyvNvfYPDrZc/wvRi1iDwAx0nLR 70YOrshL+Za1WPaJ/UVmuM/tIZnNB/W/at8jbCcw= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2072.outbound.protection.outlook.com [40.107.20.72]) by sourceware.org (Postfix) with ESMTPS id 3CA123858C62 for <gdb-patches@sourceware.org>; Fri, 19 May 2023 10:25:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3CA123858C62 Received: from DB6P192CA0018.EURP192.PROD.OUTLOOK.COM (2603:10a6:4:b8::28) by AS8PR08MB6232.eurprd08.prod.outlook.com (2603:10a6:20b:296::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 10:25:27 +0000 Received: from DBAEUR03FT065.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:b8:cafe::1e) by DB6P192CA0018.outlook.office365.com (2603:10a6:4:b8::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19 via Frontend Transport; Fri, 19 May 2023 10:25:27 +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 DBAEUR03FT065.mail.protection.outlook.com (100.127.142.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.19 via Frontend Transport; Fri, 19 May 2023 10:25:27 +0000 Received: ("Tessian outbound 945aec65ec65:v136"); Fri, 19 May 2023 10:25:27 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 52972e6688d1994f X-CR-MTA-TID: 64aa7808 Received: from b174decbede1.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1C5E4715-74E5-4146-B5A8-BBFBCAF60309.1; Fri, 19 May 2023 10:25:19 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id b174decbede1.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 19 May 2023 10:25:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oYr1MhwtXkM+muUnPcCXR9u95VsiFBGA0MON27m0vn2FV3oGK5TCPhwEKn33OidXKztz7Ar9LLuW/+UZLunvqgV+fPScueM08/Gr0pUccCwatCQndAnXS8kBb+c4f+B6FfpgFsBBW6DfRqfQlTEiGsP7HrLlDZd+E8E+8GCC/SWRtvMjx24g8jVWJZmTxYeZTvk513I/OL/m0otdP5ZgjAm8xNUyBCnHOpbsuTCrJSbEe5hhAduzEA1iIRrOzxFGJhYqn1s3RIaSz08MYiM8Y0gjiUjhXTBr/n9D8pSVY7d1mJP93CRQj3f5vb/79WXsFweyfTN/ICaojAO2ii5rnA== 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=LZ2+i3DZIAhYdVLdS8HHfzM9+Lb/trJYF/SR+V1w3lE=; b=Gj1eROWD52R7TN69pRTcDfqwXO6QJuLRlEK7iVgOTJF47b/4YRx7bATPi4uUlPo321Drenz/F+nYXgy1BgmQ+X11gpUCdNEnrmS4HGNZGmF4nHA2k4nJD7yqy1YEOolb7Jz/ZPfM00xi5d36T+aW/mLxUhnNmGXqtjEYTTPyp+udxUwqX/meYfWt0aSCpCUmZoHY0XO4gU/9R3VXhaM6AjCADPFHqc6+EAAh/vceouzNOULT57jiJ8fO8W+JAe9TRXsWMFn/LObeI3OpnimwUdwLZrkq79e/nWH6xIsF+W4EZpA1GiB325FfOTFSBWyEYY3yCvacc4CLx6oNGC+JHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM9P192CA0009.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:21d::14) by DB9PR08MB6538.eurprd08.prod.outlook.com (2603:10a6:10:23d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21; Fri, 19 May 2023 10:25:16 +0000 Received: from AM7EUR03FT056.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:21d:cafe::5d) by AM9P192CA0009.outlook.office365.com (2603:10a6:20b:21d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.21 via Frontend Transport; Fri, 19 May 2023 10:25:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by AM7EUR03FT056.mail.protection.outlook.com (100.127.140.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6411.19 via Frontend Transport; Fri, 19 May 2023 10:25:16 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Fri, 19 May 2023 10:25:13 +0000 Received: from e129171.cambridge.arm.com (10.1.37.65) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Fri, 19 May 2023 10:25:13 +0000 To: <gdb-patches@sourceware.org> Subject: [PATCH v2 14/17] [gdb/generic] corefile/bug: Fixup (gcore) core file target description reading order Date: Fri, 19 May 2023 11:25:05 +0100 Message-ID: <20230519102508.14020-15-luis.machado@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230519102508.14020-1-luis.machado@arm.com> References: <20230519102508.14020-1-luis.machado@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: AM7EUR03FT056:EE_|DB9PR08MB6538:EE_|DBAEUR03FT065:EE_|AS8PR08MB6232:EE_ X-MS-Office365-Filtering-Correlation-Id: 626dd51e-8ebb-4ff7-08bf-08db58535d27 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: JIU37ozDIbcVsjgVDVdg6dn2+1f+3yoBo62fV/uTE6Q6370P85LQ2TRmsH55MfHs6R8TpOXL0t+vG6nnqiTiQ5Z5Qx0MS1Ep86pMaFyOP92MHbP0YYpwSEm1f87ePAKU4+626x8AiQHftbDLa5FzvzAP5kkMCIWD8Mshuw80y3U+sYVwzkpgJeKkV7kXQafxMsikZkBpiGMV03SuA4BwwyVE1YWehv7h7KcdWu+kHUjuWWCgvomzTlgqK0VbAXtZyJyWNyvPWBYQDgVb0iA9jE0fI/MGGzHHPAYj3GSeztAzMhr8+s7l+IR3PMx4nGPMVgw1iw09VxMEOX50tYaXpWZFTFB8/czs1SNth65bj1oDxXqtw/napwTTCk93Tbes2OY9EuHVALoXE5Ckr59PvlWTP4994jwBTZBjhAQf83swhTIt0GV4MU/uXJt+MFkRr1SVS+nDbv4h3jO+ej7N8wkFs6NmUTVv7fbYxa+e3ZSa0OppnDDfdA97ldtBGI7/sQEo884MjUBvBSmQrp1nc7ocLmPSRJZecPF2AAmMkSt/ysHemALzLL5YKW6peBClvXNsuLo2B/1/T+gau3LP/G+VrJXnegL2NEgwtNpwDLOiX1AHUKE7o1Fkf3NoO7GE2EEj6ZYAGkTIFgKdax/+JvaaxfLL4B3Ia0NCxH/rcsmGstT61chSbcmOUqxXU94Brsxacrvm5tz68QTANIUqttOTGT15rEAgcuKZBcI/SzyqiJOFsfmfeMff0ELvzl4gyFKdUw2NY0lPp7vZFU2UhgYf2ILIJ1GFc0jhauBeV/0= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230028)(4636009)(346002)(136003)(376002)(39860400002)(396003)(451199021)(46966006)(40470700004)(36840700001)(40460700003)(70586007)(70206006)(478600001)(6916009)(316002)(36756003)(86362001)(83380400001)(47076005)(26005)(2616005)(186003)(336012)(426003)(36860700001)(1076003)(5660300002)(41300700001)(8936002)(8676002)(44832011)(2906002)(7696005)(40480700001)(6666004)(82310400005)(81166007)(356005)(82740400003)(41533002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6538 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT065.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 918abbc2-12bc-4fa3-0ad3-08db585356bf X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9ARNxiAMw7yr7Tnm29p1x+27tQdsFpmMTEqGLHlm1oLvhCNlw4c2aZWhTV41HAlcj0FM43e4jE+CYQ7K2ciMxlWxcjJ25K5L551Dvvaq4MhxKZ4bok71HUchWkZ2VuHL/4AfYmYqZlQjPUE1I9qhahqX6GEMPYtOUpUlQTjjLMsGsx7AN+89GSdMhYis3ZrJLmktUA5oeUGtj/d7OOphK3qFMyfupnPh+19hvV2mEZYPCmDQ8eWcK9SjhP6xqQ2FZ+Wk9JptFC0L605K5XYC47ze8L/xTkTXEuG89XSi/Z4XuBxcfh/SaJIs2shSKI+gXuC5pKcOV3RRswrVv3VJZw/z37SLOOfX3LXSZsyaQhy0mjLq8kgGRlVhcKuIrsxMNme5hIz1v8oQ8bAUHkq+LiTEMCw5RoMXsvlB4BhwvTsyrNyHtQw/lpBQlvMeBc9EGRkfk3XEvW2lsO/qoqMA0YAtYWm0pqE7ZaJwToLItFqJvgWZdqsLhZcUncPVsnLQj0Yj12+BS/HmKVLf1sZo/Ys0OlD/Lko5O/D804985evQH2GwrIkJWTIlmXTEphF6/lyfqDqMQOUELx56WBpl1v0PjQSD6JDY4g65yM30Nv2JxMwCr8srBwbZ6VSRr5KmkmXKvAKNoPJgTbvk5pAymCiOgj9I0Z+lyC/5j3kcxZ4ZlNTnN9C6rl7HDLq+1FQKCem87i9aSiNhByjrb9t6JlOE8u+7PgYKBCAI6u2O122+b5Cvr3qkKhMtwAKXDbvy1DqFeJGLdWwsfzQZyIzQIA== 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)(39860400002)(376002)(396003)(451199021)(40470700004)(36840700001)(46966006)(336012)(86362001)(36756003)(40480700001)(82310400005)(8936002)(26005)(8676002)(1076003)(2616005)(44832011)(426003)(5660300002)(186003)(316002)(70206006)(6916009)(70586007)(41300700001)(7696005)(478600001)(6666004)(81166007)(82740400003)(47076005)(83380400001)(36860700001)(2906002)(40460700003)(41533002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 10:25:27.1269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 626dd51e-8ebb-4ff7-08bf-08db58535d27 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: DBAEUR03FT065.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6232 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, 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.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Luis Machado via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Luis Machado <luis.machado@arm.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
SME support for AArch64 gdb/gdbserver on Linux
|
|
Commit Message
Luis Machado
May 19, 2023, 10:25 a.m. UTC
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 db489b4280e..e3ad9772869 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -1078,6 +1078,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; @@ -1101,15 +1116,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 (); }