Fix .debug_names regression with new indexer
authorTom Tromey <tromey@adacore.com>
Thu, 21 Apr 2022 13:28:56 +0000 (07:28 -0600)
committerTom Tromey <tromey@adacore.com>
Fri, 29 Apr 2022 19:16:44 +0000 (13:16 -0600)
commit446fcb446f57dbb33728c3dbd5f092bca3ba3547
tree96b019204ce93ee7ab663b235543c80e5d946ac6
parent225170409b47bc96b62b2ecfcc0d9d5ae1ef8949
Fix .debug_names regression with new indexer

At AdaCore, we run the internal gdb test suite in several modes,
including one using the .debug_names index.  This caught a regression
caused by the new DWARF indexer.

First, the psymtabs-based .debug_names generator was completely wrong.
However, to avoid making the rewrite series even bigger (fixing the
writer will also require rewriting the .debug_names reader), it
attempted to preserve the weirdness.

However, this was not done properly.  For example the old writer did
this:

-      case STRUCT_DOMAIN:
- return DW_TAG_structure_type;

The new code, instead, simply preserves the actual DWARF tag -- but
this makes future lookups fail, because the .debug_names reader only
looks for DW_TAG_structure_type.

This patch attempts to revert to the old behavior in the writer.
gdb/dwarf2/cooked-index.h
gdb/dwarf2/index-write.c
gdb/dwarf2/tag.h [new file with mode: 0644]