<p>Are there any VC++ settings I should know about to generate better PDB files that contain more information? </p>

<p>I have a crash dump analysis system in place based on the project <a href="http://code.google.com/p/crashrpt/" rel="nofollow noreferrer">crashrpt</a>.</p>

<p>Also, my production build server has the source code installed on the D:\, but my development machine has the source code on the C:\.  I entered the source path in the VC++ settings, but when looking through the call stack of a crash, it doesn't automatically jump to my source code.  I believe if I had my dev machine's source code on the D:\ it would work. </p>

[{'answer_id': 36138, 'author': 'Matt Dillard', 'author_id': 863, 'author_profile': 'https://Stackoverflow.com/users/863', 'pm_score': 1, 'selected': False, 'text': '<p>You could trying using the MS-DOS <a href="http://www.computerhope.com/substhlp.htm" rel="nofollow noreferrer">subst</a> command to assign your source code directory to the D: drive.</p>\n'}, {'answer_id': 36178, 'author': 'Brian R. Bondy', 'author_id': 3153, 'author_profile': 'https://Stackoverflow.com/users/3153', 'pm_score': 0, 'selected': False, 'text': '<p>In case anyone is interested, a co-worker replied to this question to me via email:</p>\n\n<p>Artem wrote: </p>\n\n<blockquote>\n  <p>There is a flag to MiniDumpWriteDump()\n  that can do better crash dumps that\n  will allow seeing full program state,\n  with all global variables, etc. As for\n  call stacks, I doubt they can be\n  better because of optimizations...\n  unless you turn (maybe some)\n  optimizations off.</p>\n  \n  <p>Also, I think disabling inline\n  functions and whole program\n  optimization will help quite a lot.</p>\n  \n  <p>In fact, there are many dump types,\n  maybe you could choose one small\n  enough but still having more info\n  <a href="http://msdn.microsoft.com/en-us/library/ms680519(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms680519(VS.85).aspx</a></p>\n  \n  <p>Those types won\'t help with call stack\n  though, they only affect the amount of\n  variables you\'ll be able to see.</p>\n  \n  <p>I noticed some of those dump types\n  aren\'t supported in dbghelp.dll\n  version 5.1 that we use. We could\n  update it to the newest, 6.9 version\n  though, I\'ve just checked the EULA for\n  MS Debugging Tools -- the newest\n  dbghelp.dll is still ok to\n  redistribute.</p>\n</blockquote>\n'}, {'answer_id': 36188, 'author': 'Rob Walker', 'author_id': 3631, 'author_profile': 'https://Stackoverflow.com/users/3631', 'pm_score': 0, 'selected': False, 'text': "<p>Is Visual Studio prompting you for the path to the source file?  If it isn't then it doesn't think it has symbols for the callstack. Setting the source path should work without having to map the exact original location.</p>\n\n<p>You can tell if symbols are loaded by looking at the 'modules' window in Visual Studio.</p>\n\n<p>Assuming you are building a PDB then I don't think there are any options that control the amount of information in the PDB directly.  You can change the type of optimizations performed by the compiler to improve debuggabilty, but this will cost performance -- as your co-worker points out, disabling inline will help make things more obvious in the crash file, but will cost at runtime.</p>\n\n<p>Depending on the nature of your application I would recommend working with full dump files if you can, they are bigger, but give you all the information about the process ... and how often does it crash anyway :) </p>\n"}, {'answer_id': 36203, 'author': 'Brian R. Bondy', 'author_id': 3153, 'author_profile': 'https://Stackoverflow.com/users/3153', 'pm_score': 0, 'selected': False, 'text': "<blockquote>\n  <p>Is Visual Studio prompting you for the\n  path to the source file? </p>\n</blockquote>\n\n<p>No.</p>\n\n<blockquote>\n  <p>If it isn't then it doesn't think it has symbols\n  for the callstack. Setting the source\n  path should work without having to map\n  the exact original location.</p>\n</blockquote>\n\n<p>Symbols are loaded successfully.  It shows the callstack, but double clicking on an entry doesn't bring me to the source code.  I can of course search in files for the line in question, but this is hard work :)</p>\n"}, {'answer_id': 38474, 'author': 'Steve Steiner', 'author_id': 3892, 'author_profile': 'https://Stackoverflow.com/users/3892', 'pm_score': 4, 'selected': True, 'text': '<blockquote>\n  <p>"Are there any VC++ settings I should know about"</p>\n</blockquote>\n\n<p>Make sure you turn off Frame pointer ommision.  Larry osterman\'s blog has <a href="http://blogs.msdn.com/larryosterman/archive/2007/03/12/fpo.aspx" rel="noreferrer">the historical details</a> about fpo and the issues it causes with debugging.</p>\n\n<blockquote>\n  <p>Symbols are loaded successfully. It shows the callstack, but double clicking on an entry doesn\'t bring me to the source code.</p>\n</blockquote>\n\n<p>What version of VS are you using? (Or are you using Windbg?) ... in VS it should defintely prompt for source the first time if it doesn\'t find the location.  However it also keeps a list of source that was \'not found\' so it doesn\'t ask you for it every time.  Sometimes the don\'t look list is a pain ... to get the prompt back up you need to go to solution explorer/solution node/properties/debug properties and edit the file list in the lower pane.</p>\n\n<p>Finally you might be using \'stripped symbols\'.  These are pdb files generated to provide debug info for walking the callstack past FPO, but with source locations stripped out (along with other data).  The public symbols for windows OS components are stripped pdbs.  For your own code these simply cause pain and are not worth it unless you are providing your pdbs to externals. How would you have one of these horrible stripped pdbs?  You might have them if you use "binplace" with the -a command.</p>\n\n<p>Good luck! A proper mini dump story is a godsend for production debugging.</p>\n'}, {'answer_id': 215783, 'author': 'Bert Huijben', 'author_id': 2094, 'author_profile': 'https://Stackoverflow.com/users/2094', 'pm_score': 2, 'selected': False, 'text': '<p>If your build directly from your sourcecode management system, you should annotate your pdb files with the file origins. This allows you to automatically fetch the exact source files while debugging. (This is the same proces as used for retrieving the .Net framework sourcecode).</p>\n\n<p>See <a href="http://msdn.microsoft.com/en-us/magazine/cc163563.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163563.aspx</a> for more information. If you use subversion as your SCM you can check out the SourceServerSharp project.</p>\n'}, {'answer_id': 215856, 'author': 'Fabio Ceconello', 'author_id': 8999, 'author_profile': 'https://Stackoverflow.com/users/8999', 'pm_score': 1, 'selected': False, 'text': "<p>This is the procedure I used after some trouble similar to yours:</p>\n\n<p>a) Copied to the production server all the EXE &amp; DLL files that were built, each with its corresponding PDB to the same directory, started the system, and waited for the crash to happen.</p>\n\n<p>b) Copied back all the EXE, DLL &amp; PDB files to the development machine (to a temporary folder) along with the minidump (in the same folder). Used Visual Studio to load the minidump from that folder.</p>\n\n<p>Since VS found the source files where they were originally compiled, it was always able to identify them and load them correctly. As with you, in the production machine the drive used was not C:, but in the development machine it was.</p>\n\n<p>Two more tips:</p>\n\n<ul>\n<li><p>One thing I did often was to copy an EXE/DLL rebuilt and forget to copy the new PDB. This ruined the debug cycle, VS would not be able to show me the call stack.</p></li>\n<li><p>Sometimes, I got a call stack that didn't make sense in VS. After some headache, I discovered that windbg would always show me the correct stack, but VS often wouldn't. Don't know why.</p></li>\n</ul>\n"}]
['https://Stackoverflow.com/questions/36127', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3153/']