|
| 1 | +// Copy of `borrowed-basic.rs` which enables the `ReferencePropagation` MIR pass. |
| 2 | +// That pass replaces debuginfo for `a => _x` where `_x = &b` to be `a => &b`, |
| 3 | +// and leaves codegen to create a ladder of allocations so as `*a == b`. |
| 4 | +// |
| 5 | +// compile-flags:-g -Zmir-enable-passes=+ReferencePropagation,-ConstDebugInfo |
| 6 | +// min-lldb-version: 310 |
| 7 | + |
| 8 | +// === GDB TESTS =================================================================================== |
| 9 | + |
| 10 | +// gdb-command:run |
| 11 | +// gdb-command:print *bool_ref |
| 12 | +// gdb-check:$1 = true |
| 13 | + |
| 14 | +// gdb-command:print *int_ref |
| 15 | +// gdb-check:$2 = -1 |
| 16 | + |
| 17 | +// gdb-command:print/d *char_ref |
| 18 | +// gdb-check:$3 = 97 |
| 19 | + |
| 20 | +// gdb-command:print *i8_ref |
| 21 | +// gdbg-check:$4 = 68 'D' |
| 22 | +// gdbr-check:$4 = 68 |
| 23 | + |
| 24 | +// gdb-command:print *i16_ref |
| 25 | +// gdb-check:$5 = -16 |
| 26 | + |
| 27 | +// gdb-command:print *i32_ref |
| 28 | +// gdb-check:$6 = -32 |
| 29 | + |
| 30 | +// gdb-command:print *i64_ref |
| 31 | +// gdb-check:$7 = -64 |
| 32 | + |
| 33 | +// gdb-command:print *uint_ref |
| 34 | +// gdb-check:$8 = 1 |
| 35 | + |
| 36 | +// gdb-command:print *u8_ref |
| 37 | +// gdbg-check:$9 = 100 'd' |
| 38 | +// gdbr-check:$9 = 100 |
| 39 | + |
| 40 | +// gdb-command:print *u16_ref |
| 41 | +// gdb-check:$10 = 16 |
| 42 | + |
| 43 | +// gdb-command:print *u32_ref |
| 44 | +// gdb-check:$11 = 32 |
| 45 | + |
| 46 | +// gdb-command:print *u64_ref |
| 47 | +// gdb-check:$12 = 64 |
| 48 | + |
| 49 | +// gdb-command:print *f32_ref |
| 50 | +// gdb-check:$13 = 2.5 |
| 51 | + |
| 52 | +// gdb-command:print *f64_ref |
| 53 | +// gdb-check:$14 = 3.5 |
| 54 | + |
| 55 | + |
| 56 | +// === LLDB TESTS ================================================================================== |
| 57 | + |
| 58 | +// lldb-command:run |
| 59 | +// lldb-command:print *bool_ref |
| 60 | +// lldbg-check:[...]$0 = true |
| 61 | +// lldbr-check:(bool) *bool_ref = true |
| 62 | + |
| 63 | +// lldb-command:print *int_ref |
| 64 | +// lldbg-check:[...]$1 = -1 |
| 65 | +// lldbr-check:(isize) *int_ref = -1 |
| 66 | + |
| 67 | +// NOTE: only rust-enabled lldb supports 32bit chars |
| 68 | +// lldbr-command:print *char_ref |
| 69 | +// lldbr-check:(char) *char_ref = 'a' |
| 70 | + |
| 71 | +// lldb-command:print *i8_ref |
| 72 | +// lldbg-check:[...]$2 = 'D' |
| 73 | +// lldbr-check:(i8) *i8_ref = 68 |
| 74 | + |
| 75 | +// lldb-command:print *i16_ref |
| 76 | +// lldbg-check:[...]$3 = -16 |
| 77 | +// lldbr-check:(i16) *i16_ref = -16 |
| 78 | + |
| 79 | +// lldb-command:print *i32_ref |
| 80 | +// lldbg-check:[...]$4 = -32 |
| 81 | +// lldbr-check:(i32) *i32_ref = -32 |
| 82 | + |
| 83 | +// lldb-command:print *i64_ref |
| 84 | +// lldbg-check:[...]$5 = -64 |
| 85 | +// lldbr-check:(i64) *i64_ref = -64 |
| 86 | + |
| 87 | +// lldb-command:print *uint_ref |
| 88 | +// lldbg-check:[...]$6 = 1 |
| 89 | +// lldbr-check:(usize) *uint_ref = 1 |
| 90 | + |
| 91 | +// lldb-command:print *u8_ref |
| 92 | +// lldbg-check:[...]$7 = 'd' |
| 93 | +// lldbr-check:(u8) *u8_ref = 100 |
| 94 | + |
| 95 | +// lldb-command:print *u16_ref |
| 96 | +// lldbg-check:[...]$8 = 16 |
| 97 | +// lldbr-check:(u16) *u16_ref = 16 |
| 98 | + |
| 99 | +// lldb-command:print *u32_ref |
| 100 | +// lldbg-check:[...]$9 = 32 |
| 101 | +// lldbr-check:(u32) *u32_ref = 32 |
| 102 | + |
| 103 | +// lldb-command:print *u64_ref |
| 104 | +// lldbg-check:[...]$10 = 64 |
| 105 | +// lldbr-check:(u64) *u64_ref = 64 |
| 106 | + |
| 107 | +// lldb-command:print *f32_ref |
| 108 | +// lldbg-check:[...]$11 = 2.5 |
| 109 | +// lldbr-check:(f32) *f32_ref = 2.5 |
| 110 | + |
| 111 | +// lldb-command:print *f64_ref |
| 112 | +// lldbg-check:[...]$12 = 3.5 |
| 113 | +// lldbr-check:(f64) *f64_ref = 3.5 |
| 114 | + |
| 115 | +#![allow(unused_variables)] |
| 116 | +#![feature(omit_gdb_pretty_printer_section)] |
| 117 | +#![omit_gdb_pretty_printer_section] |
| 118 | + |
| 119 | +fn main() { |
| 120 | + let bool_val: bool = true; |
| 121 | + let bool_ref: &bool = &bool_val; |
| 122 | + |
| 123 | + let int_val: isize = -1; |
| 124 | + let int_ref: &isize = &int_val; |
| 125 | + |
| 126 | + let char_val: char = 'a'; |
| 127 | + let char_ref: &char = &char_val; |
| 128 | + |
| 129 | + let i8_val: i8 = 68; |
| 130 | + let i8_ref: &i8 = &i8_val; |
| 131 | + |
| 132 | + let i16_val: i16 = -16; |
| 133 | + let i16_ref: &i16 = &i16_val; |
| 134 | + |
| 135 | + let i32_val: i32 = -32; |
| 136 | + let i32_ref: &i32 = &i32_val; |
| 137 | + |
| 138 | + let i64_val: i64 = -64; |
| 139 | + let i64_ref: &i64 = &i64_val; |
| 140 | + |
| 141 | + let uint_val: usize = 1; |
| 142 | + let uint_ref: &usize = &uint_val; |
| 143 | + |
| 144 | + let u8_val: u8 = 100; |
| 145 | + let u8_ref: &u8 = &u8_val; |
| 146 | + |
| 147 | + let u16_val: u16 = 16; |
| 148 | + let u16_ref: &u16 = &u16_val; |
| 149 | + |
| 150 | + let u32_val: u32 = 32; |
| 151 | + let u32_ref: &u32 = &u32_val; |
| 152 | + |
| 153 | + let u64_val: u64 = 64; |
| 154 | + let u64_ref: &u64 = &u64_val; |
| 155 | + |
| 156 | + let f32_val: f32 = 2.5; |
| 157 | + let f32_ref: &f32 = &f32_val; |
| 158 | + |
| 159 | + let f64_val: f64 = 3.5; |
| 160 | + let f64_ref: &f64 = &f64_val; |
| 161 | + |
| 162 | + zzz(); // #break |
| 163 | +} |
| 164 | + |
| 165 | +fn zzz() {()} |
0 commit comments