windowssymbolsdbghelp

Windows executables with complete embedded debug symbols?


Are there cases when a Windows executable (written in C++ with Visual Studio) can contain its full debug symbols? Or are the full set of debugging symbols contained only in its .pdb file?

Is there a way to configure building a windows application so that we can debug it without having the .pdb file?


Solution

  • From the documentation for your toolchain:

    The compiler's C7 Compatible (/Z7) option causes the compiler to leave the debugging information in the .obj files. You can also use the Program Database (/Zi) compiler option to store the debugging information in a PDB for the .obj file. The linker looks for the object's PDB first in the absolute path written in the .obj file, and then in the directory that contains the .obj file. You cannot specify an object's PDB file name or location to the linker.

    It is not possible to create an .exe or .dll that contains debug information. Debug information is always placed in a .obj or .pdb file.

    This doesn't rule out debug information placed into a section of an EXE file by other tools... but Microsoft Visual Studio's C++ tools never do.

    For information on placing debug information into OBJ files (possibly contained inside LIB static libraries) instead of a PDB, read the documentation on the compiler option for Debug Information Format