]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/gdb-pretty-struct-and-enums.rs
Rollup merge of #107807 - GuillaumeGomez:fix-small-debug-typo, r=notriddle
[rust.git] / tests / debuginfo / gdb-pretty-struct-and-enums.rs
1 // ignore-lldb
2 // ignore-android: FIXME(#10381)
3 // min-gdb-version: 8.1
4
5 // compile-flags:-g
6
7 // gdb-command: run
8
9 // gdb-command: print regular_struct
10 // gdbg-check:$1 = {the_first_field = 101, the_second_field = 102.5, the_third_field = false}
11 // gdbr-check:$1 = gdb_pretty_struct_and_enums::RegularStruct {the_first_field: 101, the_second_field: 102.5, the_third_field: false}
12
13 // gdb-command: print empty_struct
14 // gdbg-check:$2 = EmptyStruct
15 // gdbr-check:$2 = gdb_pretty_struct_and_enums::EmptyStruct
16
17 // gdb-command: print c_style_enum1
18 // gdbg-check:$3 = CStyleEnumVar1
19 // gdbr-check:$3 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar1
20
21 // gdb-command: print c_style_enum2
22 // gdbg-check:$4 = CStyleEnumVar2
23 // gdbr-check:$4 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar2
24
25 // gdb-command: print c_style_enum3
26 // gdbg-check:$5 = CStyleEnumVar3
27 // gdbr-check:$5 = gdb_pretty_struct_and_enums::CStyleEnum::CStyleEnumVar3
28
29 #![allow(dead_code, unused_variables)]
30
31 struct RegularStruct {
32     the_first_field: isize,
33     the_second_field: f64,
34     the_third_field: bool,
35 }
36
37 struct EmptyStruct;
38
39 enum CStyleEnum {
40     CStyleEnumVar1,
41     CStyleEnumVar2,
42     CStyleEnumVar3,
43 }
44
45 fn main() {
46
47     let regular_struct = RegularStruct {
48         the_first_field: 101,
49         the_second_field: 102.5,
50         the_third_field: false
51     };
52
53     let empty_struct = EmptyStruct;
54
55     let c_style_enum1 = CStyleEnum::CStyleEnumVar1;
56     let c_style_enum2 = CStyleEnum::CStyleEnumVar2;
57     let c_style_enum3 = CStyleEnum::CStyleEnumVar3;
58
59     zzz(); // #break
60 }
61
62 fn zzz() { () }