aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2codeview.cc
diff options
context:
space:
mode:
authorMark Harmstone <mark@harmstone.com>2024-07-20 20:12:30 +0100
committerMark Harmstone <mark@harmstone.com>2024-07-24 00:51:13 +0100
commit7341607544e01a4a155613470b2ef099b051b881 (patch)
treec4c098137a11636a62fe42c56cf6be55ad128fa8 /gcc/dwarf2codeview.cc
parent806927111cf388a2d8cd54072269601f677767cf (diff)
downloadgcc-7341607544e01a4a155613470b2ef099b051b881.zip
gcc-7341607544e01a4a155613470b2ef099b051b881.tar.gz
gcc-7341607544e01a4a155613470b2ef099b051b881.tar.bz2
Output CodeView type information for references
Translates DW_TAG_reference_type DIEs into LF_POINTER types. gcc/ * dwarf2codeview.cc (get_type_num_reference_type): New function. (get_type_num_array_type): Add DW_TAG_reference_type to switch. (get_type_num): Handle DW_TAG_reference_type DIEs. * dwarf2codeview.h (CV_PTR_MODE_LVREF): Define.
Diffstat (limited to 'gcc/dwarf2codeview.cc')
-rw-r--r--gcc/dwarf2codeview.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/gcc/dwarf2codeview.cc b/gcc/dwarf2codeview.cc
index c174f32..2317520 100644
--- a/gcc/dwarf2codeview.cc
+++ b/gcc/dwarf2codeview.cc
@@ -2293,6 +2293,45 @@ get_type_num_pointer_type (dw_die_ref type, bool in_struct)
return ct->num;
}
+/* Process a DW_TAG_reference_type DIE, add a new LF_POINTER type, and return
+ its number. */
+
+static uint32_t
+get_type_num_reference_type (dw_die_ref type, bool in_struct)
+{
+ uint32_t base_type_num, byte_size;
+ dw_die_ref base_type;
+ codeview_custom_type *ct;
+
+ byte_size = get_AT_unsigned (type, DW_AT_byte_size);
+ if (byte_size != 4 && byte_size != 8)
+ return 0;
+
+ base_type = get_AT_ref (type, DW_AT_type);
+
+ base_type_num = get_type_num (base_type, in_struct, false);
+ if (base_type_num == 0)
+ return 0;
+
+ ct = (codeview_custom_type *) xmalloc (sizeof (codeview_custom_type));
+
+ ct->next = NULL;
+ ct->kind = LF_POINTER;
+ ct->lf_pointer.base_type = base_type_num;
+ ct->lf_pointer.attributes = CV_PTR_MODE_LVREF;
+
+ if (byte_size == 4)
+ ct->lf_pointer.attributes |= CV_PTR_NEAR32;
+ else
+ ct->lf_pointer.attributes |= CV_PTR_64;
+
+ ct->lf_pointer.attributes |= byte_size << 13;
+
+ add_custom_type (ct);
+
+ return ct->num;
+}
+
/* Process a DW_TAG_const_type DIE, adding an LF_MODIFIER type and returning
its number. */
@@ -3024,6 +3063,7 @@ get_type_num_array_type (dw_die_ref type, bool in_struct)
case DW_TAG_class_type:
case DW_TAG_union_type:
case DW_TAG_pointer_type:
+ case DW_TAG_reference_type:
size = get_AT_unsigned (t, DW_AT_byte_size);
break;
@@ -3151,6 +3191,10 @@ get_type_num (dw_die_ref type, bool in_struct, bool no_fwd_ref)
num = get_type_num_pointer_type (type, in_struct);
break;
+ case DW_TAG_reference_type:
+ num = get_type_num_reference_type (type, in_struct);
+ break;
+
case DW_TAG_const_type:
num = get_type_num_const_type (type, in_struct);
break;