]> git.proxmox.com Git - rustc.git/blame - tests/debuginfo/embedded-visualizer.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / tests / debuginfo / embedded-visualizer.rs
CommitLineData
923072b8
FG
1// compile-flags:-g
2// min-gdb-version: 8.1
3// ignore-lldb
9ffffee4 4// ignore-windows-gnu // emit_debug_gdb_scripts is disabled on Windows
923072b8
FG
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#![feature(debugger_visualizer)]
64#![debugger_visualizer(natvis_file = "embedded-visualizer.natvis")]
65#![debugger_visualizer(gdb_script_file = "embedded-visualizer.py")]
66
67// aux-build: dependency-with-embedded-visualizers.rs
68extern crate dependency_with_embedded_visualizers;
69
70use dependency_with_embedded_visualizers::Person;
71
72#[debugger_visualizer(natvis_file = "embedded-visualizer-point.natvis")]
73#[debugger_visualizer(gdb_script_file = "embedded-visualizer-point.py")]
74mod point {
75 pub struct Point {
76 x: i32,
77 y: i32,
78 }
79
80 impl Point {
81 pub fn new(x: i32, y: i32) -> Point {
82 Point { x: x, y: y }
83 }
84 }
85}
86
87use point::Point;
88
89pub struct Line {
90 a: Point,
91 b: Point,
92}
93
94impl Line {
95 pub fn new(a: Point, b: Point) -> Line {
96 Line { a: a, b: b }
97 }
98}
99
100fn main() {
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);
104
105 let name = String::from("Person A");
106 let person = Person::new(name, 10);
107
108 zzz(); // #break
109}
110
111fn zzz() {
112 ()
113}