Search code examples
c++visual-c++exe

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?

  • "learn more" => get information about names of functions, variables, classes, etc.
  • Assuming of course that no Debug-Symbol file (.pdb) was shipped

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.


Solution

  • 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.