aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorBruno Larsen <blarsen@redhat.com>2022-10-26 09:47:11 +0200
committerBruno Larsen <blarsen@redhat.com>2023-01-06 10:52:55 +0100
commitbb391cb24d8f92ecad10bb6a60abdf0b880de0dd (patch)
treede9aa49524c5ace4d56cd48f76f1419679a26edd /bfd
parent37f54063ed0daaffbd52f69efbdb4c8e0a9c9cca (diff)
downloadgdb-bb391cb24d8f92ecad10bb6a60abdf0b880de0dd.zip
gdb-bb391cb24d8f92ecad10bb6a60abdf0b880de0dd.tar.gz
gdb-bb391cb24d8f92ecad10bb6a60abdf0b880de0dd.tar.bz2
gdb/c++: Detect ambiguous variables in imported namespaces
When running gdb.cp/nsusing.cc and stopping at line 17, we can ask GDB to print x and get a compiler-dependent answer. Using gcc 12.2.1, GDB will print M::x, and using clang 16.0.0 prints N::x. Not only is this behavior confusing to users, it is also not consistent with compiler behaviors, which would warn that using x is ambiguous at this point. This commit makes GDB behavior consistent with compilers. it achieves this by making it so instead of exiting early when finding any symbol with the correct name, GDB continues searching through all include directives, storing all matching symbols in a relational map betwen the mangled name and the found symbols. If the resulting map has more than one entry, GDB says that the reference is ambiguous and lists all possibilities. Otherwise it returns the block_symbol structure for the desired symbol, or an empty struct if nothing was found. The commit also changes gdb.cp/nsusing.exp to test the ambiguous detection.
Diffstat (limited to 'bfd')
0 files changed, 0 insertions, 0 deletions