Skip to content

Commit 33d7d94

Browse files
committed
Auto merge of #153792 - Enselic:basic-stepping-lldb, r=jieyouxu
tests/debuginfo/basic-stepping.rs: Add lldb test Also move the FIXME to the source code to avoid duplication, and also suppress harmless warnings that are annoying when you compile manually. Takes us one step closer towards closing #33013.
2 parents 7ad5c60 + 512d5fd commit 33d7d94

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

tests/debuginfo/basic-stepping.rs

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
//@ revisions: default-mir-passes no-SingleUseConsts-mir-pass
1515
//@ [no-SingleUseConsts-mir-pass] compile-flags: -Zmir-enable-passes=-SingleUseConsts
1616

17+
// === GDB TESTS ===================================================================================
18+
1719
//@ gdb-command: run
18-
// FIXME(#97083): Should we be able to break on initialization of zero-sized types?
19-
// FIXME(#97083): Right now the first breakable line is:
2020
//@ gdb-check: let mut c = 27;
2121
//@ gdb-command: next
2222
//@ gdb-check: let d = c = 99;
@@ -39,9 +39,62 @@
3939
//@ gdb-command: next
4040
//@ gdb-check: let m: *const() = &a;
4141

42+
// === LLDB TESTS ==================================================================================
43+
44+
// Unlike gdb, lldb will display 7 lines of context by default. It seems
45+
// impossible to get it down to 1. The best we can do is to show the current
46+
// line and one above. That is not ideal, but it will do for now.
47+
//@ lldb-command: settings set stop-line-count-before 1
48+
//@ lldb-command: settings set stop-line-count-after 0
49+
50+
//@ lldb-command: run
51+
// In `breakpoint_callback()` in `./src/etc/lldb_batchmode.py` we do
52+
// `SetSelectedFrame()`, which causes LLDB to show the current line and one line
53+
// before (since we changed `stop-line-count-before`). Note that
54+
// `normalize_whitespace()` in `lldb_batchmode.py` removes the newlines of the
55+
// output. So the current line and the line before actually ends up on the same
56+
// output line. That's fine.
57+
//@ lldb-check: [...]let mut c = 27;[...]
58+
//@ lldb-command: next
59+
// From now on we must manually `frame select` to see the current line (and one
60+
// line before).
61+
//@ lldb-command: frame select
62+
//@ lldb-check: [...]let d = c = 99;[...]
63+
//@ lldb-command: next
64+
//@ lldb-command: frame select
65+
//@ [no-SingleUseConsts-mir-pass] lldb-check: [...]let e = "hi bob";[...]
66+
//@ [no-SingleUseConsts-mir-pass] lldb-command: next
67+
//@ [no-SingleUseConsts-mir-pass] lldb-command: frame select
68+
//@ [no-SingleUseConsts-mir-pass] lldb-check: [...]let f = b"hi bob";[...]
69+
//@ [no-SingleUseConsts-mir-pass] lldb-command: next
70+
//@ [no-SingleUseConsts-mir-pass] lldb-command: frame select
71+
//@ [no-SingleUseConsts-mir-pass] lldb-check: [...]let g = b'9';[...]
72+
//@ [no-SingleUseConsts-mir-pass] lldb-command: next
73+
//@ [no-SingleUseConsts-mir-pass] lldb-command: frame select
74+
//@ lldb-check: [...]let h = ["whatever"; 8];[...]
75+
//@ lldb-command: next
76+
//@ lldb-command: frame select
77+
//@ lldb-check: [...]let i = [1,2,3,4];[...]
78+
//@ lldb-command: next
79+
//@ lldb-command: frame select
80+
//@ lldb-check: [...]let j = (23, "hi");[...]
81+
//@ lldb-command: next
82+
//@ lldb-command: frame select
83+
//@ lldb-check: [...]let k = 2..3;[...]
84+
//@ lldb-command: next
85+
//@ lldb-command: frame select
86+
//@ lldb-check: [...]let l = &i[k];[...]
87+
//@ lldb-command: next
88+
//@ lldb-command: frame select
89+
//@ lldb-check: [...]let m: *const() = &a;[...]
90+
91+
#![allow(unused_assignments, unused_variables)]
92+
4293
fn main () {
4394
let a = (); // #break
4495
let b : [i32; 0] = [];
96+
// FIXME(#97083): Should we be able to break on initialization of zero-sized types?
97+
// FIXME(#97083): Right now the first breakable line is:
4598
let mut c = 27;
4699
let d = c = 99;
47100
let e = "hi bob";

0 commit comments

Comments
 (0)