From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id WSdJMqTsJmnWFTIAWB0awg (envelope-from ) for ; Wed, 26 Nov 2025 07:03:48 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=htecgroup.com header.i=@htecgroup.com header.a=rsa-sha256 header.s=selector1 header.b=a/NvfksQ; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id C949E1E08D; Wed, 26 Nov 2025 07:03:48 -0500 (EST) 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 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 D42F31E08D for ; Wed, 26 Nov 2025 07:03:47 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8B8FD3857718 for ; Wed, 26 Nov 2025 12:03:47 +0000 (GMT) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11021128.outbound.protection.outlook.com [52.101.70.128]) by sourceware.org (Postfix) with ESMTPS id D594B3858401 for ; Wed, 26 Nov 2025 12:03:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D594B3858401 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=htecgroup.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=htecgroup.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D594B3858401 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=52.101.70.128 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1764158589; cv=pass; b=nGqZ4AW6PLdoMFtIMK8tcLf5Hw4/WMkzd7gYgykmrubx12zv6x/ppueTXp1RlM/vgaNHSnero8z04qJKNUPjPCSsxLSnoiN+GdFm/CWBD5x+aCMpNh+u3Ge98Y9DLjIRSVz8/vOuy3XnJT1ohxhFpMx25+LSUJ3nh5XeAiqCmEM= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1764158589; c=relaxed/simple; bh=HKTsySw/qm+RZLPBWWs8x+6/eFHyz489H1YysRCOuR8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=R97k6Zu57azwPY+JQZj+62RyBvdOp3r/lV5L0uHHEKlgqzghn1VPoUlA0vNGowV0/QYnyBhdhiHu7Jlkiw5eL9NtReMuXOAYs42+IgnZUfftkLJvdydcMbXD5BF/RD+igxgvZ70LnZGPKdcb9iGHhGYjTnGUCZ3YqPemma7xDi8= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q/4YOXhHCJPjdDZCXkMsOtpKX7o0et/BvBIJlmzUtKJrL1JFlf3KlHCBps7Kf99OnQaJjYNVMtGLh3pzivfJRFJx2WhRtqPg9kLG+hqqi3uSihFxxB/3UfpSUv9Sx4iZAE2r3DD9AlLEmq9n+9YrFuCFqcMNbMkWk47M/fR96CSbtFU6cq9yywmhvaGrxa2hArmdC9b51OXHel7iiX9tp1GFcCH+nAXzw5Z9g3rvbWaDEbR2K1fDP8x2WgnYtNin78F5CTd2fiX9CLbLBLBojGAfm9F/hb6+4mAZCgOUOcgJrqHahSbaqynzYcBJal73y2nZrTpSIUbTk0uqzB5i9A== 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=0cA8Lo82y40cN4vwwR/s4xWZk3DhXuEeoF30Op0dIvE=; b=QoH45nF1ShFpBMplxNnF+u9BXviEuactOJ8Zdphvu9biFoMtLYVltkeKpQp0TUDn0QMwm3TXIP8pIWrh5R98hSmbDq7awnpj/WhbWjmtrPcZTYkwtZSn0s8A3xkEjlwXIrYbSm2nFlBzFIPURYT/MWX0oRE763QbycuhBbTUTzmhl6oyBIxsJklznII8G2iCr6HIfp8AOxZxVYl+lmmyk0iq3A8kovzueZ9xnRsM6yzqDCV+34tA3nurldaMIJWdLa7It2hSkgXn2+u5/ZnoPDXd4oNz9qlORYq9iFYIBy20WhFFqFJhCBZaNJk4ncaG+6pn0dWAt0L3ziC2LxbtSg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=htecgroup.com; dmarc=pass action=none header.from=htecgroup.com; dkim=pass header.d=htecgroup.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=htecgroup.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0cA8Lo82y40cN4vwwR/s4xWZk3DhXuEeoF30Op0dIvE=; b=a/NvfksQqGkP3gFD1Zkx29g+3fcegoU08szIBmHUsKJu6RvkE+pwNXR0OD0ysKlUzegByfS2cNfR4omRthyT8y3HVPgNT2N6PjVZvmPkwAIwlx5L8Xjzjh2o+PbGeIipS8hbEg7iHbeV+afe1FkmdCWeeXrFiY1LP5RuSNXBbM09vbYK6lrGRddUuhGp3cNXJjRwpcpqiDR+zkqExGmPlsVAV0eTWiN3YSxDx1ditK2yxSuzc+h5Ls/S+Q2AQol3oHHdBAX3l3VdYPuz7gpKY316Yg0cZIBm3lc/5D8js2GGfFZICZ3cPAL9nMiv9ULgtAENwOuOEjHH9ffwn8Urpw== Received: from DBBPR09MB3477.eurprd09.prod.outlook.com (2603:10a6:10:d7::21) by DBBPR09MB4537.eurprd09.prod.outlook.com (2603:10a6:10:1f5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9366.12; Wed, 26 Nov 2025 12:02:58 +0000 Received: from DBBPR09MB3477.eurprd09.prod.outlook.com ([fe80::a339:e3f8:fe9b:112e]) by DBBPR09MB3477.eurprd09.prod.outlook.com ([fe80::a339:e3f8:fe9b:112e%7]) with mapi id 15.20.9343.016; Wed, 26 Nov 2025 12:02:58 +0000 From: Daniel Knezevic To: "gdb-patches@sourceware.org" CC: Tom Tromey , Pedro Alves , Simon Marchi , Daniel Knezevic Subject: [PATCH 1/3] gdb: Move logic for printing enums to a helper function Thread-Topic: [PATCH 1/3] gdb: Move logic for printing enums to a helper function Thread-Index: AQHcXsybjLbA2KAhqka9mZGrK0HZ6w== Date: Wed, 26 Nov 2025 12:02:58 +0000 Message-ID: <20251126120210.919813-2-daniel.knezevic@htecgroup.com> References: <20251126120210.919813-1-daniel.knezevic@htecgroup.com> In-Reply-To: <20251126120210.919813-1-daniel.knezevic@htecgroup.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=htecgroup.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DBBPR09MB3477:EE_|DBBPR09MB4537:EE_ x-ms-office365-filtering-correlation-id: bf03d101-2c31-44a4-f339-08de2ce3bdea x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|366016|1800799024|376014|38070700021; x-microsoft-antispam-message-info: =?iso-8859-1?Q?fI78SGLShCTkFcQTWYfJ4/FgvsdrAAHEnnWEbmM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LkiylJuX04htkPNbxmnJLnjIHPqf31dfcxSE2L0/gJMC1?= =?iso-8859-1?Q?dNRanNR6FVLh0OqJXIuAFtNA3gagnC9UvG/qNAKl04KfAnatxhGaq23QoU?= =?iso-8859-1?Q?16+cxqSD7D+4WYsu1zeATbzFAKM/9mpDzKKAdjO9N0J/iRoW1ubDdAvo+8?= =?iso-8859-1?Q?/85a837pt+cBbHFoEfRC/C8LNBIzaJxIWu1tyWS2yreAsBKOGuitHoTUxC?= =?iso-8859-1?Q?6S3spUgAEz6Q1QJJtFYveMoNJXfL2bRcgR06CIU0e6DDBmZrc4/DhmhauD?= =?iso-8859-1?Q?eXbEyBT3HnUIeJlwDqSZSRhYUlrscgK/biC+ENrvJbqDe3iUllZwNQj15o?= =?iso-8859-1?Q?jFwGjNDZaZoFHeywGpTAvfHL0q2VZmX8FQVteMlZExsKP7N6q3JyXHJ7ae?= =?iso-8859-1?Q?L3Q4YwXkZmWJt4Yx4P9xqDulCAEvGak/bhuXpRCcysGgc9xWkQs2shDYkE?= =?iso-8859-1?Q?bZK3lgmZbCrFlXk1Dfsv3Rx3HevQfK+j/HrcCFpMLyFDNetFC55Kb/iM7C?= =?iso-8859-1?Q?Zc7NKlMY1cOnyp9oO9fJeNmLZ8frpaRBA5mBpl5CpZ+i3eFVX0xLH7dn8K?= =?iso-8859-1?Q?ApLy/hZCGuF0n8FfZdysMd0EGiG1dky8R0oPv7qgwyI1j1AEycCSAEsycf?= =?iso-8859-1?Q?M97kHQW+gmloF6ZTPTCJQHdBLgxK?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR09MB3477.eurprd09.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(376014)(38070700021); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?UPOy85JKx/Rn0vVi+dRzPAbtZ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XyQGa8a2LiJ5Fs1u0NYGog2s+3MWCLEi3YZMlrEIzdgeZESxVK6K?= =?iso-8859-1?Q?97TZ2qOTAJnRHujsGqRxKcH/w7pQxzEKgDjW9KPKpZZz3NLfCldGWto8aE?= =?iso-8859-1?Q?B1PKTX1c02C+RaBTaLJyNDX1fCB5eZKetEjhapwu2QWWT4Q7XxFV74UhYn?= =?iso-8859-1?Q?spUB1yD7AtRIXHjce8l9GIwmxEvbPPYjAFbo8WiBHDMsEQMUgni8xUONlY?= =?iso-8859-1?Q?GxqPPcbyx2U6iDjySKk5iseznO6QgKo80Jlz9dueRPnnCuVriZei1BOUdD?= =?iso-8859-1?Q?MpgKI9P+Hbg4VL3i9NNzpchSQyNCmjAonh2VnjEMFNeVSO+fMBoDlfMAT9?= =?iso-8859-1?Q?Nnqrq3cPkTzNySBZWXVayuCENBKEoavDmK1SmjEOO4jq+bnTLmyyAHs6fw?= =?iso-8859-1?Q?EuTU7T8x/pzqI3HM8bJ5EablN3fmd2wnO+GK0vfYJOj5HXcTd2ttTc/BwN?= =?iso-8859-1?Q?dBJdG2vZk2X+1cEZ5RgS9I9mWhxDb7pMpDUHkr0FpHr7anDyUiedc/3CRn?= =?iso-8859-1?Q?R+ASMG4slYdM98EsJY51D1f/k62GWNxBcU2AwT4cfCmKoiHBOZOADAWEco?= =?iso-8859-1?Q?137AQkzQtM3r7Fxm63pJQGMZLpDA1IAVQncH1rfZHInI46e0bHzvqrKdmb?= =?iso-8859-1?Q?XtuODO3oA6jHvJ7wxHtT/PBJ/SLw34S1zTuYicl0dokL8WKgjP2Ix7GSjl?= =?iso-8859-1?Q?751+3tKFtA4JZcRl+hk+M7ephE+1H4OEBK33/jWszhs0q7S3P0gR0h1dXH?= =?iso-8859-1?Q?rCvcN7Jd1MpAu4SqCdc=3D?= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: htecgroup.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DBBPR09MB3477.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bf03d101-2c31-44a4-f339-08de2ce3bdea X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Nov 2025 12:02:58.8512 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 9f85665b-7efd-4776-9dfe-b6bfda2565ee X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4fuipaRLW0S7jxPIsv1FRhoj12U6eFaOej0nflo0nMuwPeovhxEzMeJ4tDcstBst0BnMmOh5h721pLxMenbvgY53PlXB/vlML0jtnqFsSOI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR09MB4537 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 --- gdb/c-typeprint.c | 151 +++++++++++++++++++++++++--------------------- 1 file changed, 81 insertions(+), 70 deletions(-) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index 1dab82135d0..9e39c3d9b77 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -1292,6 +1292,83 @@ c_type_print_base_struct_union (struct type *type, s= truct ui_file *stream, } } =20 +/* Helper for 'c_type_print_base' that handles enums. + For a description of the arguments, see 'c_type_print_base'. */ + +static void +c_type_print_base_enum (struct type *type, struct ui_file *stream, + int show, int level, + enum language language, + const struct type_print_options *flags, + struct print_offset_data *podata) +{ + c_type_print_modifier (type, stream, 0, 1, language); + gdb_printf (stream, "enum "); + if (type->is_declared_class ()) + gdb_printf (stream, "class "); + /* Print the tag name if it exists. + The aCC compiler emits a spurious + "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}" + tag for unnamed struct/union/enum's, which we don't + want to print. */ + if (type->name () !=3D NULL + && !startswith (type->name (), "{unnamed")) + { + print_name_maybe_canonical (type->name (), flags, stream); + if (show > 0) + gdb_puts (" ", stream); + } + + stream->wrap_here (4); + if (show < 0) + { + /* If we just printed a tag name, no need to print anything + else. */ + if (type->name () =3D=3D NULL) + gdb_printf (stream, "{...}"); + } + else if (show > 0 || type->name () =3D=3D NULL) + { + LONGEST lastval =3D 0; + + /* We can't handle this case perfectly, as DWARF does not + tell us whether or not the underlying type was specified + in the source (and other debug formats don't provide this + at all). We choose to print the underlying type, if it + has a name, when in C++ on the theory that it's better to + print too much than too little; but conversely not to + print something egregiously outside the current + language's syntax. */ + if (language =3D=3D language_cplus && type->target_type () !=3D NULL= ) + { + struct type *underlying =3D check_typedef (type->target_type ()); + + if (underlying->name () !=3D NULL) + gdb_printf (stream, ": %s ", underlying->name ()); + } + + gdb_printf (stream, "{"); + int len =3D type->num_fields (); + for (int i =3D 0; i < len; i++) + { + QUIT; + if (i) + gdb_printf (stream, ", "); + stream->wrap_here (4); + fputs_styled (type->field (i).name (), + variable_name_style.style (), stream); + if (lastval !=3D type->field (i).loc_enumval ()) + { + gdb_printf (stream, " =3D %s", + plongest (type->field (i).loc_enumval ())); + lastval =3D type->field (i).loc_enumval (); + } + lastval++; + } + gdb_printf (stream, "}"); + } +} + /* Print the name of the type (or the ultimate pointer target, function value or array element), or the description of a structure or union. @@ -1317,9 +1394,6 @@ c_type_print_base_1 (struct type *type, struct ui_fil= e *stream, const struct type_print_options *flags, struct print_offset_data *podata) { - int i; - int len; - QUIT; =20 if (type =3D=3D NULL) @@ -1399,71 +1473,8 @@ c_type_print_base_1 (struct type *type, struct ui_fi= le *stream, break; =20 case TYPE_CODE_ENUM: - c_type_print_modifier (type, stream, 0, 1, language); - gdb_printf (stream, "enum "); - if (type->is_declared_class ()) - gdb_printf (stream, "class "); - /* Print the tag name if it exists. - The aCC compiler emits a spurious - "{unnamed struct}"/"{unnamed union}"/"{unnamed enum}" - tag for unnamed struct/union/enum's, which we don't - want to print. */ - if (type->name () !=3D NULL - && !startswith (type->name (), "{unnamed")) - { - print_name_maybe_canonical (type->name (), flags, stream); - if (show > 0) - gdb_puts (" ", stream); - } - - stream->wrap_here (4); - if (show < 0) - { - /* If we just printed a tag name, no need to print anything - else. */ - if (type->name () =3D=3D NULL) - gdb_printf (stream, "{...}"); - } - else if (show > 0 || type->name () =3D=3D NULL) - { - LONGEST lastval =3D 0; - - /* We can't handle this case perfectly, as DWARF does not - tell us whether or not the underlying type was specified - in the source (and other debug formats don't provide this - at all). We choose to print the underlying type, if it - has a name, when in C++ on the theory that it's better to - print too much than too little; but conversely not to - print something egregiously outside the current - language's syntax. */ - if (language =3D=3D language_cplus && type->target_type () !=3D NULL) - { - struct type *underlying =3D check_typedef (type->target_type ()); - - if (underlying->name () !=3D NULL) - gdb_printf (stream, ": %s ", underlying->name ()); - } - - gdb_printf (stream, "{"); - len =3D type->num_fields (); - for (i =3D 0; i < len; i++) - { - QUIT; - if (i) - gdb_printf (stream, ", "); - stream->wrap_here (4); - fputs_styled (type->field (i).name (), - variable_name_style.style (), stream); - if (lastval !=3D type->field (i).loc_enumval ()) - { - gdb_printf (stream, " =3D %s", - plongest (type->field (i).loc_enumval ())); - lastval =3D type->field (i).loc_enumval (); - } - lastval++; - } - gdb_printf (stream, "}"); - } + c_type_print_base_enum (type, stream, show, level, + language, flags, podata); break; =20 case TYPE_CODE_FLAGS: @@ -1492,8 +1503,8 @@ c_type_print_base_1 (struct type *type, struct ui_fil= e *stream, level + 4, "", metadata_style.style ().ptr (), nullptr); } - len =3D type->num_fields (); - for (i =3D 0; i < len; i++) + int len =3D type->num_fields (); + for (int i =3D 0; i < len; i++) { QUIT; print_spaces (level + 4, stream); --=20 2.43.0