]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
dwarf2.def (DW_AT_string_length_bit_size, [...]): New attributes.
authorJakub Jelinek <jakub@gcc.gnu.org>
Mon, 15 Aug 2016 09:51:44 +0000 (11:51 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 15 Aug 2016 09:51:44 +0000 (11:51 +0200)
* 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
gcc/dwarf2out.c
include/ChangeLog
include/dwarf2.def

index ecf62929dc3b040da9c531824cbbcf034fb0f21d..32e9439d0d40fb496708f34ef7120d46e030f03f 100644 (file)
@@ -1,5 +1,17 @@
 2016-08-15  Jakub Jelinek  <jakub@redhat.com>
 
+       * 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
index fbf3f6ae5d01804e6e734767cd24e67e0fa5b899..0fdab9a31985fc3c220554a9c980e9ba040a42cd 100644 (file)
@@ -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));
 }
index 5a3843bde1c6f30d718ecbb1e748a102939c7741..a37976855b5f5ca84ec0ad6a4cfa5a6c47fdc94d 100644 (file)
@@ -1,8 +1,13 @@
+2016-08-15  Jakub Jelinek  <jakub@redhat.com>
+
+       * dwarf2.def (DW_AT_string_length_bit_size,
+       DW_AT_string_length_byte_size): New attributes.
+
 2016-08-12  Alexandre Oliva <aoliva@redhat.com>
 
        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  <aldyh@redhat.com>
 
index 67b2a5bd39d610995a1f8b24e757e8e86c6d81c7..5241fe8615e0e3b288fee80c08a67723686ef411 100644 (file)
@@ -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)