1 // compile-flags:-g
2 // min-gdb-version: 8.1
3 // ignore-lldb
4 // ignore-windows-gnu // emit_debug_gdb_scripts is disabled on Windows
5
6 // === CDB TESTS ==================================================================================
7
8 // cdb-command: g
9
10 // The .nvlist command in cdb does not always have a deterministic output
11 // for the order that NatVis files are displayed.
12
13 // cdb-command: .nvlist
14 // cdb-check: [...].exe (embedded NatVis "[...]embedded_visualizer-0.natvis")
15
16 // cdb-command: .nvlist
17 // cdb-check: [...].exe (embedded NatVis "[...]embedded_visualizer-1.natvis")
18
19 // cdb-command: .nvlist
20 // cdb-check: [...].exe (embedded NatVis "[...]embedded_visualizer-2.natvis")
21
22 // cdb-command: dx point_a
23 // cdb-check:point_a : (0, 0) [Type: embedded_visualizer::point::Point]
24 // cdb-check: [<Raw View>] [Type: embedded_visualizer::point::Point]
25 // cdb-check: [x] : 0 [Type: int]
26 // cdb-check: [y] : 0 [Type: int]
27
28 // cdb-command: dx point_b
29 // cdb-check:point_b : (5, 8) [Type: embedded_visualizer::point::Point]
30 // cdb-check: [<Raw View>] [Type: embedded_visualizer::point::Point]
31 // cdb-check: [x] : 5 [Type: int]
32 // cdb-check: [y] : 8 [Type: int]
33
34 // cdb-command: dx line
35 // cdb-check:line : ((0, 0), (5, 8)) [Type: embedded_visualizer::Line]
36 // cdb-check: [<Raw View>] [Type: embedded_visualizer::Line]
37 // cdb-check: [a] : (0, 0) [Type: embedded_visualizer::point::Point]
38 // cdb-check: [b] : (5, 8) [Type: embedded_visualizer::point::Point]
39
40 // cdb-command: dx person
41 // cdb-check:person : "Person A" is 10 years old. [Type: dependency_with_embedded_visualizers::Person]
42 // cdb-check: [<Raw View>] [Type: dependency_with_embedded_visualizers::Person]
43 // cdb-check: [name] : "Person A" [Type: alloc::string::String]
44 // cdb-check: [age] : 10 [Type: int]
45
46 // === GDB TESTS ===================================================================================
47
48 // gdb-command: run
49
50 // gdb-command: info auto-load python-scripts
51 // gdb-check:Yes pretty-printer-embedded_visualizer-0
52 // gdb-check:Yes pretty-printer-embedded_visualizer-1
53 // gdb-command: print point_a
54 // gdb-check:$1 = (0, 0)
55 // gdb-command: print point_b
56 // gdb-check:$2 = (5, 8)
57 // gdb-command: print line
58 // gdb-check:$3 = ((0, 0), (5, 8))
59 // gdb-command: print person
60 // gdb-check:$4 = "Person A" is 10 years old.
61
62 #![allow(unused_variables)]
63 #![debugger_visualizer(natvis_file = "embedded-visualizer.natvis")]
64 #![debugger_visualizer(gdb_script_file = "embedded-visualizer.py")]
65
66 // aux-build: dependency-with-embedded-visualizers.rs
67 extern crate dependency_with_embedded_visualizers;
68
69 use dependency_with_embedded_visualizers::Person;
70
71 #[debugger_visualizer(natvis_file = "embedded-visualizer-point.natvis")]
72 #[debugger_visualizer(gdb_script_file = "embedded-visualizer-point.py")]
73 mod point {
74 pub struct Point {
75 x: i32,
76 y: i32,
77 }
78
79 impl Point {
new(x: i32, y: i32) -> Point80 pub fn new(x: i32, y: i32) -> Point {
81 Point { x: x, y: y }
82 }
83 }
84 }
85
86 use point::Point;
87
88 pub struct Line {
89 a: Point,
90 b: Point,
91 }
92
93 impl Line {
new(a: Point, b: Point) -> Line94 pub fn new(a: Point, b: Point) -> Line {
95 Line { a: a, b: b }
96 }
97 }
98
main()99 fn main() {
100 let point_a = Point::new(0, 0);
101 let point_b = Point::new(5, 8);
102 let line = Line::new(point_a, point_b);
103
104 let name = String::from("Person A");
105 let person = Person::new(name, 10);
106
107 zzz(); // #break
108 }
109
zzz()110 fn zzz() {
111 ()
112 }
113