about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-08-29 20:49:03 +0200
committerGitHub <noreply@github.com>2023-08-29 20:49:03 +0200
commitd5b12a22beaf8a8f1a403598cdb49889580b7c55 (patch)
treee7a5f9aa7e8e56f9814989b8c2c624c792f13c05
parent2dfb67b48356dc1f32a734f6eb9d71d06b421d4f (diff)
parent0848ebd056638e776dcb78a18431d31a97523ec8 (diff)
downloadrust-d5b12a22beaf8a8f1a403598cdb49889580b7c55.tar.gz
rust-d5b12a22beaf8a8f1a403598cdb49889580b7c55.zip
Rollup merge of #115174 - davidtwco:needs-test-bad-location-list-67992, r=wesleywiser
tests: add test for #67992

Fixes #67992.

Just adding a regression test for this issue.
-rw-r--r--tests/debuginfo/regression-bad-location-list-67992.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/debuginfo/regression-bad-location-list-67992.rs b/tests/debuginfo/regression-bad-location-list-67992.rs
new file mode 100644
index 00000000000..cc7c4a0d71a
--- /dev/null
+++ b/tests/debuginfo/regression-bad-location-list-67992.rs
@@ -0,0 +1,31 @@
+// compile-flags:-g
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command:run
+
+// gdb-command:print a
+// gdb-check:$1 = regression_bad_location_list_67992::Foo {x: [0 <repeats 1024 times>]}
+
+// === LLDB TESTS ==================================================================================
+
+// lldb-command:run
+// lldb-command:print a
+// lldbg-check:(regression_bad_location_list_67992::Foo) $0 = [...]
+// lldbr-check:(regression_bad_location_list_67992::Foo) a = [...]
+
+const ARRAY_SIZE: usize = 1024;
+
+struct Foo {
+    x: [u64; ARRAY_SIZE],
+}
+
+fn foo(a: Foo, i: usize) -> u64 {
+    a.x[i] // #break
+}
+
+fn main() {
+    println!("Hello, world!");
+
+    println!("{}", foo(Foo { x: [0; ARRAY_SIZE] }, 42));
+}