about summary refs log tree commit diff
path: root/src/test/debuginfo/msvc-embedded-natvis.rs
diff options
context:
space:
mode:
authorridwanabdillahi <91507758+ridwanabdillahi@users.noreply.github.com>2022-04-25 18:02:43 -0700
committerridwanabdillahi <91507758+ridwanabdillahi@users.noreply.github.com>2022-05-03 10:53:54 -0700
commit175a4eab84379cebfc230ea357ae02dc9be39660 (patch)
tree19f4ae4b9b91cb53e6ee05368127daa4fbc88d33 /src/test/debuginfo/msvc-embedded-natvis.rs
parente1df625306f4136949e02612406f0c60df6008f3 (diff)
Add support for a new attribute `#[debugger_visualizer]` to support embedding debugger visualizers into a generated PDB.
Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries.

Merge the queries for debugger visualizers into a single query.

Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`.

Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate.

Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature.

Respond to PR comments and minor cleanups.
Diffstat (limited to 'src/test/debuginfo/msvc-embedded-natvis.rs')
-rw-r--r--src/test/debuginfo/msvc-embedded-natvis.rs64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/test/debuginfo/msvc-embedded-natvis.rs b/src/test/debuginfo/msvc-embedded-natvis.rs
new file mode 100644
index 00000000000..f714fb2ad17
--- /dev/null
+++ b/src/test/debuginfo/msvc-embedded-natvis.rs
@@ -0,0 +1,64 @@
+// only-cdb
+// compile-flags:-g
+
+// === CDB TESTS ==================================================================================
+
+// cdb-command: g
+
+// cdb-command: .nvlist
+// cdb-check:    [...].exe (embedded NatVis "[...]msvc_embedded_natvis-0.natvis")
+
+// cdb-command: dx point_a
+// cdb-check:point_a          : (0, 0) [Type: msvc_embedded_natvis::Point]
+// cdb-check:    [<Raw View>]     [Type: msvc_embedded_natvis::Point]
+// cdb-check:    [x]              : 0 [Type: int]
+// cdb-check:    [y]              : 0 [Type: int]
+
+// cdb-command: dx point_b
+// cdb-check:point_b          : (5, 8) [Type: msvc_embedded_natvis::Point]
+// cdb-check:    [<Raw View>]     [Type: msvc_embedded_natvis::Point]
+// cdb-check:    [x]              : 5 [Type: int]
+// cdb-check:    [y]              : 8 [Type: int]
+
+// cdb-command: dx line
+// cdb-check:line             : ((0, 0), (5, 8)) [Type: msvc_embedded_natvis::Line]
+// cdb-check:    [<Raw View>]     [Type: msvc_embedded_natvis::Line]
+// cdb-check:    [a]              : (0, 0) [Type: msvc_embedded_natvis::Point]
+// cdb-check:    [b]              : (5, 8) [Type: msvc_embedded_natvis::Point]
+
+#![feature(debugger_visualizer)]
+#![debugger_visualizer(natvis_file = "msvc-embedded-natvis.natvis")]
+
+pub struct Point {
+    x: i32,
+    y: i32,
+}
+
+impl Point {
+    pub fn new(x: i32, y: i32) -> Point {
+        Point { x: x, y: y }
+    }
+}
+
+pub struct Line {
+    a: Point,
+    b: Point,
+}
+
+impl Line {
+    pub fn new(a: Point, b: Point) -> Line {
+        Line { a: a, b: b }
+    }
+}
+
+fn main() {
+    let point_a = Point::new(0, 0);
+    let point_b = Point::new(5, 8);
+    let line = Line::new(point_a, point_b);
+
+    zzz(); // #break
+}
+
+fn zzz() {
+    ()
+}