Fix for the complaint observed when symbol reading due to unsupported .debug_names...
authornitachra <Nitika.Achra@amd.com>
Sat, 9 May 2020 08:03:51 +0000 (10:03 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 9 May 2020 08:03:51 +0000 (10:03 +0200)
Following complaint is observed with the executable compiled with -gdwarf-5
and -gpubnames flags - "During symbol reading: Unsupported .debug_names form
DW_FORM_ref4".  This is the form corresponding to DW_IDX_die_offset attribute.
This patch fixes this complaint.  Tested with clang 10.0.0.  Test case used -

int main()
{
int sum,a,b;
sum = a + b;
return sum;
}

clang -gdwarf-5 -gpubnames test.c -o test.out

gdb -q test.out -ex "set complaints 1" -ex "start"

Reading symbols from test.out...
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \
  [in module test.out]
Temporary breakpoint 1 at 0x400484
Starting program: test.out
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \
  [in module test.out]
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \
  [in module test.out]
During symbol reading: Unsupported .debug_names form DW_FORM_ref4 \
  [in module test.out]

gdb/dwarf2/ChangeLog:

2020-05-09  Nitika Achra  <Nitika.Achra@amd.com>

PR symtab/25952
* read.c (dw2_debug_names_iterator::next): Handle DW_FORM_ref*
and DW_IDX_die_offset.  If there is no compilation unit attribute in
the index entry, then there is a single CU.  Return the CU at O index
of compilation unit vector.

gdb/testsuite/ChangeLog:

2020-05-09  Tom de Vries  <tdevries@suse.de>

* gdb.dwarf2/clang-debug-names.exp: Remove PR25952 kfail.

gdb/dwarf2/read.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/clang-debug-names.exp

index 439b889144b96bf9fbac71802021e155a4e2d413..4c8a0717c785b63126713703d944c4f5261af449 100644 (file)
@@ -5352,6 +5352,18 @@ dw2_debug_names_iterator::next ()
          ull = read_unsigned_leb128 (abfd, m_addr, &bytes_read);
          m_addr += bytes_read;
          break;
+       case DW_FORM_ref4:
+         ull = read_4_bytes (abfd, m_addr);
+         m_addr += 4;
+         break;
+       case DW_FORM_ref8:
+         ull = read_8_bytes (abfd, m_addr);
+         m_addr += 8;
+         break;
+       case DW_FORM_ref_sig8:
+         ull = read_8_bytes (abfd, m_addr);
+         m_addr += 8;
+         break;
        default:
          complaint (_("Unsupported .debug_names form %s [in module %s]"),
                     dwarf_form_name (attr.form),
@@ -5384,6 +5396,12 @@ dw2_debug_names_iterator::next ()
            }
          per_cu = &dwarf2_per_objfile->get_tu (ull)->per_cu;
          break;
+       case DW_IDX_die_offset:
+         /* In a per-CU index (as opposed to a per-module index), index
+            entries without CU attribute implicitly refer to the single CU.  */
+         if (per_cu == NULL)
+           per_cu = dwarf2_per_objfile->get_cu (0);
+         break;
        case DW_IDX_GNU_internal:
          if (!m_map.augmentation_is_gdb)
            break;
index 49445fa33161bb7610fcac7d3eb8cd6291f8b071..eccba674a4bac5def8783fa25bfab6a246aea6c5 100644 (file)
@@ -1,3 +1,7 @@
+2020-05-09  Tom de Vries  <tdevries@suse.de>
+
+       * gdb.dwarf2/clang-debug-names.exp: Remove PR25952 kfail.
+
 2020-05-08  Tom de Vries  <tdevries@suse.de>
 
        * gdb.dwarf2/clang-debug-names.c: New test.
index 8bd60401c46fe7e8478c15108a305a3216fb75e5..a6e33c1d8995090fb41511838d097ed73d88089f 100644 (file)
@@ -142,15 +142,4 @@ set pass_re \
     [multi_line \
         $cmd \
         "type = int \\(\\)"]
-set kfail_re \
-    [multi_line \
-        $cmd \
-        "type = <unknown return type> \\(\\)"]
-gdb_test_multiple $cmd "" {
-    -re -wrap $pass_re {
-       pass $gdb_test_name
-    }
-    -re -wrap $kfail_re {
-       kfail symtab/25952 $gdb_test_name
-    }
-}
+gdb_test $cmd $pass_re
This page took 0.040388 seconds and 4 git commands to generate.