readelf: Update check for invalid word offsets in ARM unwind information.
[deliverable/binutils-gdb.git] / binutils / dwarf.c
index 2540293e87921abcb5dc2217a4029e3e81468c82..fdfbc16e88723255a12ec20e2be60ce20ea6bb5f 100644 (file)
@@ -1729,6 +1729,32 @@ read_and_display_attr_value (unsigned long attribute,
       data += 8;
       break;
 
+    case DW_FORM_data16:
+      if (!do_loc)
+       {
+         dwarf_vma left_high_bits, left_low_bits;
+         dwarf_vma right_high_bits, right_low_bits;
+
+         SAFE_BYTE_GET64 (data, &left_high_bits, &left_low_bits, end);
+         SAFE_BYTE_GET64 (data + 8, &right_high_bits, &right_low_bits, end);
+         if (byte_get == byte_get_little_endian)
+           {
+             /* Swap them.  */
+             left_high_bits ^= right_high_bits;
+             right_high_bits ^= left_high_bits;
+             left_high_bits ^= right_high_bits;
+             left_low_bits ^= right_low_bits;
+             right_low_bits ^= left_low_bits;
+             left_low_bits ^= right_low_bits;
+           }
+         printf (" 0x%08" DWARF_VMA_FMT "x%08" DWARF_VMA_FMT "x"
+                 "%08" DWARF_VMA_FMT "x%08" DWARF_VMA_FMT "x",
+                 left_high_bits, left_low_bits, right_high_bits,
+                 right_low_bits);
+       }
+      data += 16;
+      break;
+
     case DW_FORM_string:
       if (!do_loc)
        printf ("%c%.*s", delimiter, (int) (end - data), data);
@@ -4543,9 +4569,9 @@ display_debug_macro (struct dwarf_section *section,
       unsigned char **extended_ops = NULL;
 
       SAFE_BYTE_GET_AND_INC (version, curr, 2, end);
-      if (version != 4)
+      if (version != 4 && version != 5)
        {
-         error (_("Only GNU extension to DWARF 4 of %s is currently supported.\n"),
+         error (_("Only GNU extension to DWARF 4 or 5 of %s is currently supported.\n"),
                 section->name);
          return 0;
        }
@@ -4582,10 +4608,10 @@ display_debug_macro (struct dwarf_section *section,
                  nargs = read_uleb128 (curr, &bytes_read, end);
                  curr += bytes_read;
                  if (nargs == 0)
-                   printf (_("    DW_MACRO_GNU_%02x has no arguments\n"), op);
+                   printf (_("    DW_MACRO_%02x has no arguments\n"), op);
                  else
                    {
-                     printf (_("    DW_MACRO_GNU_%02x arguments: "), op);
+                     printf (_("    DW_MACRO_%02x arguments: "), op);
                      for (n = 0; n < nargs; n++)
                        {
                          unsigned int form;
@@ -4638,7 +4664,7 @@ display_debug_macro (struct dwarf_section *section,
 
          switch (op)
            {
-           case DW_MACRO_GNU_start_file:
+           case DW_MACRO_start_file:
              {
                unsigned int filenum;
                unsigned char *file_name = NULL, *dir_name = NULL;
@@ -4649,87 +4675,87 @@ display_debug_macro (struct dwarf_section *section,
                curr += bytes_read;
 
                if ((flags & 2) == 0)
-                 error (_("DW_MACRO_GNU_start_file used, but no .debug_line offset provided.\n"));
+                 error (_("DW_MACRO_start_file used, but no .debug_line offset provided.\n"));
                else
                  file_name
                    = get_line_filename_and_dirname (line_offset, filenum,
                                                     &dir_name);
                if (file_name == NULL)
-                 printf (_(" DW_MACRO_GNU_start_file - lineno: %d filenum: %d\n"),
+                 printf (_(" DW_MACRO_start_file - lineno: %d filenum: %d\n"),
                          lineno, filenum);
                else
-                 printf (_(" DW_MACRO_GNU_start_file - lineno: %d filenum: %d filename: %s%s%s\n"),
+                 printf (_(" DW_MACRO_start_file - lineno: %d filenum: %d filename: %s%s%s\n"),
                          lineno, filenum,
                          dir_name != NULL ? (const char *) dir_name : "",
                          dir_name != NULL ? "/" : "", file_name);
              }
              break;
 
-           case DW_MACRO_GNU_end_file:
-             printf (_(" DW_MACRO_GNU_end_file\n"));
+           case DW_MACRO_end_file:
+             printf (_(" DW_MACRO_end_file\n"));
              break;
 
-           case DW_MACRO_GNU_define:
+           case DW_MACRO_define:
              lineno = read_uleb128 (curr, &bytes_read, end);
              curr += bytes_read;
              string = curr;
              curr += strnlen ((char *) string, end - string) + 1;
-             printf (_(" DW_MACRO_GNU_define - lineno : %d macro : %s\n"),
+             printf (_(" DW_MACRO_define - lineno : %d macro : %s\n"),
                      lineno, string);
              break;
 
-           case DW_MACRO_GNU_undef:
+           case DW_MACRO_undef:
              lineno = read_uleb128 (curr, &bytes_read, end);
              curr += bytes_read;
              string = curr;
              curr += strnlen ((char *) string, end - string) + 1;
-             printf (_(" DW_MACRO_GNU_undef - lineno : %d macro : %s\n"),
+             printf (_(" DW_MACRO_undef - lineno : %d macro : %s\n"),
                      lineno, string);
              break;
 
-           case DW_MACRO_GNU_define_indirect:
+           case DW_MACRO_define_strp:
              lineno = read_uleb128 (curr, &bytes_read, end);
              curr += bytes_read;
              SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
              string = fetch_indirect_string (offset);
-             printf (_(" DW_MACRO_GNU_define_indirect - lineno : %d macro : %s\n"),
+             printf (_(" DW_MACRO_define_strp - lineno : %d macro : %s\n"),
                      lineno, string);
              break;
 
-           case DW_MACRO_GNU_undef_indirect:
+           case DW_MACRO_undef_strp:
              lineno = read_uleb128 (curr, &bytes_read, end);
              curr += bytes_read;
              SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
              string = fetch_indirect_string (offset);
-             printf (_(" DW_MACRO_GNU_undef_indirect - lineno : %d macro : %s\n"),
+             printf (_(" DW_MACRO_undef_strp - lineno : %d macro : %s\n"),
                      lineno, string);
              break;
 
-           case DW_MACRO_GNU_transparent_include:
+           case DW_MACRO_import:
              SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
-             printf (_(" DW_MACRO_GNU_transparent_include - offset : 0x%lx\n"),
+             printf (_(" DW_MACRO_import - offset : 0x%lx\n"),
                      (unsigned long) offset);
              break;
 
-           case DW_MACRO_GNU_define_indirect_alt:
+           case DW_MACRO_define_sup:
              lineno = read_uleb128 (curr, &bytes_read, end);
              curr += bytes_read;
              SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
-             printf (_(" DW_MACRO_GNU_define_indirect_alt - lineno : %d macro offset : 0x%lx\n"),
+             printf (_(" DW_MACRO_define_sup - lineno : %d macro offset : 0x%lx\n"),
                      lineno, (unsigned long) offset);
              break;
 
-           case DW_MACRO_GNU_undef_indirect_alt:
+           case DW_MACRO_undef_sup:
              lineno = read_uleb128 (curr, &bytes_read, end);
              curr += bytes_read;
              SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
-             printf (_(" DW_MACRO_GNU_undef_indirect_alt - lineno : %d macro offset : 0x%lx\n"),
+             printf (_(" DW_MACRO_undef_sup - lineno : %d macro offset : 0x%lx\n"),
                      lineno, (unsigned long) offset);
              break;
 
-           case DW_MACRO_GNU_transparent_include_alt:
+           case DW_MACRO_import_sup:
              SAFE_BYTE_GET_AND_INC (offset, curr, offset_size, end);
-             printf (_(" DW_MACRO_GNU_transparent_include_alt - offset : 0x%lx\n"),
+             printf (_(" DW_MACRO_import_sup - offset : 0x%lx\n"),
                      (unsigned long) offset);
              break;
 
@@ -4748,10 +4774,10 @@ display_debug_macro (struct dwarf_section *section,
                  desc += bytes_read;
                  if (nargs == 0)
                    {
-                     printf (_(" DW_MACRO_GNU_%02x\n"), op);
+                     printf (_(" DW_MACRO_%02x\n"), op);
                      break;
                    }
-                 printf (_(" DW_MACRO_GNU_%02x -"), op);
+                 printf (_(" DW_MACRO_%02x -"), op);
                  for (n = 0; n < nargs; n++)
                    {
                      int val;
@@ -4985,8 +5011,9 @@ display_loclists_list (struct dwarf_section *section,
   int dwarf_version;
   unsigned int bytes_read;
 
-  dwarf_vma begin;
-  dwarf_vma end;
+  /* Initialize it due to a false compiler warning.  */
+  dwarf_vma begin = -1;
+  dwarf_vma end = -1;
   dwarf_vma length;
   int need_frame_base;
 
@@ -5847,7 +5874,8 @@ display_debug_rnglists_list (unsigned char *start, unsigned char *finish,
     {
       unsigned long off = offset + (start - next);
       enum dwarf_range_list_entry rlet;
-      dwarf_vma begin, length, end;
+      /* Initialize it due to a false compiler warning.  */
+      dwarf_vma begin = -1, length, end = -1;
       unsigned int bytes_read;
 
       if (start + 1 > finish)
@@ -8563,3 +8591,6 @@ struct dwarf_section_display debug_displays[] =
   { { ".debug_tu_index",    "",                        NULL, NULL, 0, 0, 0, NULL, 0, NULL },
     display_cu_index,       &do_debug_cu_index,        FALSE },
 };
+
+/* A static assertion.  */
+extern int debug_displays_assert[ARRAY_SIZE (debug_displays) == max ? 1 : -1];
This page took 0.026521 seconds and 4 git commands to generate.