| 1 |
use debugger_test::debugger_test; |
| 2 |
use smallvec::{smallvec, SmallVec}; |
| 3 |
|
| 4 |
#[inline(never)] |
| 5 |
fn __break() {} |
| 6 |
|
| 7 |
#[debugger_test( |
| 8 |
debugger = "cdb", |
| 9 |
commands = r#" |
| 10 |
.nvlist |
| 11 |
dx sv |
| 12 |
|
| 13 |
g |
| 14 |
|
| 15 |
dx sv |
| 16 |
|
| 17 |
g |
| 18 |
|
| 19 |
dx sv |
| 20 |
"#, |
| 21 |
expected_statements = r#" |
| 22 |
sv : { len=0x2 is_inline=true } [Type: smallvec::SmallVec<array$<i32,4> >] |
| 23 |
[<Raw View>] [Type: smallvec::SmallVec<array$<i32,4> >] |
| 24 |
[capacity] : 4 |
| 25 |
[len] : 0x2 [Type: unsigned __int64] |
| 26 |
[0] : 1 [Type: int] |
| 27 |
[1] : 2 [Type: int] |
| 28 |
|
| 29 |
sv : { len=0x5 is_inline=false } [Type: smallvec::SmallVec<array$<i32,4> >] |
| 30 |
[<Raw View>] [Type: smallvec::SmallVec<array$<i32,4> >] |
| 31 |
[capacity] : 0x8 [Type: unsigned __int64] |
| 32 |
[len] : 0x5 [Type: unsigned __int64] |
| 33 |
[0] : 5 [Type: int] |
| 34 |
[1] : 2 [Type: int] |
| 35 |
[2] : 3 [Type: int] |
| 36 |
[3] : 4 [Type: int] |
| 37 |
[4] : 5 [Type: int] |
| 38 |
|
| 39 |
sv : { len=0x5 is_inline=false } [Type: smallvec::SmallVec<array$<i32,4> >] |
| 40 |
[<Raw View>] [Type: smallvec::SmallVec<array$<i32,4> >] |
| 41 |
[capacity] : 0x8 [Type: unsigned __int64] |
| 42 |
[len] : 0x5 [Type: unsigned __int64] |
| 43 |
[0] : 2 [Type: int] |
| 44 |
[1] : 3 [Type: int] |
| 45 |
[2] : 4 [Type: int] |
| 46 |
[3] : 5 [Type: int] |
| 47 |
[4] : 5 [Type: int] |
| 48 |
"# |
| 49 |
)] |
| 50 |
#[inline(never)] |
| 51 |
fn test_debugger_visualizer() { |
| 52 |
// This SmallVec can hold up to 4 items on the stack: |
| 53 |
let mut sv: SmallVec<[i32; 4]> = smallvec![1, 2]; |
| 54 |
__break(); |
| 55 |
|
| 56 |
// Overfill the SmallVec to move its contents to the heap |
| 57 |
for i in 3..6 { |
| 58 |
sv.push(i); |
| 59 |
} |
| 60 |
|
| 61 |
// Update the contents of the first value of the SmallVec. |
| 62 |
sv[0] = sv[1] + sv[2]; |
| 63 |
__break(); |
| 64 |
|
| 65 |
// Sort the SmallVec in place. |
| 66 |
sv.sort(); |
| 67 |
__break(); |
| 68 |
} |