[1/5] Add CodeView enum cv_leaf_type
Commit Message
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(-)
Comments
On 6/29/24 4:06 PM, Mark Harmstone wrote:
> 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.
OK for the trunk. Go ahead and commit it once your write access is all
set up.
jeff
@@ -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);
@@ -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