-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
test\debuginfo\pretty-std-collections-hash.rs
fails with Visual Studio 2017 toolchain
#76352
Comments
I've seen similar errors if debug information for
It's worth noting that 1.46.0 already integrated my
Test Codefn main() {
let mut hmap = std::collections::HashMap::<u64, u64>::new();
hmap.insert(1, 2);
zzz(); // breakpointing here
println!("Hello, world! {:?}", hmap);
}
#[no_mangle] extern "C" fn zzz() {} Versions
Debugging
.vscode/launch.json{
"version": "0.2.0",
"configurations": [
{
"name": "Debug",
"type": "cppvsdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/target/debug/htd.exe",
"enableDebugHeap": true,
"preLaunchTask": "cargo build",
"internalConsoleOptions": "openOnSessionStart",
},
]
} .vscode/tasks.json{
"version": "2.0.0",
"problemMatcher": "$rustc",
"type": "shell",
"tasks": [
{
"label": "cargo build",
"command": "cargo +nightly build",
"group": { "kind": "build", "isDefault": true }
},
]
} nightly + cdb logs
|
Okay, so, I believe there's two separate issues here: static_cast was never legal, but worked when compiled with 1.46.0 - inside a natvis - for... reasons?Your C-casts fix this for both VSC and VS, as would reinterpret_cast. They also work in my version of CDB. Feel free to submit a PR with those natvis changes - or I can do so if it's inconvenient for you (I already have a fork/checkouts).
I'm slowly going mad trying to understand why this ever worked, or what changed. whatever cdb version you're using may not be able to handle C++ at allCDB not liking it even with C-casts would make sense if CDB can't handle C++ types at all - types or casts (in which case it'd be pointless to wait to try and fix those casts for CDB too, as they'll never work for tuples with that version of CDB.) I'd love to know your cdb version/path/source to see if I can replicate this / test introducing a min-cdb-version. I believe I sourced mine from the Windows 10 SDK. EDIT: Although, then how the heck does it get as far as trying to resolve tuple specifically? Hmm... |
@MaulingMonkey Expand
|
Okay, things have clicked into place - the way I was overriding the stdlib natvis files worked in VS/VSC but not in CDB like I thought they were. And while 1.46.0 had my tuple changes (which worked), it did not have the natvis/hashbrown changes using 'em. VS/VSC have never liked static_cast when reinterpret_cast is required, and CDB before 10.0.18362.1 doesn't like the tuple casts at all (but at/after that version, CDB doesn't care what kind of cast is used at all.) Rust changes to make:
And the testing I did:
|
@MaulingMonkey |
And thank you, @petrochenkov, for bringing this breakage to my attention - so it can get fixed before it lands in stable! PRs should address everything (famous last words 🤞) |
…=petrochenkov debuginfo: Ignore HashMap .natvis tests before cdb 10.0.18362.1 CDB <10.0.18362.1 chokes on casts within HashMap's natvis visualizers. This PR adds support for "min-cdb-version" (per existing "min-gdb-version" and "min-lldb-version" filters) and uses it. CI uses a more recent version of CDB for testing and thus should still run the tests. Credit to @petrochenkov per rust-lang#76352 for helping catch this. ### SDK Testing | Win 10 SDK | x64 CDB | rustc 1.47.0-nightly (bf43421 2020-08-25) built-in .natvis | Note | | --------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------- | ---- | | [10.0.19041.0](https://go.microsoft.com/fwlink/p/?linkid=2120843) | 10.0.19041.1 | ✔️ | CI | [10.0.18362.1](https://go.microsoft.com/fwlink/?linkid=2083338) | 10.0.18362.1 | ✔️ | MaulingMonkey | [10.0.17763.0](https://go.microsoft.com/fwlink/p/?LinkID=2033908) | 10.0.17763.132 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.17134.12](https://go.microsoft.com/fwlink/p/?linkid=870807) | 10.0.17134.12 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.16299.91](https://go.microsoft.com/fwlink/p/?linkid=864422) | 10.0.16299.91 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.15063.468](https://go.microsoft.com/fwlink/p/?LinkId=845298) | 10.0.15063.468 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.14393.795](https://go.microsoft.com/fwlink/p/?LinkId=838916) | 10.0.14321.1024 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | petrochenkov | [10.0.10586.212](https://go.microsoft.com/fwlink/p/?LinkID=698771) | 10.0.10586.567 | ❌ `Expected ')' at '+ 1)].__1'` | [10.0.10240](https://go.microsoft.com/fwlink/p/?LinkId=619296) | 10.0.10240? | ❔ Untested ### Rust Testing ```cmd x.py test --stage 1 src/tools/tidy x.py test --stage 1 --build x86_64-pc-windows-msvc src\test\debuginfo ``` Also verified test still fails when intentionally broken w/ CDB version >= min-cdb-version.
…etrochenkov debuginfo: Ignore HashMap .natvis tests before cdb 10.0.18362.1 CDB <10.0.18362.1 chokes on casts within HashMap's natvis visualizers. This PR adds support for "min-cdb-version" (per existing "min-gdb-version" and "min-lldb-version" filters) and uses it. CI uses a more recent version of CDB for testing and thus should still run the tests. Credit to @petrochenkov per rust-lang#76352 for helping catch this. ### SDK Testing | Win 10 SDK | x64 CDB | rustc 1.47.0-nightly (bf43421 2020-08-25) built-in .natvis | Note | | --------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------- | ---- | | [10.0.19041.0](https://go.microsoft.com/fwlink/p/?linkid=2120843) | 10.0.19041.1 | ✔️ | CI | [10.0.18362.1](https://go.microsoft.com/fwlink/?linkid=2083338) | 10.0.18362.1 | ✔️ | MaulingMonkey | [10.0.17763.0](https://go.microsoft.com/fwlink/p/?LinkID=2033908) | 10.0.17763.132 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.17134.12](https://go.microsoft.com/fwlink/p/?linkid=870807) | 10.0.17134.12 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.16299.91](https://go.microsoft.com/fwlink/p/?linkid=864422) | 10.0.16299.91 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.15063.468](https://go.microsoft.com/fwlink/p/?LinkId=845298) | 10.0.15063.468 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | [10.0.14393.795](https://go.microsoft.com/fwlink/p/?LinkId=838916) | 10.0.14321.1024 | ❌ `Unable to find type 'tuple<u64,u64> *' for cast.` | petrochenkov | [10.0.10586.212](https://go.microsoft.com/fwlink/p/?LinkID=698771) | 10.0.10586.567 | ❌ `Expected ')' at '+ 1)].__1'` | [10.0.10240](https://go.microsoft.com/fwlink/p/?LinkId=619296) | 10.0.10240? | ❔ Untested ### Rust Testing ```cmd x.py test --stage 1 src/tools/tidy x.py test --stage 1 --build x86_64-pc-windows-msvc src\test\debuginfo ``` Also verified test still fails when intentionally broken w/ CDB version >= min-cdb-version.
…, r=petrochenkov Fix HashMap visualizers in Visual Studio (Code) CDB (as used in unit tests) doesn't care that we're using static_cast between unrelated types (`u8*` to `tuple<$T1, $T2>*`). Visual Studio & Visual Studio Code care. These should've been reinterpret_cast or C casts. Credit to @petrochenkov per rust-lang#76352 for helping catch this. ### Testing ```cmd x.py test --stage 1 src/tools/tidy x.py test --stage 1 --build x86_64-pc-windows-msvc src\test\debuginfo ```
…, r=petrochenkov Fix HashMap visualizers in Visual Studio (Code) CDB (as used in unit tests) doesn't care that we're using static_cast between unrelated types (`u8*` to `tuple<$T1, $T2>*`). Visual Studio & Visual Studio Code care. These should've been reinterpret_cast or C casts. Credit to @petrochenkov per rust-lang#76352 for helping catch this. ### Testing ```cmd x.py test --stage 1 src/tools/tidy x.py test --stage 1 --build x86_64-pc-windows-msvc src\test\debuginfo ```
These two lines in
src\etc\natvis\libstd.natvis
confuse bothcdb
and GUI debugger available inside VS:cdb
gives this errorGUI debugger just skips the visualization and only shows raw representation.
It is possible to fix visualization inside VS GUI debugger by replacing
static_cast
with C-style casts, but I haven't found a way to make
cdb
eat this yet.Tests for other debuggers can use requirement directives like
If
cdb
from VS2017 toolchain is unable to perform computations required for visualizing hash set/map, then we need to introduce such requirements forcdb
as well.cc @Amanieu @MaulingMonkey
The text was updated successfully, but these errors were encountered: