diff options
author | Bruno Larsen <blarsen@redhat.com> | 2022-10-19 16:57:44 +0200 |
---|---|---|
committer | Bruno Larsen <blarsen@redhat.com> | 2022-12-21 16:26:44 +0100 |
commit | 68ce1575fc902958a9b1d197e2c79ea842a7776d (patch) | |
tree | b933242e4ad2faacb3df1245e241602356bfe69f /configure | |
parent | ea6ed58e630eb1ae94116e0100831109bff994b7 (diff) | |
download | binutils-68ce1575fc902958a9b1d197e2c79ea842a7776d.zip binutils-68ce1575fc902958a9b1d197e2c79ea842a7776d.tar.gz binutils-68ce1575fc902958a9b1d197e2c79ea842a7776d.tar.bz2 |
gdb/c++: validate 'using' directives based on the current line
When asking GDB to print a variable from an imported namespace, we only
want to see variables imported in lines that the inferior has already
gone through, as is being tested last in gdb.cp/nsusing.exp. However
with the proposed change to gdb.cp/nsusing.exp, we get the following
failures:
(gdb) PASS: gdb.cp/nsusing.exp: continue to breakpoint: marker10 stop
print x
$9 = 911
(gdb) FAIL: gdb.cp/nsusing.exp: print x, before using statement
next
15 y += x;
(gdb) PASS: gdb.cp/nsusing.exp: using namespace M
print x
$10 = 911
(gdb) PASS: gdb.cp/nsusing.exp: print x, only using M
Showing that the feature wasn't functioning properly, it just so
happened that gcc ordered the namespaces in a convenient way.
This happens because GDB doesn't take into account the line where the
"using namespace" directive is written. So long as it shows up in the
current scope, we assume it is valid.
To fix this, add a new member to struct using_direct, that stores the
line where the directive was written, and a new function that informs if
the using directive is valid already.
Unfortunately, due to a GCC bug, the failure still shows up. Compilers
that set the declaration line of the using directive correctly (such as
Clang) do not show such a bug, so the test includes an XFAIL for gcc
code.
Finally, because the final test of gdb.cp/nsusing.exp has turned into
multiple that all would need XFAILs for older GCCs (<= 4.3), and that
GCC is very old, if it is detected, the test just exits early.
Approved-by: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'configure')
0 files changed, 0 insertions, 0 deletions