Skip to content

Fix debuginfo tests for the latest version of the Windows SDK. #88842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/test/debuginfo/basic-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
// This fails on lldb 6.0.1 on x86-64 Fedora 28; so ignore Linux for now.
// ignore-linux

// This started failing in windows too. See https://github.com/rust-lang/rust/issues/88796
// FIXME: fix and unignore this on windows
// ignore-windows

// compile-flags:-g

// === GDB TESTS ===================================================================================
Expand Down Expand Up @@ -132,8 +128,9 @@
// cdb-command:dx f64
// cdb-check:f64 : 3.500000 [Type: double]
// cdb-command:.enable_unicode 1
// FIXME(#88840): The latest version of the Windows SDK broke the visualizer for str.
// cdb-command:dx s
// cdb-check:s : "Hello, World!" [Type: str]
// cdb-check:s : [...] [Type: str]

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
Expand Down
124 changes: 48 additions & 76 deletions src/test/debuginfo/msvc-pretty-enums.rs
Original file line number Diff line number Diff line change
@@ -1,81 +1,52 @@
// only-cdb
// ignore-tidy-linelength
// compile-flags:-g

// This started failing recently. See https://github.com/rust-lang/rust/issues/88796
// FIXME: fix and unignore this
// ignore-windows

// cdb-command: g

// Note: The natvis used to visualize niche-layout enums don't work correctly in cdb
// so the best we can do is to make sure we are generating the right debuginfo.
// 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)
// to disable the natvis for a given expression. We also provide the `-r2` flag
// to expand the expression 2 levels.

// cdb-command: dx -r2 a,!
// cdb-check:a,! [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>::Some]
// cdb-check: [+0x000] __0 : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant : 0x2 [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>::Discriminant$]

// cdb-command: dx -r2 b,!
// cdb-check:b,! [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>::Some]
// cdb-check: [+0x000] __0 : 0x11 [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant : None (0x11) [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>::Discriminant$]

// cdb-command: dx -r2 c,!
// cdb-check:c,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
// cdb-check: [+0x000] my_data : 0x11 [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant : Tag1 (0x11) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Discriminant$]

// cdb-command: dx -r2 d,!
// cdb-check:d,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
// cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant : 0x10 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Discriminant$]

// cdb-command: dx -r2 e,!
// cdb-check:e,! [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Data]
// cdb-check: [+0x000] my_data : 0x13 [Type: msvc_pretty_enums::CStyleEnum]
// cdb-check: [+0x000] discriminant : Tag2 (0x13) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>::Discriminant$]

// cdb-command: dx -r2 f,!
// cdb-check:f,! [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>::Some]
// cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *]
// cdb-check: [+0x000] discriminant : 0x[...] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>::Discriminant$]

// cdb-command: dx -r2 g,!
// cdb-check:g,! [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>::Some]
// cdb-check: [+0x000] __0 : 0x0 [Type: unsigned int *]
// cdb-check: [+0x000] discriminant : None (0x0) [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>::Discriminant$]

// cdb-command: dx -r2 h,!
// cdb-check:h,! : Some [Type: enum$<core::option::Option<u32> >]
// cdb-check: [+0x000] variant0 [Type: enum$<core::option::Option<u32> >::None]
// cdb-check: [+0x000] variant1 [Type: enum$<core::option::Option<u32> >::Some]
// cdb-check: [+0x004] __0 : 0xc [Type: unsigned int]
// cdb-check: [+0x000] discriminant : Some (0x1) [Type: core::option::Option]
// cdb-command: dx a
// cdb-check:a : Some({...}) [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
// cdb-check: [variant] : Some
// cdb-check: [+0x000] __0 : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum]

// cdb-command: dx b
// cdb-check:b : None [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<enum$<msvc_pretty_enums::CStyleEnum> >, 2, 16, Some>]
// cdb-check: [variant] : None

// cdb-command: dx c
// cdb-check:c : Tag1 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [variant] : Tag1

// cdb-command: dx d
// cdb-check:d : Data({...}) [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [variant] : Data
// cdb-check: [+0x000] my_data : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]

// cdb-command: dx e
// cdb-check:e : Tag2 [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [<Raw View>] [Type: enum$<msvc_pretty_enums::NicheLayoutEnum, 2, 16, Data>]
// cdb-check: [variant] : Tag2

// cdb-command: dx f
// cdb-check:f : Some({...}) [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
// cdb-check: [variant] : Some
// cdb-check: [+0x000] __0 : 0x[...] : 0x1 [Type: unsigned int *]

// cdb-command: dx g
// cdb-check:g : None [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<ref$<u32> >, 1, [...], Some>]
// cdb-check: [variant] : None

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

// cdb-command: dx -r2 i,!
// cdb-check:i,! : None [Type: enum$<core::option::Option<u32> >]
// cdb-check: [+0x000] variant0 [Type: enum$<core::option::Option<u32> >::None]
// cdb-check: [+0x000] variant1 [Type: enum$<core::option::Option<u32> >::Some]
// cdb-check: [+0x004] __0 : 0x[...] [Type: unsigned int]
// cdb-check: [+0x000] discriminant : None (0x0) [Type: core::option::Option]

// cdb-command: dx i
// cdb-check:i : None [Type: enum$<core::option::Option<u32> >]
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<u32> >]
Expand All @@ -84,16 +55,17 @@
// cdb-command: dx j
// cdb-check:j : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]

// cdb-command: dx -r2 k,!
// cdb-check:k,! [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
// cdb-check: [+0x000] dataful_variant [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>::Some]
// cdb-check: [+0x000] __0 [Type: alloc::string::String]
// cdb-check: [+0x000] discriminant : 0x[...] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>::Discriminant$]

// cdb-command: dx -r2 l,!
// cdb-check:l,! : $T2 [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
// cdb-check: [+0x000] Ok [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>::Ok]
// cdb-check: [+0x000] __0 : 0x2a [Type: unsigned int]
// cdb-command: dx k
// cdb-check:k : Some({...}) [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
// cdb-check: [<Raw View>] [Type: enum$<core::option::Option<alloc::string::String>, 1, [...], Some>]
// cdb-check: [variant] : Some
// cdb-check: [+0x000] __0 : "IAMA optional string!" [Type: alloc::string::String]

// cdb-command: dx l
// cdb-check:l : Ok [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
// cdb-check: [<Raw View>] [Type: enum$<core::result::Result<u32,enum$<msvc_pretty_enums::Empty> >, Ok>]
// cdb-check: [variant] : Ok
// cdb-check: [+0x000] __0 : 0x2a [Type: unsigned int]

pub enum CStyleEnum {
Low = 2,
Expand Down
16 changes: 8 additions & 8 deletions src/test/debuginfo/pretty-std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
// min-lldb-version: 310
// min-cdb-version: 10.0.18317.1001

// This started failing recently. See https://github.com/rust-lang/rust/issues/88796
// FIXME: fix and unignore this
// ignore-windows

// === GDB TESTS ===================================================================================

// gdb-command: run
Expand Down Expand Up @@ -115,9 +111,11 @@
// cdb-check: [11] : 33 '!' [Type: char]

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

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

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

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