[2/5] Add CodeView enum cv_sym_type

Message ID 20240629220653.4445-2-mark@harmstone.com
State Committed
Commit f53087a719d97959304d57b647cc8792061a9db3
Headers
Series None |

Commit Message

Mark Harmstone June 29, 2024, 10:06 p.m. UTC
  Make everything more gdb-friendly by using an enum for symbol constants
rather than #defines.

    gcc/
            * dwarf2codeview.cc (S_LDATA32, S_GDATA32, S_COMPILE3): Undefine.
            (enum cv_sym_type): Define.
            (struct codeview_symbol): Use enum cv_sym_type.
            (write_codeview_symbols): Add default to switch.
---
 gcc/dwarf2codeview.cc | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
  

Comments

Jeff Law July 8, 2024, 6:06 p.m. UTC | #1
On 6/29/24 4:06 PM, Mark Harmstone wrote:
> Make everything more gdb-friendly by using an enum for symbol constants
> rather than #defines.
> 
>      gcc/
>              * dwarf2codeview.cc (S_LDATA32, S_GDATA32, S_COMPILE3): Undefine.
>              (enum cv_sym_type): Define.
>              (struct codeview_symbol): Use enum cv_sym_type.
>              (write_codeview_symbols): Add default to switch.
OK for the trunk.

jeff
  

Patch

diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index 5155aa70139..921d5f41e5a 100644
--- a/gcc/dwarf2codeview.cc
+++ b/gcc/dwarf2codeview.cc
@@ -46,10 +46,6 @@  along with GCC; see the file COPYING3.  If not see
 
 #define CHKSUM_TYPE_MD5		1
 
-#define S_LDATA32		0x110c
-#define S_GDATA32		0x110d
-#define S_COMPILE3		0x113c
-
 #define CV_CFL_80386		0x03
 #define CV_CFL_X64		0xD0
 
@@ -70,6 +66,14 @@  along with GCC; see the file COPYING3.  If not see
 
 #define HASH_SIZE 16
 
+/* This is enum SYM_ENUM_e in Microsoft's cvinfo.h.  */
+
+enum cv_sym_type {
+  S_LDATA32 = 0x110c,
+  S_GDATA32 = 0x110d,
+  S_COMPILE3 = 0x113c
+};
+
 /* This is enum LEAF_ENUM_e in Microsoft's cvinfo.h.  */
 
 enum cv_leaf_type {
@@ -168,7 +172,7 @@  struct codeview_function
 struct codeview_symbol
 {
   codeview_symbol *next;
-  uint16_t kind;
+  enum cv_sym_type kind;
 
   union
   {
@@ -983,6 +987,8 @@  write_codeview_symbols (void)
 	case S_GDATA32:
 	  write_data_symbol (sym);
 	  break;
+	default:
+	  break;
 	}
 
       free (sym);