Go to file
Tom de Vries a2860473ef [gdb/symtab] Revert "Change handling of DW_TAG_enumeration_type in DWARF scanner"
After adding dwarf assembly to test-case gdb.dwarf2/enum-type.exp that adds
this debug info:
...
 <1><11f>: Abbrev Number: 3 (DW_TAG_enumeration_type)
    <120>   DW_AT_specification: <0x130>
 <2><124>: Abbrev Number: 4 (DW_TAG_enumerator)
    <125>   DW_AT_name        : val1
    <12a>   DW_AT_const_value : 1
 <2><12b>: Abbrev Number: 0
 <1><12c>: Abbrev Number: 5 (DW_TAG_namespace)
    <12d>   DW_AT_name        : ns
 <2><130>: Abbrev Number: 6 (DW_TAG_enumeration_type)
    <131>   DW_AT_name        : e
    <133>   DW_AT_type        : <0x118>
    <137>   DW_AT_declaration : 1
...
I run into an assertion failure:
...
(gdb) file enum-type^M
Reading symbols from enum-type...^M
cooked-index.h:214: internal-error: get_parent: \
  Assertion `(flags & IS_PARENT_DEFERRED) == 0' failed.^M
...

This was reported in PR32160 comment 1.

This is a regression since commit 4e417d7bb1 ("Change handling of
DW_TAG_enumeration_type in DWARF scanner").

Fix this by reverting the commit.

[ Also drop the kfails for PR31900 and PR32158, which are regressions by that
same commit. ]

That allows us to look at the output of "maint print objfiles", and for val1
we get an entry without parent:
...
    [27] ((cooked_index_entry *) 0x7fbbb4002ef0)
    name:       val1
    canonical:  val1
    qualified:  val1
    DWARF tag:  DW_TAG_enumerator
    flags:      0x0 []
    DIE offset: 0x124
    parent:     ((cooked_index_entry *) 0)
...
which is incorrect, as noted in that same comment, but an improvement over the
assertion failure, and I don't think that ever worked.  This is to be
addressed in a follow-up patch.

Reverting the commit begs the question: what was it trying to fix in the first
place, and do we need a different fix?  I've investigated this and filed
PR32160 to track this.

My guess is that the commit was based on a misunderstand of what we track
in cooked_indexer::m_die_range_map.

Each DIE has two types of parent DIEs:
- a DIE that is the parent as indicated by the tree structure in which DIEs
  occur, and
- a DIE that represent the parent scope.

In most cases, these two are the same, but some times they're not.

The debug info above demonstrates such a case.  The DIE at 0x11f:
- has a tree-parent: the DIE representing the CU, and
- has a scope-parent: DIE 0x12c representing namespace ns.

In cooked_indexer::m_die_range_map, we track scope-parents, and the commit
tried to add a tree-parent instead.

So, I don't think we need a different fix, and propose we backport the reversal
for gdb 15.2.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31900
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32158
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32160
2024-09-14 14:09:35 +02:00
bfd Automatic date update in version.in 2024-09-14 00:00:07 +00:00
binutils get_type_abbrev_from_form tidy 2024-08-29 21:05:57 +09:30
config
contrib Revert "contrib: Add autoregen.py" 2024-09-04 13:38:57 +00:00
cpu Add markers for 2.43 branch/release 2024-07-20 12:43:19 +01:00
elfcpp Add markers for 2.43 branch/release 2024-07-20 12:43:19 +01:00
etc
gas s390: Relax risbg[n]z, risb{h|l}gz, {rns|ros|rxs}bgt operand constraints 2024-09-12 15:06:06 +02:00
gdb [gdb/symtab] Revert "Change handling of DW_TAG_enumeration_type in DWARF scanner" 2024-09-14 14:09:35 +02:00
gdbserver gdbserver: aarch64: Fix expedited registers list 2024-09-05 01:02:51 -03:00
gdbsupport gdbsupport/intrusive-list: add owning_intrusive_list 2024-09-13 07:38:56 -04:00
gnulib
gold gold: Always resolve non-default weak undefined to 0 2024-08-31 04:28:43 -07:00
gprof Change version to 2.43.50 2024-07-20 13:16:33 +01:00
gprofng gprofng: avoid use of non-portable which [PR32166] 2024-09-12 22:53:22 +01:00
include s390: Simplify (dis)assembly of insn operands with const bits 2024-09-12 15:06:06 +02:00
ld arm: Handle undefweak with ST_BRANCH_UNKNOWN 2024-09-11 15:34:32 +00:00
libbacktrace
libctf PR32093, -Walloc-size warning in ctf-hash.c 2024-08-29 21:05:57 +09:30
libdecnumber
libiberty libiberty: sync with gcc 2024-09-04 15:35:42 +01:00
libsframe libsframe: remove runstatedir in Makefile.in 2024-07-10 10:24:45 +02:00
opcodes s390: Relax risbg[n]z, risb{h|l}gz, {rns|ros|rxs}bgt operand constraints 2024-09-12 15:06:06 +02:00
readline
sim sim: pru: Fix test case assembly with latest GAS 2024-08-12 23:33:59 +03:00
texinfo
zlib
.cvsignore
.editorconfig
.gitattributes
.gitignore
.pre-commit-config.yaml pre-commit: autoupdate 2024-08-12 13:07:59 -04:00
ar-lib
ChangeLog Add markers for 2.43 branch/release 2024-07-20 12:43:19 +01:00
compile
config-ml.in
config.guess Synchronize config.[sub|guess] with the latest versions from the config project. 2024-07-15 10:22:54 +01:00
config.rpath
config.sub Synchronize config.[sub|guess] with the latest versions from the config project. 2024-07-15 10:22:54 +01:00
configure Disable gprofng build for *musl* 2024-08-26 13:48:29 -07:00
configure.ac Disable gprofng build for *musl* 2024-08-26 13:48:29 -07:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode
SECURITY.txt
setup.com
src-release.sh
symlink-tree
test-driver
ylwrap

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.