Debugging a managed dump with Visual Studio - 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.

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.

Why does Visual Studio ask for cs-files when debugging?

I have included a dll file into my project. I reference it from a library folder where also resides dll's pdb file. When I compile I see both dll and pdb copied to main project's bin folder. On small projects this works wonderfully and I can debug into the dll with no problems. Sometimes, however, in larger projects, VS keeps asking for specific cs files even though their pdb file is included in the projects bin folder. That's ok if I can find those cs files, but it's annoying.
Why is Visual Studio sometimes asking for cs files and sometimes not?
It tries its best given the information it has, but sometimes that information is incomplete. When its ready to give up, it gives you the opportunity to provide the file, just in case you know better.
PDBs generally store the path to the file, as it was when msbuild was invoked to build the DLL. If the paths have changed (e.g. you're on a different machine to where the DLL was built, or just that files on the file system have moved) then the path information doesn't do it much good.
There is a process called source indexing that can embed enough information into the PDBs so that visual studio can re-locate the source files in your source control system (so that you get exactly the correct file as it was at the time of the build) but this is usually an extra step that has to be performed to modify the PDBs after the build has occurred.
Try this (from MSDN Forum)
Tools -> Options -> Debugging -> Symbols -> Empty Symbol Cache (button)
then
Tools -> Options -> Debugging General-> Enable Just My Code (checkbox)
and start debugging again. This should solve the problem if it was initiated by accidental third party components debug symbols that doesn't contains sources but storye only file paths.

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/

Specify PDB path in Visual Studio 2003

In Visual Studio 2003, if I link with a library that doesn't have its corresponding PDB file, I get a warning:
foo.lib(bar.obj) : warning LNK4099: PDB 'other.pdb' was not found; linking object as if no debug info
If the PDBs are in their original build location VS can find them, as well as if they're in the current build directory, but that seems to be it. Is there a way I can tell Visual Studio exactly where it should look for PDBs? I have a vague notion that a symbol server might work, but that seems like a lot of overhead; I'm just looking for something like link.exe /pdbpath c:\pdbs_are_right_here that adds a path to search, like /I adds an include path. Alternately, are there other paths it searches besides the current directory and the original absolute path the PDB was written to?
I believe the path to the corresponding pdb's is embedded in the libraries themselves, and you can change it into c:\pdbs_are_right_here at the build switches for your libraries (assuming they are indeed yours and not 3rd party).
For DLL's that means project properties\linker\debugging\generate program database file.
For static libraries the default name is uniform in VS2013 ('vc120.pdb'), but I think this changed in VS2015 and have no idea about VS2003. Anyway if you're working in VS2013\2012\2010 you'd have to explicitly override the name too.

Breakpoint not hooked up when debugging in VS 2008 sp1

My project has a lot of static library (with sources).
Some base libraries can't be breakpointed because the source code is different from the original version.
I know I can workaround if I turn off "Require source files to exactly match the original version" option, but that warning makes me worry.
Is it Microsoft Visual Studio 2008 bug?
I heard it happen when checksum of source code is different with obj.
I have all sources of library and linked as static library,
I cleaned and rebuilt all, but warning never disappeared.
What a worse is, when I turn off "Require source files to exactly match the original version" option, watch windows can't show what member variable has with this error "FIX: CXX0033 Error in OMF Type from Forward Class Declaration"
http://support.microsoft.com/kb/131147/en-us?fr=1
I searched stack overflow and find several similar article (http://stackoverflow.com/questions/163133/breakpoint-not-hooked-up-when-debugging-in-vs-net-2005) but those couldn't help me.
Environment :
Windows 2003 server x64
Visual Studio 2008 sp1 Version 9.0.30729.1 SP
Thanks in advance.
Double check your symbols and sources search paths to ensure they include the right folders with the static library. Check that y7ou are linking the .lib and the .obj files from the right directory. Also, break in program under the debugger, and check where are the symbols for the library loaded from - they should be from the same folder the .obj and the .lib came from.

Resources