Windows Debugging Symbols - Not Loading - debugging

I am having Windows 7 x64 SP1. I have downloaded symbols from:
http://msdn.microsoft.com/en-us/windows/hardware/gg463028
I have downloaded and installed x64 RTM and x64 SP1 symbols for Windows 7 x64 SP1. Installed on T:\Symbols folder.
But When I debug a 64-bit native C++ application, the symbols would not load at all. For ntdll.dll, for instance, the PDBs are located in:
T:\Symbols\ntdll.pdb\6192BFDB9F04442995FFCB0BE95172E12
T:\Symbols\ntdll.pdb\CFF40300FD804691B73E12CF2A150EE02
But Visual Studio (2008/2010) will not load symbols. While debugging, from Modules View, I select ntdll.dll and say Load Symbols From -> Symbol Path, the specify the ntdll.pdb. For both of mentioned paths, it will always say:
A matching symbol file was not found in this folder.
I have also added this folder (T:\Symbols) in Debugging -> Options, but it will still not load the symbols. While debugging, Load All Symbols button would be enabled, and clicking would not load the symbol either!
For 32-bit the PDB filename would be wntdll.pdb for ntdll.dll and would be stored in GUID-named folders in fashion mentioned above. But VS will not load symbols for 32-bit debugging either.
Quite interestingly (and frustratingly), when I select Load Symbols From -> Microsoft Symbols Server, it will download and load the symbols perfectly. It will download the symbols at following location (full path for ntdll):
\Users\...\AppData\Local\Temp\SymbolCache\ntdll.pdb\6192BFDB9F04442995FFCB0BE95172E12
Here you can see the GUID is matching with the GUID-named folder in T:\Symbols path, but for manually installed symbols VS is rigid not to load it!
For NTDLL.PDB, despite the respective folder being same, and the size of PDB also being same, the timestamp might be different.
Sometimes VS would also place symbols in:
C:\...\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols
If VS would download correct symbols ONLY from Microsoft Symbols Server, then what the use of locally downloaded symbols?
My question is basically how to load locally downloaded and installed symbols?

The download links for the RTM or SP1 symbols are pretty much useless. After each patch day you will get a changed ntdll.dll or other central OS libraries. This will render your "old" pdbs useless. You need to download them therefore from the symbol servers to be sure that you are up to date.
But since not all dlls are changed you should set your Symbol server download cache to the same location where you have unpackaged your downloaded symbols.
Go to:
Tools - Options - Debugging - Symbols
and set the path for Cache symbols in this directory.
Load all symbols means that you do load all symbols for all modules that are loaded in your current process. But it will not dowload all symbols for all dlls that are used by Windows. If you do download Windbg you get a tool called symchk.exe which allows you to download the symbols for all binaries recursively.

Related

Visual Studio CPU profiler can't load symbols when copied to a different machine

So I made a profiling using Visual Studio 2022 CPU profiler on one machine. Then I copied the resulting .diagsession file to the local copy of the same project on another machine. But when I try to look at the methods it says Symbols failed to load for <myproject_name>.dll. Failed to find symbol file <myproject_name>.pdb.
I tried to include the bin folder (where both the .dll and .pdb files are located) of this project in the Options > Debugging > Symbols settings, but it does not work. Apparently, VS tries to load the symbols from the Microsoft symbol server and does not look in this folder.
What can I do to make the Profiler load the correct symbols for my project? Maybe I can see more detailed description of the proccess of loading the symbols somewhere (e.g. exact name of the folders that the Profiler is looking into) because information in the Output is not very elaborate?
P.S. Symbol loading on the first machine, where the profiling was initially made, is working fine.

How can I debug external code in Visual Studio 2019 when there is no PDB available?

I am trying to debug some issues occurring within an external library (ClosedXML). If I can work out exactly what's going wrong, I should be able to apply workarounds to the code that calls it.
I have added ClosedXML and manage it via NuGet.
Unfortunately, the debugger states that ClosedXML.PDB cannot be loaded. The checkboxes for 'Microsoft Symbol Servers' and 'NuGet.org Symbol Server' are both checked.
A suggestion was to generate my own pdb file. So, I cloned the ClosedXML repo, checked out the 0.95.4 commit (the version of the NuGet package I'm using) and built the project in Debug mode. I then directly referenced the pdbs produced in the ClosedXML binaries folder in the 'No Symbols Loaded' page in Visual Studio. Unfortunately, none of them work. They each have the same error message:
...\source\repos\ClosedXML\ClosedXML\bin\Debug\net46\ClosedXML.pdb: PDB does not match image.
...\source\repos\ClosedXML\ClosedXML\bin\Debug\net40\ClosedXML.pdb: PDB does not match image.
...\source\repos\ClosedXML\ClosedXML\bin\Debug\netstandard2.0\ClosedXML.pdb: PDB does not match image.
This isn't surprising as the DLL and the PDB weren't built on the same machine, but it is unfortunate.
So, my current workaround is to dereference the NuGet package and instead reference the DLL I've built locally. This works, but it is far from ideal.
To confirm, 'Just My Code' is disabled.
Is there any way I can debug the external code without resorting to changing references each time?
You can use my Runtime Flow tool to investigate called methods and parameters in ClosedXML without .pdb.

Debugging a managed dump with Visual Studio

Situation:
We create full dumps with WER and then they are sent to us thru automated systems. We have the pdbs and we can have the executable files as well.
If we don't put the pdbs together with the binary files Visual Studio does not show correct stack trace information. We were planing to use a Symbol Server so the symbols won't go with the binaries.
Question:
How can I tell Visual Studio where it should look for the binaries?
The reason why you need the binary executables is that the binaries contain the path to the PDBs. Using the path stored in the executable is unreliable, since the executable might e.g. be built on a build server that has different paths.
Instead, set up the symbol path in Visual Studio by going to Debug | Options and Settings ... | Debugging | Symbols and add the folder of your symbols or the location of your symbol server.

VS2010: "No matching binary found" when trying to load symbols for crashdump

For test purposes, I am debugging a minidump(created with .dump /ma) in Visual Studio 2010.
I have symbols available for that dump, but do not have the current binary (it is an executable).
The Module window in VS2010 shows 'No matching binary found' which seems right, since it cannot be found on the path where it was on the target machine.
I still would like to load the symbols, so I right-click the module, select "Load symbols from symbolpath" (which contains a path to the correct pdb), but a dialog pops up which asks me to select the binary file. I am unable to load the symbols for my module.
Why does VS need the image file? WinDbg is able to load the symbol file and show me the faulting stack without a problem.
I think it is by design. Visual Studio is designed and developed by a team while WinDbg is by another,
http://msdn.microsoft.com/en-us/library/htzy3t6f.aspx
If you load a minidump file that was saved with a heap, Visual Studiocan load the symbols even if the application binary is not found. Minidump files without heaps need the binaries to load symbols.
If you want Visual Studio to be the same as WinDbg, you should go to Microsoft Connect and create a feature request,
http://connect.microsoft.com/intro/

Why might the Visual Studio 2005 debugger fail to retrieve symbols for Windows 7 x64 from the Microsoft symbol server or my local cache?

I have just been issued with a Windows 7 (64 bit) machine at my code shop. We run Visual Studio 2005. I filled out the Tools|Options|Debugging|Symbols panel, pointing to the Microsoft Symbol Server and caching to C:\windows\symbols, and started a new instance of our app. There was a pause as the MS symbol server was contacted, then the EULA turned up and I accepted, but then no symbols loaded. This is a pretty big problem as much of what's going wrong in my department is down to memory management which requires the OS symbols.
All the local symbols for the app loaded fine, as well as (apparently) MFC80U.i386.pdb. When I examined the Symbol Load Information for ntdll.dll this greeted me:
C:\Windows\System32\wntdll.pdb: Cannot find or open the PDB file.
C:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\wntdll.pdb: Cannot find or open the PDB file.
C:\Windows\symbols\dll\wntdll.pdb: Cannot find or open the PDB file.
C:\Windows\dll\wntdll.pdb: Cannot find or open the PDB file.
C:\Windows\wntdll.pdb: Cannot find or open the PDB file.
I have also downloaded and installed the Windows 7 RTM symbol packages (to C:\Windows\Symbols), both x86 and x64 just to be sure. Still no luck. The x64 ntdll.pdb file lives in C:\Windows\Symbols\ntdll.pdb\CFF40300FD804691B73E12CF2A150EE02 and is NOT called wntdll.pdb as the Symbol Load Information seems to request.
Is it the case that Windows 7 symbols just don't like VS2005?
Try using another directory that you have complete control over, say C:\Symbols.

Resources