5

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?

Lex Li
  • 60,503
  • 9
  • 116
  • 147
Jarrett
  • 1,767
  • 25
  • 47
  • vc120.pdb doesn't look like your program pdb file. It should be program_name.pdb. – Alex F Oct 22 '13 at 06:18
  • I think you should describe you project settings in more detail. Also: There is a Linker option that specifies the name and path of the output PDB file - check that. – Martin Ba Oct 22 '13 at 06:59
  • @AlexFarber - the default PDB file generated in Visual Studio is generally `vc.pdb`. I always rename it to `$(ProjectName).pdb` as it reduces the likelihood of errors like this. – the_mandrill Oct 22 '13 at 08:31
  • To get more info about what's going wrong you could try the `!sym noisy` option in windbg as described here: http://stackoverflow.com/questions/2002285/windbg-display-symbol-server-paths-of-loaded-modules-even-if-the-symbols-did-n – the_mandrill Oct 22 '13 at 08:33
  • @the_mandrill: Visual Studio generates both `$(ProjectName).pdb` and `vc.pdb`. If `$(ProjectName).pdb` is not generated, something is wrong in the project settings. – Alex F Oct 22 '13 at 11:40
  • I've had a number of problems in the past that arose because *only* the `vc100.pdb` file was generated -- I guess it may depend on the history of your project (eg updated through VS2008, VS2010...) – the_mandrill Oct 22 '13 at 11:59
  • Ahhh...thanks for all the comments guys. I think the issue is a misconfigured SConstruct file - I added `/DEBUG` as a compiler flag, when I think it needs to be a linker flag...I'll try it out tonight. – Jarrett Oct 22 '13 at 16:38
  • That was it! Just added `/DEBUG` as a compiler flag and it worked! Thanks all! If someone wants to post the solution below, I will accept it. – Jarrett Oct 23 '13 at 03:43

1 Answers1

1

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.

Jarrett
  • 1,767
  • 25
  • 47