From 980bd53780025944008dbcd89caeed8d6e782715 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 15 Aug 2016 11:51:44 +0200 Subject: [PATCH] dwarf2.def (DW_AT_string_length_bit_size, [...]): New attributes. * dwarf2.def (DW_AT_string_length_bit_size, DW_AT_string_length_byte_size): New attributes. * dwarf2out.c (struct checksum_attributes): Add at_string_length_bit_size and at_string_length_byte_size fields. (collect_checksum_attributes): Handle DW_AT_string_length_bit_size and DW_AT_string_length_byte_size. (die_checksum_ordered): Handle at_string_length_bit_size and at_string_length_byte_size. (gen_array_type_die): For dwarf_version >= 5 emit DW_AT_string_length_byte_size instead of DW_AT_byte_size. (adjust_string_types): For dwarf_version >= 5 remove DW_AT_string_length_byte_size instead of DW_AT_byte_size. (resolve_addr): Likewise. From-SVN: r239470 --- gcc/ChangeLog | 12 ++++++++++++ gcc/dwarf2out.c | 30 +++++++++++++++++++++++------- include/ChangeLog | 7 ++++++- include/dwarf2.def | 2 ++ 4 files changed, 43 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ecf62929dc3..32e9439d0d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,17 @@ 2016-08-15 Jakub Jelinek + * dwarf2out.c (struct checksum_attributes): Add + at_string_length_bit_size and at_string_length_byte_size fields. + (collect_checksum_attributes): Handle DW_AT_string_length_bit_size + and DW_AT_string_length_byte_size. + (die_checksum_ordered): Handle at_string_length_bit_size and + at_string_length_byte_size. + (gen_array_type_die): For dwarf_version >= 5 emit + DW_AT_string_length_byte_size instead of DW_AT_byte_size. + (adjust_string_types): For dwarf_version >= 5 remove + DW_AT_string_length_byte_size instead of DW_AT_byte_size. + (resolve_addr): Likewise. + PR debug/71906 * dwarf2out.c (string_types): New variable. (gen_array_type_die): Change early_dwarf handling of diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index fbf3f6ae5d0..0fdab9a3198 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6363,6 +6363,8 @@ struct checksum_attributes dw_attr_node *at_small; dw_attr_node *at_segment; dw_attr_node *at_string_length; + dw_attr_node *at_string_length_bit_size; + dw_attr_node *at_string_length_byte_size; dw_attr_node *at_threads_scaled; dw_attr_node *at_upper_bound; dw_attr_node *at_use_location; @@ -6502,6 +6504,12 @@ collect_checksum_attributes (struct checksum_attributes *attrs, dw_die_ref die) case DW_AT_string_length: attrs->at_string_length = a; break; + case DW_AT_string_length_bit_size: + attrs->at_string_length_bit_size = a; + break; + case DW_AT_string_length_byte_size: + attrs->at_string_length_byte_size = a; + break; case DW_AT_threads_scaled: attrs->at_threads_scaled = a; break; @@ -6588,6 +6596,8 @@ die_checksum_ordered (dw_die_ref die, struct md5_ctx *ctx, int *mark) CHECKSUM_ATTR (attrs.at_small); CHECKSUM_ATTR (attrs.at_segment); CHECKSUM_ATTR (attrs.at_string_length); + CHECKSUM_ATTR (attrs.at_string_length_bit_size); + CHECKSUM_ATTR (attrs.at_string_length_byte_size); CHECKSUM_ATTR (attrs.at_threads_scaled); CHECKSUM_ATTR (attrs.at_upper_bound); CHECKSUM_ATTR (attrs.at_use_location); @@ -19355,7 +19365,9 @@ gen_array_type_die (tree type, dw_die_ref context_die) add_AT_location_description (array_die, DW_AT_string_length, loc); if (size != DWARF2_ADDR_SIZE) - add_AT_unsigned (array_die, DW_AT_byte_size, size); + add_AT_unsigned (array_die, dwarf_version >= 5 + ? DW_AT_string_length_byte_size + : DW_AT_byte_size, size); } } } @@ -19448,7 +19460,9 @@ adjust_string_types (void) else { remove_AT (array_die, DW_AT_string_length); - remove_AT (array_die, DW_AT_byte_size); + remove_AT (array_die, dwarf_version >= 5 + ? DW_AT_string_length_byte_size + : DW_AT_byte_size); } } } @@ -26909,8 +26923,8 @@ copy_deref_exprloc (dw_loc_descr_ref expr, dw_loc_descr_ref deref) /* For DW_AT_string_length attribute with DW_OP_call4 reference to a variable or argument, adjust it if needed and return: - -1 if the DW_AT_string_length attribute and DW_AT_byte_size attribute - if present should be removed + -1 if the DW_AT_string_length attribute and DW_AT_{string_length_,}byte_size + attribute if present should be removed 0 keep the attribute as is if the referenced var or argument has only DWARF expression that covers all ranges 1 if the attribute has been successfully adjusted. */ @@ -27083,8 +27097,8 @@ resolve_addr (dw_die_ref die) case -1: remove_AT (die, a->dw_attr); ix--; - /* For DWARF4 and earlier, if we drop DW_AT_string_length, - we need to drop also DW_AT_byte_size. */ + /* If we drop DW_AT_string_length, we need to drop also + DW_AT_{string_length_,}byte_size. */ remove_AT_byte_size = true; continue; default: @@ -27181,7 +27195,9 @@ resolve_addr (dw_die_ref die) } if (remove_AT_byte_size) - remove_AT (die, DW_AT_byte_size); + remove_AT (die, dwarf_version >= 5 + ? DW_AT_string_length_byte_size + : DW_AT_byte_size); FOR_EACH_CHILD (die, c, resolve_addr (c)); } diff --git a/include/ChangeLog b/include/ChangeLog index 5a3843bde1c..a37976855b5 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,8 +1,13 @@ +2016-08-15 Jakub Jelinek + + * dwarf2.def (DW_AT_string_length_bit_size, + DW_AT_string_length_byte_size): New attributes. + 2016-08-12 Alexandre Oliva PR debug/63240 * dwarf2.def (DW_AT_deleted, DW_AT_defaulted): New. - * dwarf2.h (enu dwarf_defaulted_attribute): New. + * dwarf2.h (enum dwarf_defaulted_attribute): New. 2016-07-29 Aldy Hernandez diff --git a/include/dwarf2.def b/include/dwarf2.def index 67b2a5bd39d..5241fe8615e 100644 --- a/include/dwarf2.def +++ b/include/dwarf2.def @@ -309,6 +309,8 @@ DW_AT (DW_AT_const_expr, 0x6c) DW_AT (DW_AT_enum_class, 0x6d) DW_AT (DW_AT_linkage_name, 0x6e) /* DWARF 5. */ +DW_AT (DW_AT_string_length_bit_size, 0x6f) +DW_AT (DW_AT_string_length_byte_size, 0x70) DW_AT (DW_AT_noreturn, 0x87) DW_AT (DW_AT_deleted, 0x8a) DW_AT (DW_AT_defaulted, 0x8b) -- 2.30.2