aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.rust/simple.exp
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-09-15 09:27:01 -0600
committerTom Tromey <tromey@adacore.com>2020-09-15 09:27:01 -0600
commit08cc37dd042338209c8e2aa5db04aef2ecb5c62b (patch)
treed53ceebe483d7a77b4701254429be25206f54432 /gdb/testsuite/gdb.rust/simple.exp
parentcbe256847e19f044039afeba7b152ef19d9e0635 (diff)
downloadgdb-08cc37dd042338209c8e2aa5db04aef2ecb5c62b.zip
gdb-08cc37dd042338209c8e2aa5db04aef2ecb5c62b.tar.gz
gdb-08cc37dd042338209c8e2aa5db04aef2ecb5c62b.tar.bz2
Avoid running one Rust test against older LLVM
LLVM 8.0 introduced some changes to let the Rust compiler emit DWARF variant parts. Before this change, the compiler would emit two types with the same name, and unfortunately gdb happens to pick the wrong one. So, this patch disables the test when using an older version of LLVM. gdb/testsuite/ChangeLog 2020-09-15 Tom Tromey <tromey@adacore.com> PR rust/26197: * lib/rust-support.exp (rust_llvm_version): New proc. * gdb.rust/simple.exp: Check rust_llvm_version.
Diffstat (limited to 'gdb/testsuite/gdb.rust/simple.exp')
-rw-r--r--gdb/testsuite/gdb.rust/simple.exp13
1 files changed, 11 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.rust/simple.exp b/gdb/testsuite/gdb.rust/simple.exp
index b32eaf1..882c2e0 100644
--- a/gdb/testsuite/gdb.rust/simple.exp
+++ b/gdb/testsuite/gdb.rust/simple.exp
@@ -375,5 +375,14 @@ gdb_test "python print(e.type.fields()\[0\].artificial)" "True"
gdb_test "python print(e.type.fields()\[1\].name)" "Two"
gdb_test "python print(e.type.dynamic)" "False"
-gdb_test "python print(gdb.lookup_type('simple::MoreComplicated').dynamic)" \
- "True"
+
+# Before LLVM 8, the rust compiler would emit two types named
+# "simple::MoreComplicated" -- the C-like "underlying" enum type and
+# the Rust enum. lookup_type seems to get the former, which isn't
+# very useful. With later versions of LLVM, this test works
+# correctly.
+set v [split [rust_llvm_version] .]
+if {[lindex $v 0] >= 8} {
+ gdb_test "python print(gdb.lookup_type('simple::MoreComplicated').dynamic)" \
+ "True"
+}