Visual Studio 2017 - how to point debug symbols for diagsession generated on the other machine - visual-studio-2017

I use Visual Studio 2017. I open diagsession file generated on other machine. Output window shows that symbols have not been loaded, for example:
Symbols failed to load for C:\Workspace\App\libA.dll. Cannot find or open the PDB file.
I have built appropriate libs. The libs have been build from the same source code as on the other machine. Then I have set a path to the pdb files: Debug/Options/Symbols/Symbol file (.pdb) locations. It doesn't help. I have also copied libs and pdbs to the some location as mentioned in the output output window, i.e. Symbols failed to load for... but it also doesn't work. Am I doing something wrong ? How to point symbols for diagsession generated on the other machine ?

Related

Attaching .pdb to a compiled .exe in Visual Studio 2022

I am trying to debug a .exe file with a .pdb. The project is using SCons, and here is the part where it compiles in sconstruct:
env.Append( CCFLAGS=["/EHsc"])
env.Append( CCFLAGS=["/DEBUG", "/Zi", "/Fdgame.pdb"])
env.Program('game', ['game.cpp', Glob('feather/*.cpp')], LIBS=['SDL2', 'SDL2_image', 'SDL2_ttf', 'SDL2_mixer', 'SDL2main'], LIBPATH='lib/Windows/lib')
So I'm adding the flags that are correct (I think) to generate the .pdb. The pdb shows up in my project directory, in the same location where the .exe is. After looking at its contents, I'm pretty sure that it has the correct information to work (at least, it is not empty). I am setting game.exe as the startup item, then running it from VS 2022. However, after running the .exe, Visual Studio claims that the "Binary was not built with debug information."
Modules tab showing this message under "Symbol Status."
According this page on the Microsoft VS documentation, it says:
The debugger searches for symbol files in the following locations:
The project folder.
The location that is specified inside the DLL or the executable (.exe) file. By default, if you have built a DLL or an .exe file on
your computer, the linker places the full path and filename of the
associated .pdb file in the DLL or .exe file. The debugger checks to
see if the symbol file exists in that location.
The same folder as the DLL or .exe file.
My .pdb should fulfill conditions 1 and 3, so I'm confused as to why it can't be found (if that's the issue). The docs do mention that this applies when you build a project, but I've seen other video tutorials online where they just attach .pdbs to running processes and it still works. Is there anything I'm missing?
Try changing to
env.Append( CCFLAGS=["/EHsc"])
env.Append( CCFLAGS=["/DEBUG", "/Zi"])
env.Program('game',
['game.cpp', Glob('feather/*.cpp')],
LIBS=['SDL2', 'SDL2_image', 'SDL2_ttf', 'SDL2_mixer', 'SDL2main'],
LIBPATH='lib/Windows/lib', PDB="game.pdb")
If that's still not in the correct location then change to
PDB="${TARGET.dir}/game.pdb"
See the manpage for info on the PDB environment variable:
https://scons.org/doc/production/HTML/scons-man.html#cv-PDB

VS2015 "no symbols loaded for this document" for .lib file

I have an issue where I have a .dll file that is compiled in debug. It statically links with a .lib file, which is also compiled in debug. The source is available for all of them. However when I run the .dll and attach VS to the process it can only step through the .dll's own function but not the ones in the .lib.
In the module view I can see that symbols are loaded for all the modules. How can ensure that .lib has symbols associated with it as well? As I understand because it is linked statically the symbols for it should be generated when compiling the "parent" .dll, is that correct? So is there something I need to do when building the .dll to make sure that ALL functions can be stepped through?
You need to add the location of the pdb file of the LIB you just built for the debugger to find the symbols in the appropriate Tools/Options section (usually the same directory as the output LIB).
Then, you can add the location of the source files in the according Solution Property page :
Then, Visual Studio debugger will find all appropriate information. It will load symbols and be able to jump into the LIB source code when appropriate.

windbg and VS can't find my pdb file

I have a project I have built using SCons and the MS VS 2013 (express) compiler (compiled from the command line).
It compiles and runs, however, it is crashing periodically, and so I want to debug it.
I added the following flags:
/Zi # Debug symbols
/DEBUG # Debug symbols
/FS # Concurrent debug database file access
After building, I see a pdb file generated called vc120.pdb. My executable is located in a build folder, and the pdb file is in the main project directory.
However, when I try to attach my executable for debugging via VS2013 or WinDbg, I always get an error that the debug symbols could not be found.
I added the 'path' to the pdb file in both VS2013 and WinDbg, but I get the same result. I also tried copying the pdb file into the build directory (to make it beside my executable), but no dice. I even changed the name of the pdb file to match the name of my executable, but that didn't work either.
Is there something I am missing here?
Thanks to the comments above, I discovered the issue was a misconfigured SCons file.
I added /DEBUG as a linker flag, instead of a compiler flag, and it worked.

Can't load libcef symbols in Visual Studio 2010

I'm working with libcef right now, and I can't get the .pdb file to load while I'm debugging.
I'm using the version 3.1180.719 precompiled binary from here: http://code.google.com/p/chromiumembedded/downloads/detail?name=cef_binary_3.1180.719_windows.zip&can=2&q=
And I'm trying to load the 3.1180.719 symbols from the .pdb file I downloaded from here: http://www.magpcss.net/cef_symbols/
When I hit a breakpoint with some libcef calls in the stack I try to load symbols from this .pdb file (kept in the same directory as libcef.dll and libcef.lib, different directory from my project). It says "A matching symbol file was not found in this folder".
The .pdb file only works with Release versions of CEF. I was trying to use it on the debug .dll.
You can find the Debug CEF symbols (.pdb files) here: http://www.magpcss.net/cef_symbols/

VS2010 C++ does not include paths to .pdb is my compiled .dlls according to dumpbin

Visual Studio compiles the projects into dlls as I want it to, but when I inspect these dlls with dumpbin, then they do not have an entry for their pdbs, which is probably the reason why I cannot debug any of those dlls if I load them at runtime and their pdbs are never loaded. How can I get VS to write these paths?
Visual Studio, C++.
Edit:
C++/General/Debug Information format ist set to "Program Database (/Zi)" and Linker/Debugging/Generate Debug Info are on "Yes (/DEBUG)", which I believe are correct.
If dumpbin /headers shows no entry in the Debug Directories, it is probably because you did not enable debug information generation at compile and link time. You should check the C++/General/Debug Information format and the Linker/Debugging/Generate Debug Info options.
If these options are set, you may check if the dll and the pdb in the output directory of Visual match. With the Debugging Tools for Windows, you can use the command symchk /v yourdll /s folder_containing_pdb to verify if the pdb can be found by the debugger engine. It will check if the dll does not contain debug information, in which case you are missing an option in Visual Studio, or if the pdb file is not complete.
You can also use Windbg with the command !sym noisy. See here for detailed instructions.
The pdbs aren't referenced in the dll, they get searched by Visual Studio. If they are in the same directory, it should find them.
You can direct Visual Studio on where to look for your symbols per this article. In summary:
Click Symbol File Path on the File
menu to display, set, or append to the
symbol path.
A more comprehensive overview of how symbols get used is here.
There should be info in the Output window on what happened when your DLL got loaded. Perhaps it's not the version you expected?