]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs
auto merge of #16650 : ruud-v-a/rust/timespec-arithmetic, r=alexcrichton
[rust.git] / src / test / debuginfo / gdb-pretty-struct-and-enums-pre-gdb-7-7.rs
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 // This test uses only GDB Python API features which should be available in
12 // older versions of GDB too. A more extensive test can be found in
13 // gdb-pretty-struct-and-enums.rs
14
15 // ignore-tidy-linelength
16 // ignore-lldb
17 // ignore-android: FIXME(#10381)
18 // compile-flags:-g
19 // gdb-use-pretty-printer
20
21 // The following line actually doesn't have to do anything with pretty printing,
22 // it just tells GDB to print values on one line:
23 // gdb-command: set print pretty off
24
25 // gdb-command: rbreak zzz
26 // gdb-command: run
27 // gdb-command: finish
28
29 // gdb-command: print regular_struct
30 // gdb-check:$1 = RegularStruct = {the_first_field = 101, the_second_field = 102.5, the_third_field = false}
31
32 // gdb-command: print empty_struct
33 // gdb-check:$2 = EmptyStruct
34
35 // gdb-command: print c_style_enum1
36 // gdb-check:$3 = CStyleEnumVar1
37
38 // gdb-command: print c_style_enum2
39 // gdb-check:$4 = CStyleEnumVar2
40
41 // gdb-command: print c_style_enum3
42 // gdb-check:$5 = CStyleEnumVar3
43
44 struct RegularStruct {
45     the_first_field: int,
46     the_second_field: f64,
47     the_third_field: bool,
48 }
49
50 struct EmptyStruct;
51
52 enum CStyleEnum {
53     CStyleEnumVar1,
54     CStyleEnumVar2,
55     CStyleEnumVar3,
56 }
57
58 fn main() {
59
60     let regular_struct = RegularStruct {
61         the_first_field: 101,
62         the_second_field: 102.5,
63         the_third_field: false
64     };
65
66     let empty_struct = EmptyStruct;
67
68     let c_style_enum1 = CStyleEnumVar1;
69     let c_style_enum2 = CStyleEnumVar2;
70     let c_style_enum3 = CStyleEnumVar3;
71
72     zzz();
73 }
74
75 fn zzz() { () }