]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Rework domain choices in ctfread.c
authorTom Tromey <tom@tromey.com>
Sun, 14 Sep 2025 21:20:25 +0000 (15:20 -0600)
committerTom Tromey <tom@tromey.com>
Sun, 5 Oct 2025 20:59:01 +0000 (14:59 -0600)
commitfe4b853b93f35842c7ec336076236b2891af06e1
treefcc8452e5a9e3d6325587ad39e793d047c9cd006
parentba597bdd245056667ca3a4ce0dc5264df7a58d80
Rework domain choices in ctfread.c

Another patch I am working on induced some failures in CTF tests.
Looking into this, I found that ctfread.c seems to largely work by
accident.  In particular, it often chooses the wrong domain for a
symbol.

In CTF, I believe there are 4 kinds of symbols: types, variables,
functions, and "data objects" (which IIUC may be either a variable or
a function).

ctfread.c was examining the type-kind of a variable and sometimes
treating one as a type.  add_stt_entries and
ctf_psymtab_add_stt_entries only ever used VAR_DOMAIN (but are called
for functions, which should be in FUNCTION_DOMAIN).  And
ctf_psymtab_type_cb sometimes used VAR_DOMAIN, but is only called for
types, and so should only ever use TYPE_DOMAIN or STRUCT_DOMAIN.

This patch cleans all this up, based on my understanding of the
situation.  This passes the existing tests, and also works with my
aforementioned yet-to-be-submitted patch as well.

Finally, I renamed new_symbol because it is only used for type
symbols.

Acked-By: Simon Marchi <simon.marchi@efficios.com>
gdb/ctfread.c