Visual Studio test host does not load debug information - c++

I am attempting to run a C++ unit test in Visual Studio 2008. While the test seems to run fine, when I attempt to debug it (after compiling in debug mode) I get the following message:
Debugging information for VSTestHost.exe cannot be found or does not match. Cannot find or open the PDB file.
This happens even if I open a completely new, empty unit test. The same happens in Visual Studio 2010 and 2012, with the test host being QTAgent32.exe and vstest.executionengine.x86.exe, respectively. If I inspect the test host process (VSTestHost.exe) using ProcessExplorer while the dialog appears, I see it is running in its own directory (Common7\IDE under the Visual Studio installation directory). Copying the PDB file there however does not help.
I stress again that this happens with a clean and empty test. How do I make the test host process load the test project's PDB file?

Turns out this message can be ignored. While the host process is indeed without debug information, the test project's PDB file should be loaded correctly, so that breakpoints in the test code will be hit.

Related

How to prevent visual studio 2019 from locking pdb files?

I have a DLL and an executable setup to allow for code hot reloading. The executable reloads the DLL when there are any changes to it. It works fine when using a standalone debugger such as windbg. I would like to be able to use the visual studio debugger the same way.
The problem is that if I attempt to rebuild the project, the linker is unable to write to the pdb files because visual studio has them locked. So I get the following error:
LINK : fatal error LNK1201: error writing to program database 'c:\Users\maxim\source\repos\transforms\x64\Debug\particles.pdb'; check for insufficient disk space, invalid path, or insufficient privilege
How can I prevent visual studio 2019 from locking the pdb files?

How to fix the "Cannot find or open the PDB file." in Visual Studio 2017

Every time I run a project in Visual Studio 2017, it loads all dll files. In the Debug output, I can see "Symbols loaded." after most of the dll files. But after the "msvcp140d.dll" and "ig4icd32.dll" files, it says "Cannot find or open the PDB file."
How can I fix this?
Can someone help???
How can I fix this?
There is nothing to "fix".
If you run your program in the Visual Studio debugger, it tries to probe for PDB files when DLLs are loaded at the startup of your program.
The message just states that the PDB files for some DLLs cannot be found and loaded.
Usually this will not be a problem since you don't need to debug msvcp140d.dll or similar system essentials.
For pdb missing, Clean Solution and perform Rebuild Solution from project menu.
For 'msvcp140d.dll file not found' ,check your project settings, choose toolkit14, debug mode and linker setting for dynamic link. Try to install MS redistributable c++ for 2015 x86 and x64.

Attaching Visual Studio 2012 to Matlab 2014a(32 bit): tbb.dll

I am encountering a strange problem.
1>I open visual studio 2012
2> I open matlab 2014a (32 bit)
3> I try "Attach to process" and put the matlab process from the list displayed in the process window that comes up.
What happens is I get window in visual studio saying
"Loading symbols for tbb.dll from:
z:\itt\branch_tbb40\tbb\1.0\build\fxeowin18vc10_32_release
Attempting to cancel will disable furhter symbol loading"
and hangs.
The issue is "z:\itt\branch_tbb40\tbb\1.0\build\fxeowin18vc10_32_release" does not exist in my computer. How come visual studio is trying to load from this folder ? where is it getting its information from.
Also the tbb.dll is in the "C:\Program Files (x86)\MATLAB\R2014a\bin\win32" folder which I have put in the path environment variable.
How come visual studio is not looking there.
It would be very kind if someone gives my some pointer to fix the issue.
Thanks in advance.
z:\itt\... is the path where the pdb was when the dll was originally built from source, possibly on a build server or so but definitely not on your machine so it's normal you don't have that directory.
When loading symbols for a dll, the debugger will also look for the original pdb path (which is stored in the dll) apart from considering various other paths. As far as I know the PATH is not used when looking for pdbs so don't bother adding directories to it for that reason. The directory where the dll is located is searched, but you probably don't notice because it flashes by quickly in VS. (note if you want to see all places where VS searches you could use procmon).
As to why VS hangs: no idea. But does it really hang 'forever' (as in not responding + corresponding dialog)? One possibility would be that z: is mapped as a network drive and VS is waiting for a response from it, which should timeout after a while.

Microsoft Visual Studio 2010 Cannot find or open the PDB file- McAfee

I am trying to debug my C++ program in Microsoft Visual Studio 2010- having just recompiled the code after making some changes, have run the program, and am now trying to attach to the process (Debug -> Attach To Process...).
However, when I do this, I am presented with an error that I've never seen before:
'AMSCDNUSimulatord.exe': Loaded 'C:\Program Files (x86)\McAfee\Host Intrusion Prevention\HcApi.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0x1c04) has exited with code 0 (0x0).
I haven't done anything differently to what I normally do (built the project, copied the 'AMSCDNUSimulatord.exe' (debug executable for my program) from the workspace to the release folder of the program- overwriting the existing .exe file), run the program, and attached to process from Visual Studio's Debug menu.
This usually works with no problems at all- but for some reason, I'm now getting the above error in Visual Studio's console... Anyone know anything about this?
I haven't changed any configuration of McAfee or anything, so can't think why it would be complaining about that.
I have tried checking the "Microsoft Symbol Servers under Symbol Locations" as suggested in answer to: Visual Studio 2010 "Cannot find or open the PDB file", but this doesn't seem to have made any difference.
With regard to the set up of my project, the source is in the folder C:\Workspace\Simulator, and that is where the .exe file is placed when the project is built. I am then running the release from C:\workspace\release\Simulator, so I copy the .exe from the first folder to the second once it's built, and run it from there. The thing is, that I've been following that method exactly for months, and never had any problems running the program and attaching to the process before, so I doubt that the issue is anything to do with the change to that I've made to the code... but how/ why would McAfee now be preventing me from attaching to the process?

Visual Studio 2008 C++ - Remote Debugging - "Could not load symbols" only for main project

I am observing a strange behaviour with Visual Studio 2008 when I try to debug an exe remotely.
I have a solution that includes multiple projects. Thereby, each project is compiled into a lib and linked into my main project (the project that starts when hitting the run button). Visual Studio is configured to generate a pdb file that is named exactly like my exe file. Additionally, VS generates a vc90.pdb file for each project.
Now, I can debug my exe locally when I start it from Visual Studio or when I attach Visual Studio to a locally running process of my exe. But when I run my exe on a different machine, VS shows a strange behaviour. In this case, Visual Studio correctly stops at the breakpoints in all projects except for the main project. For each breakpoint in the main project, VS says that it could not load the symbols for the document. However, the modules view shows that VS loaded the correct pdb file.
Does anyone have an idea what is different between a remotely debugged application and a locally attached debugger. Especially because the main project is the only one that causes a problem...
My environment:
Visual Studio 2008 SP1
Host machine: Windows 7 64-bit
Remote machine: Windows XP 32-bit
I figured out that I missed a setting for the main project that was done for all other projects. I had to set "Project -> Properties -> C/C++ -> General -> Debug Information Format" to "Program Database (/Zi)".