Fix latent bug in .debug_names file-name handling
authorTom Tromey <tromey@adacore.com>
Thu, 18 Jul 2019 18:27:16 +0000 (12:27 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 10 Sep 2019 14:30:45 +0000 (08:30 -0600)
commitaa3916548076c159ae00a922690694094a37fcd0
treed673c16523aed92e60f33355c100ae7290c329d3
parentb054970d54e141e5d2c824223772685742af2c2a
Fix latent bug in .debug_names file-name handling

An internal Ada test case showed that the .debug_names code does not
compute the same list of file names as the partial symbol reader.  In
particular, the partial symbol reader uses the DW_AT_name of the CU:

  /* Allocate a new partial symbol table structure.  */
  filename = dwarf2_string_attr (comp_unit_die, DW_AT_name, cu);
  if (filename == NULL)
    filename = "";

  pst = create_partial_symtab (per_cu, filename);

This patch changes the .debug_names reader to follow.

gdb/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* dwarf2read.c (dw2_get_file_names_reader): Add the
CU's file name to the results.

gdb/testsuite/ChangeLog
2019-09-10  Tom Tromey  <tromey@adacore.com>

* gdb.ada/dgopt.exp: New file.
* gdb.ada/dgopt/x.adb: New file.
gdb/ChangeLog
gdb/dwarf2read.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.ada/dgopt.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/dgopt/x.adb [new file with mode: 0644]