diff options
author | Tom Tromey <tromey@adacore.com> | 2025-03-10 08:51:01 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2025-03-10 13:40:25 -0600 |
commit | c05c9914b1875d9edca946532d02daafc82c8615 (patch) | |
tree | 9f2d9c69c5ea10838f39c3dc74d37cd058763448 /gdb/python | |
parent | eb39f6d01e7c74389e71a864f382a2f0d3560cfd (diff) | |
download | binutils-c05c9914b1875d9edca946532d02daafc82c8615.zip binutils-c05c9914b1875d9edca946532d02daafc82c8615.tar.gz binutils-c05c9914b1875d9edca946532d02daafc82c8615.tar.bz2 |
Use flags enum for cooked_index_entry::full_name
I found a small bug coming from a couple of recent patches of mine for
cooked_index_entry::full_name.
First, commit aab26529b30 (Add "Ada linkage" mode to
cooked_index_entry::full_name) added a small hack to optionally
compute the Ada linkage name.
Then, commit aab2ac34d7f (Avoid excessive CU expansion on failed
matches) changed the relevant expand_symtabs_matching implementation
to use this feature.
However, the feature was used unconditionally, causing a bad side
effect: the non-canonical name is now used for all languages, not just
Ada. But, for C++ this is wrong.
Furthermore, consider the declaration of full_name:
const char *full_name (struct obstack *storage,
bool for_main = false,
bool for_ada_linkage = false,
const char *default_sep = nullptr) const;
... and then consider this call in cooked_index::dump:
gdb_printf (" qualified: %s\n",
entry->full_name (&temp_storage, false, "::"));
Oops! The "::" is silently converted to 'true' here.
To fix both of these problems, this patch changes full_name to accept
a flags enum rather than booleans. This avoids the type-safety
problem.
Then, full_name is changed to remove the "Ada" flag when the entry is
not in fact an Ada symbol.
Regression tested on x86-64 Fedora 40.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/python')
0 files changed, 0 insertions, 0 deletions