Skip to content

Commit e71925a

Browse files
committed
Auto merge of #88842 - wesleywiser:fix_dbg_tests_windows_sdk, r=michaelwoerister
Fix debuginfo tests for the latest version of the Windows SDK. Re-enable the tests that were disabled to fix CI. Changes: - Cdb now correctly visualizes enums. - Cdb doesn't render emoji characters in `OSStr` anymore. - Cdb doesn't always render `str` correctly (#88840)
2 parents 0c0826c + e156df2 commit e71925a

File tree

3 files changed

+58
-89
lines changed

3 files changed

+58
-89
lines changed

Diff for: src/test/debuginfo/basic-types.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
// This fails on lldb 6.0.1 on x86-64 Fedora 28; so ignore Linux for now.
1010
// ignore-linux
1111

12-
// This started failing in windows too. See https://github.com/rust-lang/rust/issues/88796
13-
// FIXME: fix and unignore this on windows
14-
// ignore-windows
15-
1612
// compile-flags:-g
1713

1814
// === GDB TESTS ===================================================================================
@@ -132,8 +128,9 @@
132128
// cdb-command:dx f64
133129
// cdb-check:f64 : 3.500000 [Type: double]
134130
// cdb-command:.enable_unicode 1
131+
// FIXME(#88840): The latest version of the Windows SDK broke the visualizer for str.
135132
// cdb-command:dx s
136-
// cdb-check:s : "Hello, World!" [Type: str]
133+
// cdb-check:s : [...] [Type: str]
137134

138135
#![allow(unused_variables)]
139136
#![feature(omit_gdb_pretty_printer_section)]

Diff for: src/test/debuginfo/msvc-pretty-enums.rs

+48-76
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,52 @@
11
// only-cdb
2-
// ignore-tidy-linelength
32
// compile-flags:-g
43

5-
// This started failing recently. See https://github.com/rust-lang/rust/issues/88796
6-
// FIXME: fix and unignore this
7-
// ignore-windows
8-
94
// cdb-command: g
105

11-
// Note: The natvis used to visualize niche-layout enums don't work correctly in cdb
12-
// so the best we can do is to make sure we are generating the right debuginfo.
13-
// Therefore, we use the `!` [format specifier](https://docs.microsoft.com/en-us/visualstudio/debugger/format-specifiers-in-cpp?view=vs-2019#BKMK_Visual_Studio_2012_format_specifiers)
14-
// to disable the natvis for a given expression. We also provide the `-r2` flag
15-
// to expand the expression 2 levels.
16-
17-
// cdb-command: dx -r2 a,!
18-
// cdb-check:a,! [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
19-
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>::Some]
20-
// cdb-check: [+0x000] __0 : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum]
21-
// cdb-check: [+0x000] discriminant : 0x2 [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>::Discriminant$]
22-
23-
// cdb-command: dx -r2 b,!
24-
// cdb-check:b,! [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
25-
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>::Some]
26-
// cdb-check: [+0x000] __0 : 0x11 [Type: msvc_pretty_enums::CStyleEnum]
27-
// cdb-check: [+0x000] discriminant : None (0x11) [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>::Discriminant$]
28-
29-
// cdb-command: dx -r2 c,!
30-
// cdb-check:c,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
31-
// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
32-
// cdb-check: [+0x000] my_data : 0x11 [Type: msvc_pretty_enums::CStyleEnum]
33-
// cdb-check: [+0x000] discriminant : Tag1 (0x11) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Discriminant$]
34-
35-
// cdb-command: dx -r2 d,!
36-
// cdb-check:d,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
37-
// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
38-
// cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
39-
// cdb-check: [+0x000] discriminant : 0x10 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Discriminant$]
40-
41-
// cdb-command: dx -r2 e,!
42-
// cdb-check:e,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
43-
// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
44-
// cdb-check: [+0x000] my_data : 0x13 [Type: msvc_pretty_enums::CStyleEnum]
45-
// cdb-check: [+0x000] discriminant : Tag2 (0x13) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Discriminant$]
46-
47-
// cdb-command: dx -r2 f,!
48-
// cdb-check:f,! [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
49-
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>::Some]
50-
// cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *]
51-
// cdb-check: [+0x000] discriminant : 0x[...] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>::Discriminant$]
52-
53-
// cdb-command: dx -r2 g,!
54-
// cdb-check:g,! [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
55-
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>::Some]
56-
// cdb-check: [+0x000] __0 : 0x0 [Type: unsigned int *]
57-
// cdb-check: [+0x000] discriminant : None (0x0) [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>::Discriminant$]
58-
59-
// cdb-command: dx -r2 h,!
60-
// cdb-check:h,! : Some [Type: enum$<core::option::Option<u32> >]
61-
// cdb-check: [+0x000] variant0 [Type: enum$<core::option::Option<u32> >::None]
62-
// cdb-check: [+0x000] variant1 [Type: enum$<core::option::Option<u32> >::Some]
63-
// cdb-check: [+0x004] __0 : 0xc [Type: unsigned int]
64-
// cdb-check: [+0x000] discriminant : Some (0x1) [Type: core::option::Option]
6+
// cdb-command: dx a
7+
// cdb-check:a : Some({...}) [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
8+
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
9+
// cdb-check: [variant] : Some
10+
// cdb-check: [+0x000] __0 : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum]
11+
12+
// cdb-command: dx b
13+
// cdb-check:b : None [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
14+
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
15+
// cdb-check: [variant] : None
16+
17+
// cdb-command: dx c
18+
// cdb-check:c : Tag1 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
19+
// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
20+
// cdb-check: [variant] : Tag1
21+
22+
// cdb-command: dx d
23+
// cdb-check:d : Data({...}) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
24+
// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
25+
// cdb-check: [variant] : Data
26+
// cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
27+
28+
// cdb-command: dx e
29+
// cdb-check:e : Tag2 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
30+
// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
31+
// cdb-check: [variant] : Tag2
32+
33+
// cdb-command: dx f
34+
// cdb-check:f : Some({...}) [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
35+
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
36+
// cdb-check: [variant] : Some
37+
// cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *]
38+
39+
// cdb-command: dx g
40+
// cdb-check:g : None [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
41+
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
42+
// cdb-check: [variant] : None
6543

6644
// cdb-command: dx h
6745
// cdb-check:h : Some [Type: enum$<core::option::Option<u32> >]
6846
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<u32> >]
6947
// cdb-check: [variant] : Some
7048
// cdb-check: [+0x004] __0 : 0xc [Type: unsigned int]
7149

72-
// cdb-command: dx -r2 i,!
73-
// cdb-check:i,! : None [Type: enum$<core::option::Option<u32> >]
74-
// cdb-check: [+0x000] variant0 [Type: enum$<core::option::Option<u32> >::None]
75-
// cdb-check: [+0x000] variant1 [Type: enum$<core::option::Option<u32> >::Some]
76-
// cdb-check: [+0x004] __0 : 0x[...] [Type: unsigned int]
77-
// cdb-check: [+0x000] discriminant : None (0x0) [Type: core::option::Option]
78-
7950
// cdb-command: dx i
8051
// cdb-check:i : None [Type: enum$<core::option::Option<u32> >]
8152
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<u32> >]
@@ -84,16 +55,17 @@
8455
// cdb-command: dx j
8556
// cdb-check:j : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
8657

87-
// cdb-command: dx -r2 k,!
88-
// cdb-check:k,! [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
89-
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>::Some]
90-
// cdb-check: [+0x000] __0 [Type: alloc::string::String]
91-
// cdb-check: [+0x000] discriminant : 0x[...] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>::Discriminant$]
92-
93-
// cdb-command: dx -r2 l,!
94-
// cdb-check:l,! : $T2 [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
95-
// cdb-check: [+0x000] Ok [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>::Ok]
96-
// cdb-check: [+0x000] __0 : 0x2a [Type: unsigned int]
58+
// cdb-command: dx k
59+
// cdb-check:k : Some({...}) [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
60+
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
61+
// cdb-check: [variant] : Some
62+
// cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String]
63+
64+
// cdb-command: dx l
65+
// cdb-check:l : Ok [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
66+
// cdb-check: [<Raw View>] [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
67+
// cdb-check: [variant] : Ok
68+
// cdb-check: [+0x000] __0 : 0x2a [Type: unsigned int]
9769

9870
pub enum CStyleEnum {
9971
Low = 2,

Diff for: src/test/debuginfo/pretty-std.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
// min-lldb-version: 310
77
// min-cdb-version: 10.0.18317.1001
88

9-
// This started failing recently. See https://github.com/rust-lang/rust/issues/88796
10-
// FIXME: fix and unignore this
11-
// ignore-windows
12-
139
// === GDB TESTS ===================================================================================
1410

1511
// gdb-command: run
@@ -115,9 +111,11 @@
115111
// cdb-check: [11] : 33 '!' [Type: char]
116112

117113
// cdb-command: dx os_string
118-
// cdb-check:os_string : "IAMA OS string 😃" [Type: std::ffi::os_str::OsString]
114+
// NOTE: OSString is WTF-8 encoded which Windows debuggers don't understand. Verify the UTF-8
115+
// portion displays correctly.
116+
// cdb-check:os_string : "IAMA OS string [...]" [Type: std::ffi::os_str::OsString]
119117
// cdb-check: [<Raw View>] [Type: std::ffi::os_str::OsString]
120-
// cdb-check: [chars] : "IAMA OS string 😃"
118+
// cdb-check: [chars] : "IAMA OS string [...]"
121119

122120
// cdb-command: dx some
123121
// cdb-check:some : Some [Type: enum$<core::option::Option<i16> >]
@@ -131,8 +129,10 @@
131129
// cdb-check: [variant] : None
132130

133131
// cdb-command: dx some_string
134-
// NOTE: cdb fails to interpret debug info of Option enums on i686.
135-
// cdb-check:some_string [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
132+
// cdb-check:some_string : Some({...}) [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
133+
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
134+
// cdb-check: [variant] : Some
135+
// cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String]
136136

137137
// cdb-command: dx linkedlist
138138
// cdb-check:linkedlist : { len=0x2 } [Type: alloc::collections::linked_list::LinkedList<i32>]

0 commit comments

Comments
 (0)