From patchwork Sat Jun 29 22:06:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Harmstone X-Patchwork-Id: 1954283 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=harmstone.com header.i=@harmstone.com header.a=rsa-sha256 header.s=mail header.b=69LKbors; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WBRHp0pSSz20Xf for ; Sun, 30 Jun 2024 08:07:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7B33C381159A for ; Sat, 29 Jun 2024 22:07:30 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.burntcomma.com (mail.burntcomma.com [IPv6:2a02:8012:8cf0:250::6d61:696c]) by sourceware.org (Postfix) with ESMTPS id 6FD19389EC96 for ; Sat, 29 Jun 2024 22:07:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6FD19389EC96 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=harmstone.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=harmstone.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6FD19389EC96 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a02:8012:8cf0:250::6d61:696c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698824; cv=none; b=jpaRiG3Beog8ARTN+/Dmy6munshGk5CRmBX64Mj8kpWvHNrOB0u5UasOOhWF3tHeS7Z1WpEOhqeSfyj+nhAQPnc4Ktq9md2d6qcYK6MvfvI2Fac6HQ519+bAllr+j4w1G8wqx/ooakVfS6Fh4oafkq4pclRZJIxfYE23kBxS7Qo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1719698824; c=relaxed/simple; bh=CnKjnDl8ej5RzFULOPQ3gijlAMazKKqIP8PE7UIpkI0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:Mime-Version; b=kI3+GPs6Sc0FuwU3j50zSn/mm2k9pbHuBY9jyjfH8R0eY1EBxo4WCT+WXXH1VOp89bS+NRgsA4ygJ/GRMAe1CM9FnBDk4bW256u7gjIp0jmvGhLA6c+fCDU7MsI26nwazD3bHo2w1/e6gvVad7OA5Xlc1g0K3fpWPzrULy+dTuU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (beren.burntcomma.com [IPv6:2a02:8012:8cf0:0:b62e:99ff:fee9:ad9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by mail.burntcomma.com (Postfix) with ESMTPSA id C4A863DA80E8; Sat, 29 Jun 2024 23:07:00 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=harmstone.com; s=mail; t=1719698820; bh=ImdWx99uGnrl0m2M8YocYmf+vYOgH+JJHyozvLcouLw=; h=From:To:Cc:Subject:Date; b=69LKborsUfkuZQqoTrpf9rjl0sKbLco0+jvj1335Wywry65JlNIVxZJu/oadsnEuS 6L7Iabh5cg9jnkWiqyMvJ0yiw6FlNtlBJmAWcuRx4ms0ol3jOGn8DWRVJQ2T00otrH AqM2ZmBH4B6a4R6WdwxBdWXr4s/4HIpAde18bRZw= From: Mark Harmstone To: gcc-patches@gcc.gnu.org Cc: Mark Harmstone Subject: [PATCH 1/5] Add CodeView enum cv_leaf_type Date: Sat, 29 Jun 2024 23:06:49 +0100 Message-ID: <20240629220653.4445-1-mark@harmstone.com> Mime-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Make everything more gdb-friendly by using an enum for type constants rather than #defines. gcc/ * dwarf2codeview.cc (enum cv_leaf_type): Define. (struct codeview_subtype): Use enum cv_leaf_type. (struct codeview_custom_type): Use enum cv_leaf_type. (write_lf_fieldlist): Add default to switch. (write_custom_types): Add default to switch. * dwarf2codeview.h (LF_MODIFIER, LF_POINTER): Undefine. (LF_PROCEDURE, LF_ARGLIST, LF_FIELDLIST, LF_BITFIELD): Likewise. (LF_INDEX, LF_ENUMERATE, LF_ARRAY, LF_CLASS): Likewise. (LF_STRUCTURE, LF_UNION, LF_ENUM, LF_MEMBER, LF_CHAR): Likewise. (LF_SHORT, LF_USHORT, LF_LONG, LF_ULONG, LF_QUADWORD): Likewise. (LF_UQUADWORD): Likewise. --- gcc/dwarf2codeview.cc | 37 +++++++++++++++++++++++++++++++++++-- gcc/dwarf2codeview.h | 23 ----------------------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc index e8ed3713480..5155aa70139 100644 --- a/gcc/dwarf2codeview.cc +++ b/gcc/dwarf2codeview.cc @@ -70,6 +70,33 @@ along with GCC; see the file COPYING3. If not see #define HASH_SIZE 16 +/* This is enum LEAF_ENUM_e in Microsoft's cvinfo.h. */ + +enum cv_leaf_type { + LF_MODIFIER = 0x1001, + LF_POINTER = 0x1002, + LF_PROCEDURE = 0x1008, + LF_ARGLIST = 0x1201, + LF_FIELDLIST = 0x1203, + LF_BITFIELD = 0x1205, + LF_INDEX = 0x1404, + LF_ENUMERATE = 0x1502, + LF_ARRAY = 0x1503, + LF_CLASS = 0x1504, + LF_STRUCTURE = 0x1505, + LF_UNION = 0x1506, + LF_ENUM = 0x1507, + LF_MEMBER = 0x150d, + LF_FUNC_ID = 0x1601, + LF_CHAR = 0x8000, + LF_SHORT = 0x8001, + LF_USHORT = 0x8002, + LF_LONG = 0x8003, + LF_ULONG = 0x8004, + LF_QUADWORD = 0x8009, + LF_UQUADWORD = 0x800a +}; + struct codeview_string { codeview_string *next; @@ -185,7 +212,7 @@ struct codeview_integer struct codeview_subtype { struct codeview_subtype *next; - uint16_t kind; + enum cv_leaf_type kind; union { @@ -212,7 +239,7 @@ struct codeview_custom_type { struct codeview_custom_type *next; uint32_t num; - uint16_t kind; + enum cv_leaf_type kind; union { @@ -1336,6 +1363,9 @@ write_lf_fieldlist (codeview_custom_type *t) putc ('\n', asm_out_file); break; + + default: + break; } t->lf_fieldlist.subtypes = next; @@ -1790,6 +1820,9 @@ write_custom_types (void) case LF_ARGLIST: write_lf_arglist (custom_types); break; + + default: + break; } free (custom_types); diff --git a/gcc/dwarf2codeview.h b/gcc/dwarf2codeview.h index e6ad517bf28..8fd3632e524 100644 --- a/gcc/dwarf2codeview.h +++ b/gcc/dwarf2codeview.h @@ -60,29 +60,6 @@ along with GCC; see the file COPYING3. If not see #define MOD_const 0x1 #define MOD_volatile 0x2 -/* Constants for type definitions. */ -#define LF_MODIFIER 0x1001 -#define LF_POINTER 0x1002 -#define LF_PROCEDURE 0x1008 -#define LF_ARGLIST 0x1201 -#define LF_FIELDLIST 0x1203 -#define LF_BITFIELD 0x1205 -#define LF_INDEX 0x1404 -#define LF_ENUMERATE 0x1502 -#define LF_ARRAY 0x1503 -#define LF_CLASS 0x1504 -#define LF_STRUCTURE 0x1505 -#define LF_UNION 0x1506 -#define LF_ENUM 0x1507 -#define LF_MEMBER 0x150d -#define LF_CHAR 0x8000 -#define LF_SHORT 0x8001 -#define LF_USHORT 0x8002 -#define LF_LONG 0x8003 -#define LF_ULONG 0x8004 -#define LF_QUADWORD 0x8009 -#define LF_UQUADWORD 0x800a - #define CV_ACCESS_PRIVATE 1 #define CV_ACCESS_PROTECTED 2 #define CV_ACCESS_PUBLIC 3