Skip to content

Commit 755723a

Browse files
committed
tests: Add test for basic line-by-line stepping in a debugger
Let's wait with lldb testing until the test works properly with gdb.
1 parent f32b232 commit 755723a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

tests/debuginfo/basic-stepping.rs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//! Test that stepping through a simple program with a debugger one line at a
2+
//! time works intuitively, e.g. that `next` takes you to the next source line.
3+
//! Regression test for <https://github.com/rust-lang/rust/issues/33013>.
4+
5+
//@ compile-flags: -g
6+
7+
// gdb-command: run
8+
// FIXME(#97083): Should we be able to break on initialization of zero-sized types?
9+
// FIXME(#97083): Right now the first breakable line is:
10+
// gdb-check: let mut c = 27;
11+
// gdb-command: next
12+
// gdb-check: let d = c = 99;
13+
// gdb-command: next
14+
// FIXME(#33013): gdb-check: let e = "hi bob";
15+
// FIXME(#33013): gdb-command: next
16+
// FIXME(#33013): gdb-check: let f = b"hi bob";
17+
// FIXME(#33013): gdb-command: next
18+
// FIXME(#33013): gdb-check: let g = b'9';
19+
// FIXME(#33013): gdb-command: next
20+
// FIXME(#33013): gdb-check: let h = ["whatever"; 8];
21+
// FIXME(#33013): gdb-command: next
22+
// gdb-check: let i = [1,2,3,4];
23+
// gdb-command: next
24+
// gdb-check: let j = (23, "hi");
25+
// gdb-command: next
26+
// gdb-check: let k = 2..3;
27+
// gdb-command: next
28+
// gdb-check: let l = &i[k];
29+
// gdb-command: next
30+
// gdb-check: let m: *const() = &a;
31+
32+
fn main () {
33+
let a = (); // #break
34+
let b : [i32; 0] = [];
35+
let mut c = 27;
36+
let d = c = 99;
37+
let e = "hi bob";
38+
let f = b"hi bob";
39+
let g = b'9';
40+
let h = ["whatever"; 8];
41+
let i = [1,2,3,4];
42+
let j = (23, "hi");
43+
let k = 2..3;
44+
let l = &i[k];
45+
let m: *const() = &a;
46+
}

0 commit comments

Comments
 (0)