You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recently, I started playing with the new VS 2017 Community edition. Specifically, I wanted to see if Rust debugging works with VS. Good news: out of the box, you can attach to running Rust applications compiled in debug mode, pause them, and begin debugging.
The experience isn't perfect, and I hope to grow this issue to include the places where the experience can be improved.
@Boddlnagg - I noticed that only works if you have patched s8 support? I tried just copying/pasting your example with out and wasn't able to get it to work.
I also noticed that #39843 is related to the natvis work.
@jonathandturner I did not patch s8 support (I don't even know what you mean by that) ... but I had to manually work around #36646 by patching the type information in the PDB.
I'd also like to point out that #36503 (comment) explains the ability to embed natvis files into PDBs (maybe rustc could do that automatically at some point).
rustc/cargo don't copy the .pdb file to the directory of the executable automatically anymore, is that a decision/design of rustc/cargo? IIRC rustc 1.13 will copy the .pdb file.
@retep998 So if the debugger failed to load the .pdb files automatically, does that means there is a bug in the debugger?
Here is the log when I try to debug my new project with x64dbg:
SYMSRV: C:\Users\admin\Documents\x64dbg\x64\symbols\vs2017detect-18f12543191b1f33.pdb\98880B4BE9AF44E5A205282AEBB1C814d\vs2017detect-18f12543191b1f33.pdb not found
DBGHELP: C:\Users\admin\Documents\vs2017detect\target\debug\vs2017detect-18f12543191b1f33.pdb - file not found
...(unrelated part eliminated)
After failed loading from the symbol cache, x64dbg just tries to load the file from the working directory of the executable. And the DBGHELP part made me believe that x64dbg is using some windows system library to do this. Is there a bug in the debugger, or this behavior is just what windows will do?
@mzji I think VS loads the PDB, but in VS Code I had to change the launch configuration to run the executable from the deps folder (with the PDB next to it). I would have expected WinDbg to behave just like VS does, though.
@lnicola Then I think we should at least leave a copy in the directory of binaries, since different debuggers do different things (VS will find and load pdb files automatically, VS Code/Ollydbg/x64dbg and all debuggers which is only using DBGHELP won't).
I have a hacky changelist I'm working on to enable visualization of &str and array slices (via renaming debug info), and to auto-embed .natvis files into the resulting pdbs for maximum convenience.
@MaulingMonkey's PR brought visualization quite a long way but there's still a few shortcomings in the debugging experience as of the latest nightly:
Mutable slices need a separate visualizer entry, as their type name is mut slice<*>; I was able to fix this just by duplicating the visualizer entry for slice in intrinsic.natvis:
After discussion, we think its an anti-pattern to have an issue with an ever-growing list of features that will evolve, especially to match a debugger that is also growing new features over time. (If you want to see all the debugging issues on windows, you can use a github issue query for A-debuginfo and O-windows, or something along those lines.)
So, we think the main focus of this issue should be the four points that were raised in the description (and new issues should be filed to cover new goals).
As for the four points in the description, @wesleywiser says that the first three are fixed today, and believes the fourth to be fixed if you are using Visual Studio 2022.
Activity
Boddlnagg commentedon Mar 12, 2017
There was some previous work trying to use natvis: #36503
Notably, the following natvis code enables the VS "Text Visualizer" for strings, using the correct UTF-8 encoding (at least this worked in VS 2015):
sophiajt commentedon Mar 12, 2017
@Boddlnagg - I noticed that only works if you have patched s8 support? I tried just copying/pasting your example with out and wasn't able to get it to work.
I also noticed that #39843 is related to the natvis work.
Boddlnagg commentedon Mar 13, 2017
@jonathandturner I did not patch s8 support (I don't even know what you mean by that) ... but I had to manually work around #36646 by patching the type information in the PDB.
I'd also like to point out that #36503 (comment) explains the ability to embed natvis files into PDBs (maybe
rustccould do that automatically at some point).codec-abc commentedon Mar 13, 2017
I think that if it is possible, conditional breakpoints would be a nice addition.
mzji commentedon Mar 15, 2017
rustc/cargo don't copy the .pdb file to the directory of the executable automatically anymore, is that a decision/design of rustc/cargo? IIRC rustc 1.13 will copy the .pdb file.
retep998 commentedon Mar 15, 2017
@mzji The
.exeor.dllhas the absolute path to the.pdbhardcoded so the debugger can still find the.pdbeven if you moved the.exeor.dll.mzji commentedon Mar 15, 2017
@retep998 So if the debugger failed to load the .pdb files automatically, does that means there is a bug in the debugger?
Here is the log when I try to debug my new project with x64dbg:
After failed loading from the symbol cache, x64dbg just tries to load the file from the working directory of the executable. And the
DBGHELPpart made me believe that x64dbg is using some windows system library to do this. Is there a bug in the debugger, or this behavior is just what windows will do?lnicola commentedon Mar 15, 2017
@mzji I think VS loads the PDB, but in VS Code I had to change the launch configuration to run the executable from the
depsfolder (with the PDB next to it). I would have expected WinDbg to behave just like VS does, though.mzji commentedon Mar 15, 2017
@lnicola Then I think we should at least leave a copy in the directory of binaries, since different debuggers do different things (VS will find and load pdb files automatically, VS Code/Ollydbg/x64dbg and all debuggers which is only using
DBGHELPwon't).codec-abc commentedon Mar 15, 2017
Back to the original issues, the most 2 annoying things that happen when I try to debug Servo is that:
sophiajt commentedon Mar 15, 2017
@codec-abc - by chance, have you tried using the natvis from this PR to see if it helps with your second bullet point? #39843
I've been chatting with the author and would like to potentially make it part of the pdb at some point.
codec-abc commentedon Mar 15, 2017
I used the one in the opening message of the issue. So they are probably different.
Edit : Damned the "good" one was just a few characters away. How stupid I am.
sophiajt commentedon Mar 15, 2017
@codec-abc - yeah, the one in the PR is much better than mine, with support for more common Rust std lib structures.
MaulingMonkey commentedon Jul 13, 2017
Auto merge of #43221 - MaulingMonkey:natvis-improvements, r=michaelwo…
abonander commentedon Jun 13, 2019
@MaulingMonkey's PR brought visualization quite a long way but there's still a few shortcomings in the debugging experience as of the latest nightly:
mut slice<*>; I was able to fix this just by duplicating the visualizer entry forsliceinintrinsic.natvis:fn main()stack frame is shown at the wrong source line.(This is VS2017, but it's the same in VS2019.)
Auto merge of #66597 - MaulingMonkey:pr-natvis-std-collections-hash, …
rylev commentedon Feb 26, 2021
There has been progress on this issue from several fronts lately:
Some additional todos/issues:
charlocalspnkfelix commentedon Mar 18, 2022
Visiting for T-compiler backlog bonanza.
After discussion, we think its an anti-pattern to have an issue with an ever-growing list of features that will evolve, especially to match a debugger that is also growing new features over time. (If you want to see all the debugging issues on windows, you can use a github issue query for A-debuginfo and O-windows, or something along those lines.)
So, we think the main focus of this issue should be the four points that were raised in the description (and new issues should be filed to cover new goals).
As for the four points in the description, @wesleywiser says that the first three are fixed today, and believes the fourth to be fixed if you are using Visual Studio 2022.
Closing.