1

I got a minidump from a server on which my native c++ app was running. I also have the exe and pdb files. I am able to open the minidump using Visual Studio 2005 Pro and it correctly loads the symbols from the pdb file.

I run the debugger (F5) and it shows me that it crashed. When I click on the stack trace to see where, it tells me that it can't find the source code "There is no source code available for the current location.".

How do I tell Visual Studio where the source code is?

My exe is an optimized release build that I build with a pdb file.

curlingdude
  • 369
  • 3
  • 8
  • If the crash occurs in a dll that doesn't have a pbd, you won't be able to debug it. The debugger will only show you the calls for which you have the symbols. – VoidStar Aug 10 '12 at 17:16
  • Yes, I have the symbols and I have all the pdb files I need. I'm just trying to see the source code (which I also have). – curlingdude Aug 10 '12 at 17:37
  • There is a good chance that your app crashes in a Windows DLL... – Mihai Todor Aug 10 '12 at 17:45
  • It did crash in a Windows DLL. That's fine. I just want to see the code for methods up the stack trace that are in my code. – curlingdude Aug 10 '12 at 17:53
  • Then double-click a location in the stack trace that is your code. – Hans Passant Aug 10 '12 at 18:11
  • You can also use a symbol server to download the public Microsoft PDB files so you have a better idea of where it crashed: http://msdn.microsoft.com/en-us/library/windows/desktop/ms680693%28v=vs.85%29.aspx If you might need to debug different versions of your app it helps to store those symbols as well and then you just need the minidump and all the symbol handling is automatic. – Retired Ninja Aug 10 '12 at 18:14
  • When I double-click in the stack it tells me "There is no source code available for the current location." The question is how do I get it to show the source code instead. – curlingdude Aug 10 '12 at 18:26

1 Answers1

2

From this MSDN page:

In the Solution Property Pages, you can change the directories where the debugger looks for sources files and tell the debugger to ignore selected source files. See Debug Source Files, Common Properties, Solution Property Pages Dialog Box.

Make sure you supply VS with the sources that correspond to the binaries and PDB files.

Normally, VS should ask you where the sources are when first double-clicking a stack frame. I ran into a problem where VS would pop up the There is no source code available for the current location. dialog when clicking on some stack frames only, but display the source for others. This turned out to be because the /Zi flag was not set for some projects, causing the link back to the source files to be missing. This flag can be set in Project Propery Pages > C/C++ > General > Debug Information Format.

Brecht Machiels
  • 3,181
  • 3
  • 25
  • 38
  • I spent a significant amount of time trying to solve this problem because my debug information was set to /Zl (Program Database for edit and continue). Thankfully after reading your post I changed it to /Zi and now I can debug linked libraries. Thanks! – Yonatan Simson Jan 24 '16 at 08:57