Bug 27930 - gdb index does not handle DWARF 5 type units
Summary: gdb index does not handle DWARF 5 type units
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: symtab (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 27453 16998
  Show dependency treegraph
 
Reported: 2021-05-29 13:46 UTC by Tom Tromey
Modified: 2025-03-09 20:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2021-05-29 13:46:45 UTC
In DWARF 5, a type unit can appear in .debug_info.
However, the gdb_index section does not handle this
situation -- it assumes that all type units appear in
.debug_types.
Comment 1 Tom Tromey 2022-09-20 22:32:57 UTC
Probably we should just close this as part of a general move
to preferring .debug_names instead.
Comment 2 Tom Tromey 2025-01-20 11:54:55 UTC
There's a test for this, gdb.dwarf2/gdb-index-types-dwarf5.exp,
but from what I can see it only passes by accident.
Comment 3 Tom Tromey 2025-03-09 20:32:42 UTC
It turns out there is a check where, if there is not .debug_types,
then TUs are assumed to come from .debug_info:

      dwarf2_section_info *section
	= (per_bfd->types.size () == 1
	   ? &per_bfd->types[0]
	   : &per_bfd->infos[0]);

So while this doesn't work in general, it can work in
a specific case.  This isn't documented.