|
14 | 14 | //@ revisions: default-mir-passes no-SingleUseConsts-mir-pass |
15 | 15 | //@ [no-SingleUseConsts-mir-pass] compile-flags: -Zmir-enable-passes=-SingleUseConsts |
16 | 16 |
|
| 17 | +// === GDB TESTS =================================================================================== |
| 18 | + |
17 | 19 | //@ 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: |
20 | 20 | //@ gdb-check: let mut c = 27; |
21 | 21 | //@ gdb-command: next |
22 | 22 | //@ gdb-check: let d = c = 99; |
|
39 | 39 | //@ gdb-command: next |
40 | 40 | //@ gdb-check: let m: *const() = &a; |
41 | 41 |
|
| 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 | + |
42 | 93 | fn main () { |
43 | 94 | let a = (); // #break |
44 | 95 | 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: |
45 | 98 | let mut c = 27; |
46 | 99 | let d = c = 99; |
47 | 100 | let e = "hi bob"; |
|
0 commit comments