2 // min-gdb-version: 8.1
4 // ignore-windows-gnu // emit_debug_gdb_scripts is disabled on Windows
6 // === CDB TESTS ==================================================================================
10 // The .nvlist command in cdb does not always have a deterministic output
11 // for the order that NatVis files are displayed.
13 // cdb-command: .nvlist
14 // cdb-check: [...].exe (embedded NatVis "[...]embedded_visualizer-0.natvis")
16 // cdb-command: .nvlist
17 // cdb-check: [...].exe (embedded NatVis "[...]embedded_visualizer-1.natvis")
19 // cdb-command: .nvlist
20 // cdb-check: [...].exe (embedded NatVis "[...]embedded_visualizer-2.natvis")
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]
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]
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]
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]
46 // === GDB TESTS ===================================================================================
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.
62 #![allow(unused_variables)]
63 #![feature(debugger_visualizer)]
64 #![debugger_visualizer(natvis_file = "embedded-visualizer.natvis")]
65 #![debugger_visualizer(gdb_script_file = "embedded-visualizer.py")]
67 // aux-build: dependency-with-embedded-visualizers.rs
68 extern crate dependency_with_embedded_visualizers;
70 use dependency_with_embedded_visualizers::Person;
72 #[debugger_visualizer(natvis_file = "embedded-visualizer-point.natvis")]
73 #[debugger_visualizer(gdb_script_file = "embedded-visualizer-point.py")]
81 pub fn new(x: i32, y: i32) -> Point {
95 pub fn new(a: Point, b: Point) -> Line {
101 let point_a = Point::new(0, 0);
102 let point_b = Point::new(5, 8);
103 let line = Line::new(point_a, point_b);
105 let name = String::from("Person A");
106 let person = Person::new(name, 10);