Christopher Oezbek
Christopher Oezbek

Reputation: 26353

Do debugging information reveal code in C++ / MSVC?

If we distribute a compiled C++ executable which contains debug information/symbols does this enable a third party to learn more about the source code from which the program was compiled than if debug information were missing?

This question relates mostly to protection of proprietary code in C++ as compiled with MSVC, but information about other compilers and debug symbols in general may provide insights as well.

Some context for the question: We ship executables with debug information to create stack traces in case of unexpected program state.

EDIT: We maintain the PDBs inside our company, of course, to be able to read the stack traces once they arrive.

Upvotes: 0

Views: 348

Answers (3)

Angus Connell
Angus Connell

Reputation: 419

I only know about Microsoft compilers.... The PDB would store extra information (You should really strip your pdb, if you really care.)
https://msdn.microsoft.com/en-us/library/y87kw2fd.aspx

John Robbins has written some great articles on PDBs and how to use them, here is a start:
https://www.atmosera.com/blog/pdb-files-what-every-developer-must-know/
Hope that get's you going...

Upvotes: 2

vonbrand
vonbrand

Reputation: 11791

The executable contains the code for the program. With enough determination, it can be reconstructed (look around for discussions of how some computer virus works, there you'll see that people who just got the executable, in many cases even encrypted and otherwise obfuscated to make recognizing it as malware more difficult, figured out how it works).

Besides, it is easier just to copy the executable, why bother finding out how it is written to write a clone...

Upvotes: 1

Gerald
Gerald

Reputation: 23489

Basically, no. All debug information is stored in the PDB and the EXE just contains the path to the PDB.

If you are concerned, you can always use a hex editor to browse through the binary code to see what information is embedded in the .EXE. This is something I tend to do whenever I build for a new platform or with a new set of dev tools. Sometimes you get things embedded that you don't really want, but usually not about the code, more like network names and paths.

Upvotes: 1

Related Questions