Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual C++ 2008 'Release' build contains debug information

I've noticed that when generating a new C++ project using MS Visual Studio 2008, the Release build contains debugging symbols - specifically the following settings are enabled:

  • The C++/General/Debug Information Format is set to Program Database.
  • The Linker/Debugging/Generate Debug Info setting is set to Yes.

I have never noticed this on earlier releases of Visual Studio.

So, other than generating a larger EXE file, is there any downside to leaving these settings enabled?

like image 207
Rob Avatar asked Oct 20 '08 12:10

Rob


People also ask

Can you debug a Release build?

You can now debug your release build application. To find a problem, step through the code (or use Just-In-Time debugging) until you find where the failure occurs, and then determine the incorrect parameters or code.

What is the difference between a debug build and a Release build?

Release vs Debug and it depends on what language you are using, Debug includes debugging information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled. They each define different symbols that can be checked in your program, but they are language-specific macros.

What is difference between debug and Release in Visual Studio?

Visual Studio projects have separate release and debug configurations for your program. You build the debug version for debugging and the release version for the final release distribution. In debug configuration, your program compiles with full symbolic debug information and no optimization.

What are debug and Release build configurations?

A Debug configuration supports the debugging of an app, and a Release configuration builds a version of the app that can be deployed.


2 Answers

We have turned on those settings in our commercial releases for years now with no apparent downside. The upsides are enormous,though.

We have integrated a crash dump packager that packages the dump along with some other information and emails it (with the user's consent) to a company inbox. This has helped us find problems that would have taken us forever to reproduce and find otherwise.

Although it's slightly off topic, here's a link to an excellent contribution someone made that gives you an easy way to include a crash reporter to a C++/Windows app: http://www.codeproject.com/KB/debug/crash_report.aspx

Note: It would be wise, though, not to include the PDB file with your release. That said, you must keep the PDB file that matches your released version so that you can correctly debug the problem in the future. If a PDB file is used that wasn't built with the same code that built the exe, the stack you see when you try to debug the dmp will be wrong.

like image 135
Karim Avatar answered Sep 30 '22 17:09

Karim


They're turned on by default because:

  1. If you don't create them now, you can't create them later.
  2. You need them.

Enabling debug info in Visual C++ causes a small entry to be added to the binary header, identifying the PDB for this binary. It's too small to be of any size concern, and doesn't contain any useful secrets that you might be concerned about sharing.

(The header entry is labeled RSDS: who can guess why?)

Of course, those PDBs will use more disk space on your build machine / in your backups. Deal with it. You need those PDBs when it comes time to debug something.

like image 20
Jay Bazuzi Avatar answered Sep 30 '22 17:09

Jay Bazuzi