|
| 1 | +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT |
| 2 | +// file at the top-level directory of this distribution and at |
| 3 | +// http://rust-lang.org/COPYRIGHT. |
| 4 | +// |
| 5 | +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 7 | +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 8 | +// option. This file may not be copied, modified, or distributed |
| 9 | +// except according to those terms. |
| 10 | + |
| 11 | +// ignore-android: FIXME(#10381) |
| 12 | +// min-lldb-version: 310 |
| 13 | + |
| 14 | +// compile-flags:-g |
| 15 | + |
| 16 | +// === GDB TESTS =================================================================================== |
| 17 | + |
| 18 | +// gdb-command:run |
| 19 | + |
| 20 | +// DESTRUCTURED STRUCT |
| 21 | +// gdb-command:print x |
| 22 | +// gdb-check:$1 = 400 |
| 23 | +// gdb-command:print y |
| 24 | +// gdb-check:$2 = 401.5 |
| 25 | +// gdb-command:print z |
| 26 | +// gdb-check:$3 = true |
| 27 | +// gdb-command:continue |
| 28 | + |
| 29 | +// DESTRUCTURED TUPLE |
| 30 | +// gdb-command:print/x _i8 |
| 31 | +// gdb-check:$4 = 0x6f |
| 32 | +// gdb-command:print/x _u8 |
| 33 | +// gdb-check:$5 = 0x70 |
| 34 | +// gdb-command:print _i16 |
| 35 | +// gdb-check:$6 = -113 |
| 36 | +// gdb-command:print _u16 |
| 37 | +// gdb-check:$7 = 114 |
| 38 | +// gdb-command:print _i32 |
| 39 | +// gdb-check:$8 = -115 |
| 40 | +// gdb-command:print _u32 |
| 41 | +// gdb-check:$9 = 116 |
| 42 | +// gdb-command:print _i64 |
| 43 | +// gdb-check:$10 = -117 |
| 44 | +// gdb-command:print _u64 |
| 45 | +// gdb-check:$11 = 118 |
| 46 | +// gdb-command:print _f32 |
| 47 | +// gdb-check:$12 = 119.5 |
| 48 | +// gdb-command:print _f64 |
| 49 | +// gdb-check:$13 = 120.5 |
| 50 | +// gdb-command:continue |
| 51 | + |
| 52 | +// MORE COMPLEX CASE |
| 53 | +// gdb-command:print v1 |
| 54 | +// gdb-check:$14 = 80000 |
| 55 | +// gdb-command:print x1 |
| 56 | +// gdb-check:$15 = 8000 |
| 57 | +// gdb-command:print *y1 |
| 58 | +// gdb-check:$16 = 80001.5 |
| 59 | +// gdb-command:print z1 |
| 60 | +// gdb-check:$17 = false |
| 61 | +// gdb-command:print *x2 |
| 62 | +// gdb-check:$18 = -30000 |
| 63 | +// gdb-command:print y2 |
| 64 | +// gdb-check:$19 = -300001.5 |
| 65 | +// gdb-command:print *z2 |
| 66 | +// gdb-check:$20 = true |
| 67 | +// gdb-command:print v2 |
| 68 | +// gdb-check:$21 = 854237.5 |
| 69 | +// gdb-command:continue |
| 70 | + |
| 71 | + |
| 72 | +// === LLDB TESTS ================================================================================== |
| 73 | + |
| 74 | +// lldb-command:type format add --format hex char |
| 75 | +// lldb-command:type format add --format hex 'unsigned char' |
| 76 | + |
| 77 | +// lldb-command:run |
| 78 | + |
| 79 | +// DESTRUCTURED STRUCT |
| 80 | +// lldb-command:print x |
| 81 | +// lldb-check:[...]$0 = 400 |
| 82 | +// lldb-command:print y |
| 83 | +// lldb-check:[...]$1 = 401.5 |
| 84 | +// lldb-command:print z |
| 85 | +// lldb-check:[...]$2 = true |
| 86 | +// lldb-command:continue |
| 87 | + |
| 88 | +// DESTRUCTURED TUPLE |
| 89 | +// lldb-command:print _i8 |
| 90 | +// lldb-check:[...]$3 = 0x6f |
| 91 | +// lldb-command:print _u8 |
| 92 | +// lldb-check:[...]$4 = 0x70 |
| 93 | +// lldb-command:print _i16 |
| 94 | +// lldb-check:[...]$5 = -113 |
| 95 | +// lldb-command:print _u16 |
| 96 | +// lldb-check:[...]$6 = 114 |
| 97 | +// lldb-command:print _i32 |
| 98 | +// lldb-check:[...]$7 = -115 |
| 99 | +// lldb-command:print _u32 |
| 100 | +// lldb-check:[...]$8 = 116 |
| 101 | +// lldb-command:print _i64 |
| 102 | +// lldb-check:[...]$9 = -117 |
| 103 | +// lldb-command:print _u64 |
| 104 | +// lldb-check:[...]$10 = 118 |
| 105 | +// lldb-command:print _f32 |
| 106 | +// lldb-check:[...]$11 = 119.5 |
| 107 | +// lldb-command:print _f64 |
| 108 | +// lldb-check:[...]$12 = 120.5 |
| 109 | +// lldb-command:continue |
| 110 | + |
| 111 | +// MORE COMPLEX CASE |
| 112 | +// lldb-command:print v1 |
| 113 | +// lldb-check:[...]$13 = 80000 |
| 114 | +// lldb-command:print x1 |
| 115 | +// lldb-check:[...]$14 = 8000 |
| 116 | +// lldb-command:print *y1 |
| 117 | +// lldb-check:[...]$15 = 80001.5 |
| 118 | +// lldb-command:print z1 |
| 119 | +// lldb-check:[...]$16 = false |
| 120 | +// lldb-command:print *x2 |
| 121 | +// lldb-check:[...]$17 = -30000 |
| 122 | +// lldb-command:print y2 |
| 123 | +// lldb-check:[...]$18 = -300001.5 |
| 124 | +// lldb-command:print *z2 |
| 125 | +// lldb-check:[...]$19 = true |
| 126 | +// lldb-command:print v2 |
| 127 | +// lldb-check:[...]$20 = 854237.5 |
| 128 | +// lldb-command:continue |
| 129 | + |
| 130 | + |
| 131 | +struct Struct { |
| 132 | + x: i16, |
| 133 | + y: f32, |
| 134 | + z: bool |
| 135 | +} |
| 136 | + |
| 137 | +fn main() { |
| 138 | + |
| 139 | + let s = Struct { |
| 140 | + x: 400, |
| 141 | + y: 401.5, |
| 142 | + z: true |
| 143 | + }; |
| 144 | + |
| 145 | + for &Struct { x, y, z } in [s].iter() { |
| 146 | + zzz(); // #break |
| 147 | + } |
| 148 | + |
| 149 | + let tuple: (i8, u8, i16, u16, i32, u32, i64, u64, f32, f64) = |
| 150 | + (0x6f, 0x70, -113, 114, -115, 116, -117, 118, 119.5, 120.5); |
| 151 | + |
| 152 | + for &(_i8, _u8, _i16, _u16, _i32, _u32, _i64, _u64, _f32, _f64) in [tuple].iter() { |
| 153 | + zzz(); // #break |
| 154 | + } |
| 155 | + |
| 156 | + let more_complex: (i32, &Struct, Struct, Box<f64>) = |
| 157 | + (80000, |
| 158 | + &Struct { |
| 159 | + x: 8000, |
| 160 | + y: 80001.5, |
| 161 | + z: false |
| 162 | + }, |
| 163 | + Struct { |
| 164 | + x: -30000, |
| 165 | + y: -300001.5, |
| 166 | + z: true |
| 167 | + }, |
| 168 | + box 854237.5); |
| 169 | + |
| 170 | + for &(v1, |
| 171 | + &Struct { x: x1, y: ref y1, z: z1 }, |
| 172 | + Struct { x: ref x2, y: y2, z: ref z2 }, |
| 173 | + box v2) in [more_complex].iter() { |
| 174 | + zzz(); // #break |
| 175 | + } |
| 176 | +} |
| 177 | + |
| 178 | +fn zzz() {()} |
0 commit comments