aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.rust/modules.rs
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-01-19 15:25:19 -0700
committerTom Tromey <tom@tromey.com>2018-01-19 15:30:28 -0700
commitfcfcc376969c4d7a6d20827c47b584db389a32b9 (patch)
treec99d9a8dfe4bd23e72223d8f86449b84f68f177f /gdb/testsuite/gdb.rust/modules.rs
parent634c1c3109a2ffdf43ef9dab839c88108d9980f3 (diff)
downloadgdb-fcfcc376969c4d7a6d20827c47b584db389a32b9.zip
gdb-fcfcc376969c4d7a6d20827c47b584db389a32b9.tar.gz
gdb-fcfcc376969c4d7a6d20827c47b584db389a32b9.tar.bz2
Fix qualified name lookup for Rust
In https://github.com/rust-lang/rust/pull/46457, "m4b" pointed out that the Rust support in gdb doesn't properly handle the lookup of qualified names. In particular, as shown in the test case in this patch, something like "::NAME" should be found in the global scope, but is not. This turns out to happen because rust_lookup_symbol_nonlocal does not search the global scope unless the name in question is unqualified. However, lookup_symbol_aux does not search the global scope, and appears to search the static scope only as a fallback (I wonder if this is needed?). This patch fixes the problem by changing rust_lookup_symbol_nonlocal to search the static and global blocks in more cases. Regression tested against various versions of the rust compiler on Fedora 26 x86-64. (Note that there are unrelated failures with newer versions of rustc; I will be addressing those separately.) 2018-01-19 Tom Tromey <tom@tromey.com> * rust-lang.c (rust_lookup_symbol_nonlocal): Look up qualified symbols in the static and global blocks. 2018-01-19 Tom Tromey <tom@tromey.com> * gdb.rust/modules.rs (TWENTY_THREE): New global. * gdb.rust/modules.exp: Add ::-qualified lookup test.
Diffstat (limited to 'gdb/testsuite/gdb.rust/modules.rs')
-rw-r--r--gdb/testsuite/gdb.rust/modules.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.rust/modules.rs b/gdb/testsuite/gdb.rust/modules.rs
index e005865..3ba1253 100644
--- a/gdb/testsuite/gdb.rust/modules.rs
+++ b/gdb/testsuite/gdb.rust/modules.rs
@@ -21,6 +21,10 @@ fn f2() {
println!("::f2");
}
+// See https://github.com/rust-lang/rust/pull/46457
+#[no_mangle]
+pub static TWENTY_THREE : u16 = 23;
+
pub struct Generic<T>(T);
pub struct Type;
@@ -56,6 +60,8 @@ pub mod mod1 {
let f2 = || println!("lambda f2");
+ let copy = ::TWENTY_THREE;
+
f2(); // set breakpoint here
f3();
self::f2();