From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id EcqaCLsKr2kRhSAAWB0awg (envelope-from ) for ; Mon, 09 Mar 2026 14:00:27 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=AgwSsPmr; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=AgwSsPmr; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1D1601E09A; Mon, 09 Mar 2026 14:00:27 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 E723F1E0E1 for ; Mon, 09 Mar 2026 14:00:16 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 6F1934B9DB55 for ; Mon, 9 Mar 2026 18:00:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6F1934B9DB55 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=AgwSsPmr; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=AgwSsPmr Received: from PA4PR04CU001.outbound.protection.outlook.com (mail-francecentralazon11013014.outbound.protection.outlook.com [40.107.162.14]) by sourceware.org (Postfix) with ESMTPS id CA4F54B9DB47 for ; Mon, 9 Mar 2026 17:58:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CA4F54B9DB47 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CA4F54B9DB47 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=40.107.162.14 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1773079100; cv=pass; b=PqxtgANkjw45KmDJp60NiqPApzaERZNCLCjuxZsIDnpyqzDpnnRRPnZqWDAFB/EuZ5IbcfTdgZ/Lh6pEeREKZphcIhc5pn/Y84v3SEXOLQllJ8GUxSE4/Hg3AiAD1FYIfCw1CMJjXkcCxCSEnNzXKlIQbpcTNb6YXKax1cwixDc= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1773079100; c=relaxed/simple; bh=1+6P5gxyjHFG3MIzX6DB/Y2jcJuohopf/OWvXMKvCoo=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=UU2h72WymC0ZrnMO7Hh9q+hwLuwb0XaXYWuC088IC0PglH/cbgq2tOXKOWsQGmy/2pwFprmr7wCqLM09fLAAEomSUtQgMxmkWRNEi32H+TM4r6/OGOjqc8H+UNyOobwooS5R6w0FvK5Z3LOEjZwt0WpGYJaf+iID3A6bjjX44FE= ARC-Authentication-Results: i=3; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA4F54B9DB47 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=lEGYg0jnWr9NMnW2X/+aNq+uqoC8gBu00ufeVGKrfpgFoZ1YGah8tPQzRYJZvLDye6/jN+rhgB2anTT/nhtRkjn/DQAOv9oZf+wcnfZ67ud3WATmGfcwctsyAUo7TzRpT1kXZd++5vaQ8lrq6NT0xZNj7ir9rU6e8dSzHfiRHD5VRoSL+a9ekG4gz2d1YRSGS9f2xp8SvJMUT1XD4uP3T0ssFraVY8wDLbtIbD0sQ67JeoffGo5XN9uE5uWLmrO4++4oFhyrHm08AuLDuw2mqJGpLnrxA8tNote6Q4soVJj7bCD13of6IrtXKKgZSJIslusJRHKvSF+Lg6w/hLr5HA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=1nF4YWXibpQCOAUmLBHPAnokZVMJPtV6o2Cm2ZLXPF4=; b=MCGJDryHgtndnLnIi2Y5car8tOavksIRh0rHXHhRt1fIMjc7eTQpb0JBxwDBQhBC8geOirlRsFWgO5OA4t1KOvCkZ9SKrtKqNYqW6ekdYfXDEMhnmHw/pyeEcQl4H/pq7QEhSYaFVjzfXLFxRmzxyxAsglfFBeuF0hfbwndl5MCPU/F+2CtZcY7jcwVNaY8W/FXaB4mRk2VK9ymLUFtzTgdRgJchOzGSXvSBVAdlRj12wnY+WcTXnVpeYYCFWT124lpbCI28bT4a1sQfL+62skH0qLornCy+b3n2Xy1ChHzLChwmV8Cjx5Nk//jKFx4eBEuQe1qI5XFwaIWIJSExvQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1nF4YWXibpQCOAUmLBHPAnokZVMJPtV6o2Cm2ZLXPF4=; b=AgwSsPmrC7mPs8qmq3ewpUPbZMFWnsGDEDp78C9eAhUwewbShx+VRa3voAaq548W1uwkHXYxlEJfQDgcCXEebhImb6ObEDq16ltLjNVVTFWi/xUNGB7Qs/1g+oyOgsTbt/b4ZZmzoQlgbYDFfD+iNivtg5jy5HOo8FxaRxEuAuk= Received: from AS4P190CA0049.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:656::20) by DU0PR08MB8017.eurprd08.prod.outlook.com (2603:10a6:10:3e4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9678.25; Mon, 9 Mar 2026 17:58:05 +0000 Received: from AM1PEPF000252E1.eurprd07.prod.outlook.com (2603:10a6:20b:656:cafe::98) by AS4P190CA0049.outlook.office365.com (2603:10a6:20b:656::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9678.25 via Frontend Transport; Mon, 9 Mar 2026 17:58:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by AM1PEPF000252E1.mail.protection.outlook.com (10.167.16.59) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9678.18 via Frontend Transport; Mon, 9 Mar 2026 17:58:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NJx+z+v4DX1ugO+lxkIiVKmDdnGjuvYk43ipOBcIJ5dP+ctS2yKfGUG5CmdXztikCDpDAwKqU+v03UzyqapYqMQLQabCY7wPSHg2EB7Sv+V+0NwCwy6BtYWBq+Eh8VGVeItHMceu/8ClyPii50ZIaWyvsRW+WJS3WZpCiGv8Jrs6JYeddvHilofyiXUPUOgMiaAy5IojkuPr62pUw6CCFYukPU1lylKOldzZ1thtVmWZOYMzFLXa/PLbhO6Csu7Y6MozDE6umGM+c1XdXG+S7zwH780n5pJgEFj4l8yvO+uH2TOFWPI+/05vsRVLpGFkRpEs/8VjQX8sRYhkmrwQuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=1nF4YWXibpQCOAUmLBHPAnokZVMJPtV6o2Cm2ZLXPF4=; b=gouI96vXplOCmzG0Cp0vCSpzQ05kni1Yuicd+s00xRNBbK8uUL57cGYsmjYBXN5dCwP6nuiKCSLHQjYBPRziZFgX8gKYewFocpDtu/gnfqowT4QBNBDjaj61slFd2QvQXB6miLrNFCruFynYjUKMYQ0Bpyn73fQvUfXDwnOfr2dzYVrOA/0rcAVxtqAnUTmA8PGxBzTilbIG54as9+XMSpoNJ0+mjadoKyQ6WbH5jI6sCFEAvhxuMf3qs+M9bvvmUzl/CM8MaXl3+xoyoFa6M7qaSz+IsL19+hmeGCig2tkOMMpa7qnhhlzGR3Gpd9Ki481hY/JWuNy16PKvMX3Mbw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 172.205.89.229) 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 (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1nF4YWXibpQCOAUmLBHPAnokZVMJPtV6o2Cm2ZLXPF4=; b=AgwSsPmrC7mPs8qmq3ewpUPbZMFWnsGDEDp78C9eAhUwewbShx+VRa3voAaq548W1uwkHXYxlEJfQDgcCXEebhImb6ObEDq16ltLjNVVTFWi/xUNGB7Qs/1g+oyOgsTbt/b4ZZmzoQlgbYDFfD+iNivtg5jy5HOo8FxaRxEuAuk= Received: from DUZPR01CA0213.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b4::27) by AMDPR08MB11483.eurprd08.prod.outlook.com (2603:10a6:20b:716::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9678.24; Mon, 9 Mar 2026 17:56:59 +0000 Received: from DB5PEPF00014B9D.eurprd02.prod.outlook.com (2603:10a6:10:4b4:cafe::9e) by DUZPR01CA0213.outlook.office365.com (2603:10a6:10:4b4::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9678.25 via Frontend Transport; Mon, 9 Mar 2026 17:56:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 172.205.89.229) 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 172.205.89.229 as permitted sender) receiver=protection.outlook.com; client-ip=172.205.89.229; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (172.205.89.229) by DB5PEPF00014B9D.mail.protection.outlook.com (10.167.8.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9678.18 via Frontend Transport; Mon, 9 Mar 2026 17:56:58 +0000 Received: from AZ-NEU-EX04.Arm.com (10.240.25.138) by AZ-NEU-EX03.Arm.com (10.240.25.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Mon, 9 Mar 2026 17:56:58 +0000 Received: from PF4S4363.arm.com (10.57.58.75) by mail.arm.com (10.240.25.138) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Mon, 9 Mar 2026 17:56:57 +0000 From: Matthieu Longo To: , Tom Tromey CC: Matthieu Longo Subject: [PATCH v3 3/7] gdb: add new helpers for retrieving a type's fully qualified name Date: Mon, 9 Mar 2026 17:56:20 +0000 Message-ID: <20260309175624.236491-4-matthieu.longo@arm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260309175624.236491-1-matthieu.longo@arm.com> References: <20260309175624.236491-1-matthieu.longo@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9D:EE_|AMDPR08MB11483:EE_|AM1PEPF000252E1:EE_|DU0PR08MB8017:EE_ X-MS-Office365-Filtering-Correlation-Id: 7e35008e-0af6-4ebd-8474-08de7e0569ee x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|1800799024|36860700016|376014|82310400026|13003099007; X-Microsoft-Antispam-Message-Info-Original: cVjctEy8+WBrDRlwCgXEJ9Vs84NnswXSCA0w6UdX9mY29vZfW6jlmgti+OFtwioC1I8TaaFfLbpYgtEPRHpGcaVVcd3CUuOZu06FSHoF/+faCg0ew4mjD0mfjJKJBDfdkKuZSx4se459CnrnbDbjHWmAmzPKhb8HUksAw5G+bQoY8mAHxMy7SghT2t72kwK31U9jaChU4N0cQ4+qoQThsSBlRiAX4j280hEOtSqR2N6pIWm6pc9guEcdrQ5Xh4VK1PHmK3kefG6qhVQOgoVjONvgu6xq56pIsFRtea2gq8Nz8Bb6DLg++6c0CeEXH8VjMwK76CYGHlE23ZCUUURe60DWEYnfBrXkkdnTtSzGcnaPDqPbV2ln5VhfYJyQpxGr2iC5kvVpdMCyLxfIqC04PXZFp+pas5Fqn5Sn0fFAB8S64aO2RKgtN6AIndCEpOTJbfMjOpsUJLINsx+nQ2XVC5lsdU4c9fH8KkjA15RpKnPDoS2NJXEdgpMFjjf0NW4kbNMxtFloT32xTP0ZMZ1p1M+PevDpn+exRlgY1P48UCCGGVOc1A0zV414kyLTPiAPfDRLdNd2KK+0vPBEf3wx8/UYqrUKrHJzGvoucWFSOKbVAweAgUdNu/JkToxLbLAvTA2wJkJpzVUQgXS2vvt8d8JhNytfhl7CY0NoGMfqsCEU3nBJvBSirs7zUggFHp/GqkSJfMsznCw5b+1i9jatP3GSjTD3/4uG/HYsOI7wlas= X-Forefront-Antispam-Report-Untrusted: CIP:172.205.89.229; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(1800799024)(36860700016)(376014)(82310400026)(13003099007); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: is7jpPswLvtLR1njowtBU5pAoOj15PYalCCFTXsG1gfC15sU4uhmqyr5DAhy2i0e+XCUEAeegP8B6GB2bpvBsINukig5hJXpc18BEH15T4LxR8XZd8qzpDV1NeHdGoOrmhG0u86ucGe997G7uxrLBHc0JfVmCmwpPh4LAVAjrOivC6VS6LYit1HJ/sBVStRcVpV7xnBnJAu+hTvu1RWni+0Oo9ozaqojB0EzQ+lfbyE/z5V0dPTH4WtgLfTdfnKQrAOHols5KXMhNCZWwXvekw5qmA8xujt+RS58GV3hGCvaSbM9oE0Way4fLgQEy4FDnRgO+ytV5Bk5+IQ1f4PhuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AMDPR08MB11483 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM1PEPF000252E1.eurprd07.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: e5cab738-27b5-4fd1-0a8f-08de7e054292 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|14060799003|36860700016|1800799024|35042699022|13003099007; X-Microsoft-Antispam-Message-Info: SpZ4kwVbjuYOcAdd5V05Zg3qWhRR70BuVKFCc11SfeMKLaqRN7vFbfLaEoOyYcJR1wDzX4mN7HIzQszux4Zr2ImSA0o4zFC8DsQAvUAnzCA7wSxeMqfg5tOipMYXxJccWoJLXGqApkeGPi35Cj2+g2dryig/X+es3yB26JTAqLgO0X0VEyLoqsn/7dSYynrf4e7tSdAzEiIrph5mzk81OQS6MchNKy0noXNek0Y7mGTO1GQINKEk/TKQzO0jUpmvjg97t/yq3Ifq34H5yE7DmSKi89VPn6J24rVh/Av1yWQclbSmRWtBlM18HyIBILQDcESIIekxS8/30HCOgGxnjdbQ4tNaE9ycN4/MVby185SkdJvjJpmx87iygpgWwt/uFjxFTFn9ydJsDixh+V/I4LbTnsP3XcxTpFyz49WF+IPgL2vqSKegQdlYh5bADjsqCTXm/qBhWzErm0xTS5YZJ6hSFEVaIi0OhBf1czbgD5vuaWEj6G51whoHsIUWg9eg9ldslXwcBJCq18aRL5RRPryrdXmavPv8Pa/NWK6bUeMiS0Gfn24+baRphFOYhIhv6W5U9U0cXiWvKWOU9Vwj0zyVEfgFFK0WfKGU9JZtY0Rc698l/BsYrUh6SEOFiXmwCgUZo2jzGWPL3m1RFJRkMbmEQeX8GswAQHaWpunr/CPuW/D8ERXrBKHsLEmUxM45e4bQ8U8nWwO8h3H2+PSNU4oi2qvxMN5JFVggy8Q5Jns= X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(14060799003)(36860700016)(1800799024)(35042699022)(13003099007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XbKsGH2kBGtqO5RzLg50muQheAdZxvDrCzKGASGmIhiv+fK9fbt4AdX2P9rH87ZuCBHOmggAGl/KlmT09imtZwKXXYMaljatBQQOLnCJYW7Nsyrg7gI2TGkd1s8vQPf811JgcFQxp768TmypHpMoXn/2CKDTlPH6y1XWnenDLEiuMUno8io3o8nPQX+P+DdJcRKbVb7v83+wqXWRjANQteQioqbzOdgQcizgga4aWzZF+ETp/2vTsxZB2e6aoFFuwx+s99GxTrsD8SZSHfDRhktnf5tsC4grfF0FZtis6kTkNwYUAbdXhmzt6a6qxLI838Bz7UtghVyS/kUMCmQHaLpiLCFxthU5W1+Yses+CFGQYszDJloeB/5WNCMIYjFMfInWf+8IOYGeCMyT0XlBVuFFBN7wKbRsXTMDmLW9U2HDtrKCBi2L5rixD6mYjG8e X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Mar 2026 17:58:04.9773 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e35008e-0af6-4ebd-8474-08de7e0569ee X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: AM1PEPF000252E1.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB8017 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: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Py_TYPE (self)->tp_name is the traditional idiomatic way to get a Python type's fully qualified name. However, in the context of the Python limited API, PyTypeObject is opaque, so the 'tp_name' attribute is no longer accessible. Additionally, retrieving the type of a Python object requires Py_TYPE, which is only available as part of the stable API starting with Python 3.14. This patch increases minimal Python limited API version from 3.11 to 3.14. It also introduces two new helpers to retrieve a type's fully qualified name: gdb_py_tp_name() and gdbpy_py_obj_tp_name(), which extract the fully qualified name from a PyTypeObject and a PyObject, respectively. Ifdefery allows these wrappers to select the appropriate API depending on the Python version and whether the Python limited API is enabled. For any Python version less than 3.13, gdb_py_tp_name() fallbacks using __qualname__ instead. However, the result may differ slightly in some cases, e.g. the module name may be missing. Finally, this patch adapts the existing code to use these wrappers, and adjusts some test expectations to use the fully qualified name (or __qualname__ for versions <= 3.13) where it was not previously used. Note that the corner case where the module name would be missing does not appear in the testsuite. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23830 --- gdb/Makefile.in | 1 + gdb/configure | 10 +-- gdb/configure.ac | 10 +-- gdb/python/py-arch.c | 3 +- gdb/python/py-block.c | 3 +- gdb/python/py-breakpoint.c | 9 ++- gdb/python/py-connection.c | 2 +- gdb/python/py-corefile.c | 2 +- gdb/python/py-disasm.c | 17 ++--- gdb/python/py-frame.c | 4 +- gdb/python/py-infthread.c | 2 +- gdb/python/py-mi.c | 2 +- gdb/python/py-micmd.c | 2 +- gdb/python/py-obj-type.c | 74 ++++++++++++++++++++++ gdb/python/py-obj-type.h | 29 +++++++++ gdb/python/py-style.c | 14 ++-- gdb/python/py-symbol.c | 3 +- gdb/python/py-type.c | 3 +- gdb/python/py-unwind.c | 8 +-- gdb/python/py-utils.c | 4 +- gdb/python/python-internal.h | 6 +- gdb/python/python.c | 2 +- gdb/testsuite/gdb.python/py-disasm.exp.tcl | 8 +-- gdb/testsuite/gdb.python/py-unwind.exp | 2 +- 24 files changed, 167 insertions(+), 53 deletions(-) create mode 100644 gdb/python/py-obj-type.c create mode 100644 gdb/python/py-obj-type.h diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 2aa95be968a..4f5966de25c 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -422,6 +422,7 @@ SUBDIR_PYTHON_SRCS = \ python/py-micmd.c \ python/py-newobjfileevent.c \ python/py-objfile.c \ + python/py-obj-type.c \ python/py-param.c \ python/py-prettyprint.c \ python/py-progspace.c \ diff --git a/gdb/configure b/gdb/configure index dcd5c030713..3dbf2cc3262 100755 --- a/gdb/configure +++ b/gdb/configure @@ -28763,15 +28763,15 @@ fi if test "$enable_py_limited_api" = yes; then - # The minimal Python limited API version is currently set to 3.11 for the - # support of PyBuffer_FillInfo and PyBuffer_Release. + # The minimal Python limited API version is currently set to 3.14 for the + # support of Py_TYPE(). # The choice of the minimal version for the Python limited API won't be # frozen until the end of the migration. prog="import sys # split strings by '.' and convert to numeric. Append some zeros # because we need at least 4 digits for the hex conversion. # map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '3.11'.split('.'))) + [0, 0, 0] +minver = list(map(int, '3.14'.split('.'))) + [0, 0, 0] minverhex = 0 # xrange is not present in Python 3.0 and range returns an iterator for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[i] @@ -28783,12 +28783,12 @@ sys.exit(sys.hexversion < minverhex)" (exit $ac_status); }; then : -$as_echo "#define Py_LIMITED_API 0x030b0000" >>confdefs.h +$as_echo "#define Py_LIMITED_API 0x030e0000" >>confdefs.h else - as_fn_error $? "Python limited API support requires at least Python version 3.11" "$LINENO" 5 + as_fn_error $? "Python limited API support requires at least Python version 3.14" "$LINENO" 5 fi fi diff --git a/gdb/configure.ac b/gdb/configure.ac index 17f648d0b49..b7ae2f3bb3c 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1078,15 +1078,15 @@ AC_ARG_ENABLE([py-limited-api], [enable_py_limited_api=no]) if test "$enable_py_limited_api" = yes; then - # The minimal Python limited API version is currently set to 3.11 for the - # support of PyBuffer_FillInfo and PyBuffer_Release. + # The minimal Python limited API version is currently set to 3.14 for the + # support of Py_TYPE(). # The choice of the minimal version for the Python limited API won't be # frozen until the end of the migration. - AM_PYTHON_CHECK_VERSION([$python_prog], [3.11], [ - AC_DEFINE(Py_LIMITED_API, 0x030b0000, + AM_PYTHON_CHECK_VERSION([$python_prog], [3.14], [ + AC_DEFINE(Py_LIMITED_API, 0x030e0000, [Define if GDB should be built against the Python limited C API.]) ],[ - AC_MSG_ERROR([Python limited API support requires at least Python version 3.11]) + AC_MSG_ERROR([Python limited API support requires at least Python version 3.14]) ]) fi diff --git a/gdb/python/py-arch.c b/gdb/python/py-arch.c index f40d7da1763..d859d66dc82 100644 --- a/gdb/python/py-arch.c +++ b/gdb/python/py-arch.c @@ -338,7 +338,8 @@ archpy_repr (PyObject *self) auto arch_info = gdbarch_bfd_arch_info (gdbarch); return PyUnicode_FromFormat ("<%s arch_name=%s printable_name=%s>", - Py_TYPE (self)->tp_name, arch_info->arch_name, + gdbpy_py_obj_tp_name (self), + arch_info->arch_name, arch_info->printable_name); } diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c index 263819e1292..602e86c3766 100644 --- a/gdb/python/py-block.c +++ b/gdb/python/py-block.c @@ -485,7 +485,8 @@ blpy_repr (PyObject *self) if (++written_symbols < len) str += ", "; } - return PyUnicode_FromFormat ("<%s %s {%s}>", Py_TYPE (self)->tp_name, + return PyUnicode_FromFormat ("<%s %s {%s}>", + gdbpy_py_obj_tp_name (self), name, str.c_str ()); } diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 408d4b9d857..bdab68ec686 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -1065,9 +1065,11 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) static PyObject * bppy_repr (PyObject *self) { + const char *tp_name = gdbpy_py_obj_tp_name (self); + const auto bp = (struct gdbpy_breakpoint_object*) self; if (bp->bp == nullptr) - return PyUnicode_FromFormat ("<%s (invalid)>", Py_TYPE (self)->tp_name); + return PyUnicode_FromFormat ("<%s (invalid)>", tp_name); std::string str = " "; if (bp->bp->thread != -1) @@ -1079,7 +1081,7 @@ bppy_repr (PyObject *self) str.pop_back (); return PyUnicode_FromFormat ("<%s%s number=%d hits=%d%s>", - Py_TYPE (self)->tp_name, + tp_name, (bp->bp->enable_state == bp_enabled ? "" : " disabled"), bp->bp->number, bp->bp->hit_count, str.c_str ()); @@ -1771,7 +1773,8 @@ bplocpy_repr (PyObject *py_self) str += fn_name; } - return PyUnicode_FromFormat ("<%s %s>", Py_TYPE (self)->tp_name, + return PyUnicode_FromFormat ("<%s %s>", + gdbpy_py_obj_tp_name (py_self), str.c_str ()); } diff --git a/gdb/python/py-connection.c b/gdb/python/py-connection.c index 26cb6cdde57..a8bea4d832f 100644 --- a/gdb/python/py-connection.c +++ b/gdb/python/py-connection.c @@ -201,7 +201,7 @@ connpy_repr (PyObject *obj) return gdb_py_invalid_object_repr (obj); return PyUnicode_FromFormat ("<%s num=%d, what=\"%s\">", - Py_TYPE (obj)->tp_name, + gdbpy_py_obj_tp_name (obj), target->connection_number, make_target_connection_string (target).c_str ()); } diff --git a/gdb/python/py-corefile.c b/gdb/python/py-corefile.c index 88fedbd718c..762348121a7 100644 --- a/gdb/python/py-corefile.c +++ b/gdb/python/py-corefile.c @@ -362,7 +362,7 @@ cfpy_repr (PyObject *self) bfd *core_bfd = get_inferior_core_bfd (obj->inferior); gdb_assert (core_bfd != nullptr); return PyUnicode_FromFormat ("<%s inferior=%d filename='%s'>", - Py_TYPE (self)->tp_name, + gdbpy_py_obj_tp_name (self), obj->inferior->num, bfd_get_filename (core_bfd)); } diff --git a/gdb/python/py-disasm.c b/gdb/python/py-disasm.c index 7635e45db56..1c5661dd307 100644 --- a/gdb/python/py-disasm.c +++ b/gdb/python/py-disasm.c @@ -304,7 +304,7 @@ disasmpy_info_repr (PyObject *self) const char *arch_name = (gdbarch_bfd_arch_info (obj->gdbarch))->printable_name; return PyUnicode_FromFormat ("<%s address=%s architecture=%s>", - Py_TYPE (obj)->tp_name, + gdbpy_py_obj_tp_name (self), core_addr_to_string_nz (obj->address), arch_name); } @@ -995,7 +995,7 @@ disasmpy_result_init (PyObject *self, PyObject *args, PyObject *kwargs) { PyErr_Format (PyExc_ValueError, _("Cannot use 'string' and 'parts' when creating %s."), - Py_TYPE (self)->tp_name); + gdbpy_py_obj_tp_name (self)); return -1; } @@ -1079,7 +1079,7 @@ disasmpy_result_repr (PyObject *self) gdb_assert (obj->parts != nullptr); return PyUnicode_FromFormat ("<%s length=%d string=\"%U\">", - Py_TYPE (obj)->tp_name, + gdbpy_py_obj_tp_name (self), obj->length, disasmpy_result_str (self)); } @@ -1294,7 +1294,7 @@ gdbpy_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr, PyErr_Format (PyExc_TypeError, _("Result from Disassembler must be gdb.DisassemblerResult, not %s."), - Py_TYPE (result.get ())->tp_name); + gdbpy_py_obj_tp_name (result.get ())); gdbpy_print_stack (); return std::optional (-1); } @@ -1381,8 +1381,9 @@ disasmpy_dealloc_result (PyObject *self) static int disasmpy_part_init (PyObject *self, PyObject *args, PyObject *kwargs) { - PyErr_SetString (PyExc_RuntimeError, - _("Cannot create instances of DisassemblerPart.")); + PyErr_Format (PyExc_RuntimeError, + _("Cannot create instances of %s."), + gdbpy_py_obj_tp_name (self)); return -1; } @@ -1419,7 +1420,7 @@ disasmpy_text_part_repr (PyObject *self) gdb_assert (obj->string != nullptr); return PyUnicode_FromFormat ("<%s string='%s', style='%s'>", - Py_TYPE (obj)->tp_name, + gdbpy_py_obj_tp_name (self), obj->string->c_str (), get_style_name (obj->style)); } @@ -1462,7 +1463,7 @@ disasmpy_addr_part_repr (PyObject *self) disasm_addr_part_object *obj = (disasm_addr_part_object *) self; return PyUnicode_FromFormat ("<%s address='%s'>", - Py_TYPE (obj)->tp_name, + gdbpy_py_obj_tp_name (self), core_addr_to_string_nz (obj->address)); } diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 23d8eff661f..1420d2ac5b9 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -95,7 +95,7 @@ frapy_repr (PyObject *self) const frame_id &fid = frame_obj->frame_id; return PyUnicode_FromFormat ("<%s level=%d frame-id=%s>", - Py_TYPE (self)->tp_name, + gdbpy_py_obj_tp_name (self), frame_relative_level (f_info), fid.to_string ().c_str ()); } @@ -544,7 +544,7 @@ frapy_read_var (PyObject *self, PyObject *args, PyObject *kw) { PyErr_Format (PyExc_TypeError, _("argument 1 must be gdb.Symbol or str, not %s"), - Py_TYPE (sym_obj)->tp_name); + gdbpy_py_obj_tp_name (sym_obj)); return NULL; } diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c index 652355990ee..0f29e9fb7a4 100644 --- a/gdb/python/py-infthread.c +++ b/gdb/python/py-infthread.c @@ -355,7 +355,7 @@ thpy_repr (PyObject *self) thread_info *thr = thread_obj->thread; return PyUnicode_FromFormat ("<%s id=%s target-id=\"%s\">", - Py_TYPE (self)->tp_name, + gdbpy_py_obj_tp_name (self), print_full_thread_id (thr), target_pid_to_str (thr->ptid).c_str ()); } diff --git a/gdb/python/py-mi.c b/gdb/python/py-mi.c index 5189bda944e..27c79d60636 100644 --- a/gdb/python/py-mi.c +++ b/gdb/python/py-mi.c @@ -379,7 +379,7 @@ gdbpy_notify_mi (PyObject *self, PyObject *args, PyObject *kwargs) PyErr_Format (PyExc_ValueError, _("MI notification data must be either None or a dictionary, not %s"), - Py_TYPE (data)->tp_name); + gdbpy_py_obj_tp_name (data)); return nullptr; } diff --git a/gdb/python/py-micmd.c b/gdb/python/py-micmd.c index 0c820751c56..dac8234f095 100644 --- a/gdb/python/py-micmd.c +++ b/gdb/python/py-micmd.c @@ -510,7 +510,7 @@ micmdpy_set_installed (PyObject *self, PyObject *newvalue, void *closure) { PyErr_Format (PyExc_TypeError, _("gdb.MICommand.installed must be set to a bool, not %s"), - newvalue == Py_None ? "None" : Py_TYPE(newvalue)->tp_name); + newvalue == Py_None ? "None" : gdbpy_py_obj_tp_name (newvalue)); return -1; } diff --git a/gdb/python/py-obj-type.c b/gdb/python/py-obj-type.c new file mode 100644 index 00000000000..ea0b59a8447 --- /dev/null +++ b/gdb/python/py-obj-type.c @@ -0,0 +1,74 @@ +/* Helpers related to Python object type + + Copyright (C) 2026 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "python-internal.h" +#include "py-obj-type.h" + +/* Return the type's fully qualified name from a PyTypeObject. */ +const char * +gdb_py_tp_name (PyTypeObject *py_type) noexcept +{ +#if PY_VERSION_HEX >= 0x030d0000 + /* Note: PyType_GetFullyQualifiedName() was added in version 3.13, and is + part of the stable ABI since version 3.13. */ + PyObject *fully_qualified_name = PyType_GetFullyQualifiedName (py_type); + if (fully_qualified_name == nullptr) + return nullptr; + + return PyUnicode_AsUTF8AndSize (fully_qualified_name, nullptr); + +#else /* PY_VERSION_HEX < 0x030d0000 && ! defined (Py_LIMITED_API) */ + /* For non-heap types, the fully qualified name corresponds to tp_name. */ + if (! (PyType_GetFlags (py_type) & Py_TPFLAGS_HEAPTYPE)) + return py_type->tp_name; + + /* In the absence of PyType_GetFullyQualifiedName(), we fallback using + __qualname__ instead. However, the result may differ slightly in some + cases, e.g. the module name may be missing. */ + +# if PY_VERSION_HEX >= 0x030b0000 + /* Note: PyType_GetQualName() was added in version 3.11. */ + PyObject *qualname = PyType_GetQualName (py_type); + if (qualname == nullptr) + return nullptr; + + return PyUnicode_AsUTF8AndSize (qualname, nullptr); + +# else + /* In the absence of PyType_GetQualName(), fallback on using PyHeapTypeObject + which is not part of the public API. + Tested on 3.10 which is the oldest supported version at the time of this + writing, i.e. February 2026. Hopefully, this workaround should go away + when the minimum supported Python version is increased above 3.10. */ + PyHeapTypeObject *ht = (PyHeapTypeObject *) py_type; + if (ht->ht_qualname == nullptr) + return nullptr; + + return PyUnicode_AsUTF8AndSize (ht->ht_qualname, nullptr); +# endif +#endif +} + +/* Return the type's fully qualified name from a PyObject. */ +const char * +gdbpy_py_obj_tp_name (PyObject *self) noexcept +{ + /* Note: Py_TYPE () is part of the stable ABI since version 3.14. */ + return gdb_py_tp_name (Py_TYPE (self)); +} diff --git a/gdb/python/py-obj-type.h b/gdb/python/py-obj-type.h new file mode 100644 index 00000000000..293647fabfb --- /dev/null +++ b/gdb/python/py-obj-type.h @@ -0,0 +1,29 @@ +/* Helpers related to Python object type + + Copyright (C) 2026 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef GDB_PYTHON_PY_OBJ_TYPE_H +#define GDB_PYTHON_PY_OBJ_TYPE_H + +/* Return the type's fully qualified name from a PyTypeObject. */ +extern const char *gdb_py_tp_name (PyTypeObject *py_type) noexcept; + +/* Return the type's fully qualified name from a PyObject. */ +extern const char *gdbpy_py_obj_tp_name (PyObject *self) noexcept; + +#endif /* GDB_PYTHON_PY_OBJ_TYPE_H */ diff --git a/gdb/python/py-style.c b/gdb/python/py-style.c index aa6eccaadbe..e0b40fe6844 100644 --- a/gdb/python/py-style.c +++ b/gdb/python/py-style.c @@ -268,7 +268,7 @@ stylepy_init_from_parts (PyObject *self, PyObject *fg, PyObject *bg, PyErr_Format (PyExc_TypeError, _("'foreground' argument must be gdb.Color or None, not %s."), - Py_TYPE (fg)->tp_name); + gdbpy_py_obj_tp_name (fg)); return -1; } @@ -277,7 +277,7 @@ stylepy_init_from_parts (PyObject *self, PyObject *fg, PyObject *bg, PyErr_Format (PyExc_TypeError, _("'background' argument must be gdb.Color or None, not %s."), - Py_TYPE (bg)->tp_name); + gdbpy_py_obj_tp_name (bg)); return -1; } @@ -484,7 +484,7 @@ stylepy_set_foreground (PyObject *self, PyObject *newvalue, void *closure) if (!gdbpy_is_color (newvalue)) { PyErr_Format (PyExc_TypeError, _("value must be gdb.Color, not %s"), - Py_TYPE (newvalue)->tp_name); + gdbpy_py_obj_tp_name (newvalue)); return -1; } @@ -542,7 +542,7 @@ stylepy_set_background (PyObject *self, PyObject *newvalue, void *closure) if (!gdbpy_is_color (newvalue)) { PyErr_Format (PyExc_TypeError, _("value must be gdb.Color, not %s"), - Py_TYPE (newvalue)->tp_name); + gdbpy_py_obj_tp_name (newvalue)); return -1; } @@ -624,7 +624,7 @@ stylepy_set_intensity (PyObject *self, PyObject *newvalue, void *closure) PyErr_Format (PyExc_TypeError, _("value must be a Long (a gdb.INTENSITY constant), not %s"), - Py_TYPE (newvalue)->tp_name); + gdbpy_py_obj_tp_name (newvalue)); return -1; } @@ -734,12 +734,12 @@ stylepy_repr (PyObject *self) if (style_obj->style_name == nullptr) return PyUnicode_FromFormat ("<%s fg=%s, bg=%s, intensity=%s>", - Py_TYPE (self)->tp_name, + gdbpy_py_obj_tp_name (self), fg_str.get (), bg_str.get (), intensity_str); else return PyUnicode_FromFormat ("<%s name='%s', fg=%s, bg=%s, intensity=%s>", - Py_TYPE (self)->tp_name, + gdbpy_py_obj_tp_name (self), style_obj->style_name, fg_str.get (), bg_str.get (), intensity_str); } diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index fe4d6dac000..e74c8e4b368 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -384,7 +384,8 @@ sympy_repr (PyObject *self) if (symbol == nullptr) return gdb_py_invalid_object_repr (self); - return PyUnicode_FromFormat ("<%s print_name=%s>", Py_TYPE (self)->tp_name, + return PyUnicode_FromFormat ("<%s print_name=%s>", + gdbpy_py_obj_tp_name (self), symbol->print_name ()); } diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 7ba77ad1d4a..ec4126d0589 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -1084,7 +1084,8 @@ typy_repr (PyObject *self) auto py_typename = PyUnicode_Decode (type_name.c_str (), type_name.size (), host_charset (), NULL); - return PyUnicode_FromFormat ("<%s code=%s name=%U>", Py_TYPE (self)->tp_name, + return PyUnicode_FromFormat ("<%s code=%s name=%U>", + gdbpy_py_obj_tp_name (self), code, py_typename); } diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index 9ffa382d093..dcf86f7db3d 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -247,7 +247,7 @@ unwind_infopy_repr (PyObject *self) if (frame == nullptr) return PyUnicode_FromFormat ("<%s for an invalid frame>", - Py_TYPE (self)->tp_name); + gdbpy_py_obj_tp_name (self)); std::string saved_reg_names; struct gdbarch *gdbarch = pending_frame->gdbarch; @@ -262,7 +262,7 @@ unwind_infopy_repr (PyObject *self) } return PyUnicode_FromFormat ("<%s frame #%d, saved_regs=(%s)>", - Py_TYPE (self)->tp_name, + gdbpy_py_obj_tp_name (self), frame_relative_level (frame), saved_reg_names.c_str ()); } @@ -456,7 +456,7 @@ pending_framepy_repr (PyObject *self) } return PyUnicode_FromFormat ("<%s level=%d, sp=%s, pc=%s>", - Py_TYPE (self)->tp_name, + gdbpy_py_obj_tp_name (self), frame_relative_level (frame), sp_str, pc_str); @@ -924,7 +924,7 @@ frame_unwind_python::sniff (const frame_info_ptr &this_frame, gdb_assert (pyo_unwind_info != nullptr); if (!PyObject_TypeCheck (pyo_unwind_info, &unwind_info_object_type)) error (_("an Unwinder should return gdb.UnwindInfo, not %s."), - Py_TYPE (pyo_unwind_info)->tp_name); + gdbpy_py_obj_tp_name (pyo_unwind_info)); { unwind_info_object *unwind_info = diff --git a/gdb/python/py-utils.c b/gdb/python/py-utils.c index 484fc4611b7..96f1cb1ee31 100644 --- a/gdb/python/py-utils.c +++ b/gdb/python/py-utils.c @@ -362,7 +362,7 @@ gdb_py_generic_getattro (PyObject *self, PyObject *attr) Therefore, we must explicitly raise an AttributeError in this case. */ PyErr_Format (PyExc_AttributeError, "'%s' object has no attribute '%s'", - Py_TYPE (self)->tp_name, + gdbpy_py_obj_tp_name (self), PyUnicode_AsUTF8AndSize (attr, nullptr)); return nullptr; } @@ -700,5 +700,5 @@ gdbpy_fix_doc_string_indentation (gdb::unique_xmalloc_ptr doc) PyObject * gdb_py_invalid_object_repr (PyObject *self) { - return PyUnicode_FromFormat ("<%s (invalid)>", Py_TYPE (self)->tp_name); + return PyUnicode_FromFormat ("<%s (invalid)>", gdbpy_py_obj_tp_name (self)); } diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index bdc960ed208..447da3f96e4 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -59,6 +59,7 @@ #include #include #include "py-ref.h" +#include "py-obj-type.h" static_assert (PY_VERSION_HEX >= 0x03040000); @@ -1124,12 +1125,13 @@ gdbpy_type_ready (PyTypeObject *type, PyObject *mod = nullptr) { if (PyType_Ready (type) < 0) return -1; + const char *tp_name = gdb_py_tp_name (type); if (mod == nullptr) { - gdb_assert (startswith (type->tp_name, "gdb.")); + gdb_assert (startswith (tp_name, "gdb.")); mod = gdb_module; } - const char *dot = strrchr (type->tp_name, '.'); + const char *dot = strrchr (tp_name, '.'); gdb_assert (dot != nullptr); return gdb_pymodule_addobject (mod, dot + 1, (PyObject *) type); } diff --git a/gdb/python/python.c b/gdb/python/python.c index 5474b8d644f..27cb3417c89 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1579,7 +1579,7 @@ gdbpy_write (PyObject *self, PyObject *args, PyObject *kw) PyErr_Format (PyExc_TypeError, _("'style' argument must be gdb.Style or None, not %s."), - Py_TYPE (style_obj)->tp_name); + gdbpy_py_obj_tp_name (style_obj)); return nullptr; } diff --git a/gdb/testsuite/gdb.python/py-disasm.exp.tcl b/gdb/testsuite/gdb.python/py-disasm.exp.tcl index 07131a44bff..e4391fa59ce 100644 --- a/gdb/testsuite/gdb.python/py-disasm.exp.tcl +++ b/gdb/testsuite/gdb.python/py-disasm.exp.tcl @@ -124,7 +124,7 @@ set test_plans \ [list "" "${base_pattern}\r\n.*"] \ [list "GlobalNullDisassembler" "${base_pattern}\r\n.*"] \ [list "ShowInfoRepr" "${base_pattern}\\s+## \]+>\r\n.*"] \ - [list "ShowInfoSubClassRepr" "${base_pattern}\\s+## \]+>\r\n.*"] \ + [list "ShowInfoSubClassRepr" "${base_pattern}\\s+## \]+>\r\n.*"] \ [list "ShowResultRepr" "${base_pattern}\\s+## \r\n.*"] \ [list "ShowResultStr" "${base_pattern}\\s+## ${nop}\r\n.*"] \ [list "GlobalPreInfoDisassembler" "${base_pattern}\\s+## ad = $hex, ar = ${curr_arch}\r\n.*"] \ @@ -154,10 +154,10 @@ set test_plans \ "Buffer returned from read_memory is sized $decimal instead of the expected $decimal"]] \ [list "ResultOfWrongType" \ [make_exception_pattern "TypeError" \ - "Result from Disassembler must be gdb.DisassemblerResult, not Blah."]] \ + "Result from Disassembler must be gdb.DisassemblerResult, not ResultOfWrongType.Blah."]] \ [list "ResultOfVeryWrongType" \ [make_exception_pattern "TypeError" \ - "Result from Disassembler must be gdb.DisassemblerResult, not Blah."]] \ + "Result from Disassembler must be gdb.DisassemblerResult, not ResultOfVeryWrongType.Blah."]] \ [list "ErrorCreatingTextPart_NoArgs" \ [make_exception_pattern "TypeError" \ [missing_arg_pattern "style" 1]]] \ @@ -337,7 +337,7 @@ foreach len {0 -1} { foreach type {DisassemblerTextPart DisassemblerAddressPart} { gdb_test "python result = gdb.disassembler.${type}()" \ [multi_line \ - "RuntimeError.*: Cannot create instances of DisassemblerPart\\." \ + "RuntimeError.*: Cannot create instances of gdb.disassembler.${type}\\." \ "Error occurred in Python.*"] \ "try to create an instance of ${type}" } diff --git a/gdb/testsuite/gdb.python/py-unwind.exp b/gdb/testsuite/gdb.python/py-unwind.exp index 8c90da50a1d..784d9dfcb64 100644 --- a/gdb/testsuite/gdb.python/py-unwind.exp +++ b/gdb/testsuite/gdb.python/py-unwind.exp @@ -249,7 +249,7 @@ with_test_prefix "bad object unwinder" { gdb_test_no_output "python obj = bad_object_unwinder(\"bad-object\")" gdb_test_no_output "python gdb.unwinder.register_unwinder(None, obj, replace=True)" gdb_test "backtrace" \ - "Python Exception : an Unwinder should return gdb.UnwindInfo, not Blah\\.\r\n.*" + "Python Exception : an Unwinder should return gdb.UnwindInfo, not bad_object_unwinder.+Blah\\.\r\n.*" } # Gather information about every frame. -- 2.53.0