about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Wood <david.wood@huawei.com>2023-08-24 14:12:42 +0100
committerDavid Wood <david.wood@huawei.com>2023-08-25 10:31:22 +0100
commit0848ebd056638e776dcb78a18431d31a97523ec8 (patch)
treee1e2fb7ac8233fb186c5d7a9ae4aa5063fd086dc
parent4535d33e337104e7961ca7f2086627cbb07919dd (diff)
downloadrust-0848ebd056638e776dcb78a18431d31a97523ec8.tar.gz
rust-0848ebd056638e776dcb78a18431d31a97523ec8.zip
tests: add test for #67992
Signed-off-by: David Wood <david@davidtw.co>
-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));
+}