[PATCH] -dA -gdwarf-4 fixes
Jakub Jelinek
jakub@redhat.com
Thu Oct 15 07:19:00 GMT 2009
Hi!
This patch fixes a bunch of issues I've noticed while looking at
-gdwarf-4 -dA output.
We certainly don't want to see DW_TAG_<unknown>, DW_AT_<unknown> or
DW_FORM_<unknown> in the output, that's not very readable.
Also, when printing 8 byte signatures, it is printed one byte on
a line, like:
.uleb128 0x8 # (DIE (0x66) DW_TAG_variable)
.ascii "t\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (a.c)
.byte 0x3 # DW_AT_decl_line
.byte 0x18 # DW_AT_type
.byte 0x5c # DW_AT_type
.byte 0x9f # DW_AT_type
.byte 0x3d # DW_AT_type
.byte 0x6e # DW_AT_type
.byte 0x7c # DW_AT_type
.byte 0x1a # DW_AT_type
.byte 0x2e # DW_AT_type
.byte 0x1 # DW_AT_external
.byte 0x9 # DW_AT_location
.byte 0x3 # DW_OP_addr
.quad t
which is IMHO very unreadable, on the first sight that reads like
the variable has 8 type attributes. This patch changes that to:
.uleb128 0x8 # (DIE (0x66) DW_TAG_variable)
.ascii "t\0" # DW_AT_name
.byte 0x1 # DW_AT_decl_file (a.c)
.byte 0x3 # DW_AT_decl_line
.byte 0x18 # DW_AT_type
.byte 0x5c
.byte 0x9f
.byte 0x3d
.byte 0x6e
.byte 0x7c
.byte 0x1a
.byte 0x2e
.byte 0x1 # DW_AT_external
.byte 0x9 # DW_AT_location
.byte 0x3 # DW_OP_addr
.quad t
Ok for trunk?
2009-10-15 Jakub Jelinek <jakub@redhat.com>
* dwarf2out.c (dwarf_tag_name): Handle DW_TAG_rvalue_reference_type
and DW_TAG_template_alias.
(dwarf_attr_name): Handle DW_AT_main_subprogram,
DW_AT_data_bit_offset, DW_AT_const_expr, DW_AT_enum_class,
DW_AT_linkage_name, DW_AT_GNU_guarded_by, DW_AT_GNU_pt_guarded_by,
DW_AT_GNU_guarded, DW_AT_GNU_pt_guarded, DW_AT_GNU_locks_excluded,
DW_AT_GNU_exclusive_locks_required, DW_AT_GNU_shared_locks_required
and DW_AT_GNU_odr_signature.
(dwarf_form_name): Handle DW_FORM_sec_offset, DW_FORM_exprloc,
DW_FORM_flag_present and DW_FORM_ref_sig8.
(output_signature): Only print name on the first byte.
(output_die): Likewise for dw_val_class_data8.
* include/dwarf2.h (DW_LANG_Python): Add comment that it is
a DWARF 4 addition.
--- gcc/dwarf2out.c.jj 2009-10-13 16:20:12.000000000 +0200
+++ gcc/dwarf2out.c 2009-10-15 08:52:23.000000000 +0200
@@ -6478,6 +6478,10 @@ dwarf_tag_name (unsigned int tag)
return "DW_TAG_shared_type";
case DW_TAG_type_unit:
return "DW_TAG_type_unit";
+ case DW_TAG_rvalue_reference_type:
+ return "DW_TAG_rvalue_reference_type";
+ case DW_TAG_template_alias:
+ return "DW_TAG_template_alias";
case DW_TAG_GNU_template_parameter_pack:
return "DW_TAG_GNU_template_parameter_pack";
case DW_TAG_GNU_formal_parameter_pack:
@@ -6662,6 +6666,16 @@ dwarf_attr_name (unsigned int attr)
case DW_AT_signature:
return "DW_AT_signature";
+ case DW_AT_main_subprogram:
+ return "DW_AT_main_subprogram";
+ case DW_AT_data_bit_offset:
+ return "DW_AT_data_bit_offset";
+ case DW_AT_const_expr:
+ return "DW_AT_const_expr";
+ case DW_AT_enum_class:
+ return "DW_AT_enum_class";
+ case DW_AT_linkage_name:
+ return "DW_AT_linkage_name";
case DW_AT_MIPS_fde:
return "DW_AT_MIPS_fde";
@@ -6700,6 +6714,22 @@ dwarf_attr_name (unsigned int attr)
return "DW_AT_body_end";
case DW_AT_GNU_vector:
return "DW_AT_GNU_vector";
+ case DW_AT_GNU_guarded_by:
+ return "DW_AT_GNU_guarded_by";
+ case DW_AT_GNU_pt_guarded_by:
+ return "DW_AT_GNU_pt_guarded_by";
+ case DW_AT_GNU_guarded:
+ return "DW_AT_GNU_guarded";
+ case DW_AT_GNU_pt_guarded:
+ return "DW_AT_GNU_pt_guarded";
+ case DW_AT_GNU_locks_excluded:
+ return "DW_AT_GNU_locks_excluded";
+ case DW_AT_GNU_exclusive_locks_required:
+ return "DW_AT_GNU_exclusive_locks_required";
+ case DW_AT_GNU_shared_locks_required:
+ return "DW_AT_GNU_shared_locks_required";
+ case DW_AT_GNU_odr_signature:
+ return "DW_AT_GNU_odr_signature";
case DW_AT_GNU_template_name:
return "DW_AT_GNU_template_name";
@@ -6760,6 +6790,14 @@ dwarf_form_name (unsigned int form)
return "DW_FORM_ref_udata";
case DW_FORM_indirect:
return "DW_FORM_indirect";
+ case DW_FORM_sec_offset:
+ return "DW_FORM_sec_offset";
+ case DW_FORM_exprloc:
+ return "DW_FORM_exprloc";
+ case DW_FORM_flag_present:
+ return "DW_FORM_flag_present";
+ case DW_FORM_ref_sig8:
+ return "DW_FORM_ref_sig8";
default:
return "DW_FORM_<unknown>";
}
@@ -10352,7 +10390,7 @@ output_signature (const char *sig, const
int i;
for (i = 0; i < DWARF_TYPE_SIGNATURE_SIZE; i++)
- dw2_asm_output_data (1, sig[i], "%s", name);
+ dw2_asm_output_data (1, sig[i], i == 0 ? "%s" : NULL, name);
}
/* Output the DIE and its attributes. Called recursively to generate
@@ -10573,7 +10611,7 @@ output_die (dw_die_ref die)
for (i = 0; i < 8; i++)
dw2_asm_output_data (1, a->dw_attr_val.v.val_data8[i],
- "%s", name);
+ i == 0 ? "%s" : NULL, name);
break;
}
--- include/dwarf2.h.jj 2009-09-29 15:10:46.000000000 +0200
+++ include/dwarf2.h 2009-10-15 08:37:42.000000000 +0200
@@ -858,6 +858,7 @@ enum dwarf_source_language
DW_LANG_ObjC_plus_plus = 0x0011,
DW_LANG_UPC = 0x0012,
DW_LANG_D = 0x0013,
+ /* DWARF 4. */
DW_LANG_Python = 0x0014,
DW_LANG_lo_user = 0x8000, /* Implementation-defined range start. */
Jakub
More information about the Gcc-patches
mailing list