|
| 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-tidy-linelength |
| 12 | +// min-lldb-version: 310 |
| 13 | + |
| 14 | +// compile-flags:-g |
| 15 | + |
| 16 | +// === GDB TESTS =================================================================================== |
| 17 | +// gdb-command:run |
| 18 | + |
| 19 | +// gdb-command:print eight_bytes1 |
| 20 | +// gdb-check:$1 = {{RUST$ENUM$DISR = Variant1, __0 = 100}, {RUST$ENUM$DISR = Variant1, __0 = 100}} |
| 21 | +// gdb-command:print four_bytes1 |
| 22 | +// gdb-check:$2 = {{RUST$ENUM$DISR = Variant1, __0 = 101}, {RUST$ENUM$DISR = Variant1, __0 = 101}} |
| 23 | +// gdb-command:print two_bytes1 |
| 24 | +// gdb-check:$3 = {{RUST$ENUM$DISR = Variant1, __0 = 102}, {RUST$ENUM$DISR = Variant1, __0 = 102}} |
| 25 | +// gdb-command:print one_byte1 |
| 26 | +// gdb-check:$4 = {{RUST$ENUM$DISR = Variant1, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant1, __0 = 65 'A'}} |
| 27 | + |
| 28 | +// gdb-command:print eight_bytes2 |
| 29 | +// gdb-check:$5 = {{RUST$ENUM$DISR = Variant2, __0 = 100}, {RUST$ENUM$DISR = Variant2, __0 = 100}} |
| 30 | +// gdb-command:print four_bytes2 |
| 31 | +// gdb-check:$6 = {{RUST$ENUM$DISR = Variant2, __0 = 101}, {RUST$ENUM$DISR = Variant2, __0 = 101}} |
| 32 | +// gdb-command:print two_bytes2 |
| 33 | +// gdb-check:$7 = {{RUST$ENUM$DISR = Variant2, __0 = 102}, {RUST$ENUM$DISR = Variant2, __0 = 102}} |
| 34 | +// gdb-command:print one_byte2 |
| 35 | +// gdb-check:$8 = {{RUST$ENUM$DISR = Variant2, __0 = 65 'A'}, {RUST$ENUM$DISR = Variant2, __0 = 65 'A'}} |
| 36 | + |
| 37 | +// gdb-command:continue |
| 38 | + |
| 39 | +// === LLDB TESTS ================================================================================== |
| 40 | +// lldb-command:run |
| 41 | + |
| 42 | +// lldb-command:print eight_bytes1 |
| 43 | +// lldb-check:[...]$0 = Variant1(100) |
| 44 | +// lldb-command:print four_bytes1 |
| 45 | +// lldb-check:[...]$1 = Variant1(101) |
| 46 | +// lldb-command:print two_bytes1 |
| 47 | +// lldb-check:[...]$2 = Variant1(102) |
| 48 | +// lldb-command:print one_byte1 |
| 49 | +// lldb-check:[...]$3 = Variant1('A') |
| 50 | + |
| 51 | +// lldb-command:print eight_bytes2 |
| 52 | +// lldb-check:[...]$4 = Variant2(100) |
| 53 | +// lldb-command:print four_bytes2 |
| 54 | +// lldb-check:[...]$5 = Variant2(101) |
| 55 | +// lldb-command:print two_bytes2 |
| 56 | +// lldb-check:[...]$6 = Variant2(102) |
| 57 | +// lldb-command:print one_byte2 |
| 58 | +// lldb-check:[...]$7 = Variant2('A') |
| 59 | + |
| 60 | +// lldb-command:continue |
| 61 | + |
| 62 | +#![allow(unused_variables)] |
| 63 | +#![allow(dead_code)] |
| 64 | +#![omit_gdb_pretty_printer_section] |
| 65 | + |
| 66 | +// This test case makes sure that we get correct type descriptions for the enum |
| 67 | +// discriminant of different instantiations of the same generic enum type where, |
| 68 | +// dependending on the generic type parameter(s), the discriminant has a |
| 69 | +// different size in memory. |
| 70 | + |
| 71 | +enum Enum<T> { |
| 72 | + Variant1(T), |
| 73 | + Variant2(T) |
| 74 | +} |
| 75 | + |
| 76 | +fn main() { |
| 77 | + // These are ordered for descending size on purpose |
| 78 | + let eight_bytes1 = Enum::Variant1(100.0f64); |
| 79 | + let four_bytes1 = Enum::Variant1(101i32); |
| 80 | + let two_bytes1 = Enum::Variant1(102i16); |
| 81 | + let one_byte1 = Enum::Variant1(65u8); |
| 82 | + |
| 83 | + let eight_bytes2 = Enum::Variant2(100.0f64); |
| 84 | + let four_bytes2 = Enum::Variant2(101i32); |
| 85 | + let two_bytes2 = Enum::Variant2(102i16); |
| 86 | + let one_byte2 = Enum::Variant2(65u8); |
| 87 | + |
| 88 | + zzz(); // #break |
| 89 | +} |
| 90 | + |
| 91 | +fn zzz() { () } |
0 commit comments