You are currently offline, waiting for your internet to reconnect

Description of Visual C++ project settings and .dbg file creation

This article was previously published under Q216356
This article has been archived. It is offered "as is" and will no longer be updated.
This article explains the process of creating a debug (.dbg) file using the REBASE utility from any executable file or dynamic link library (DLL) generated using Microsoft Visual C++ 32-Bit Edition.
To create a debug file using the REBASE utility from any executable file or DLL generated using Microsoft Visual C++ 32-Bit Edition, complete the following steps:
  1. From the Project menu, click Settings. Make the following settings, and then click OK.
    1. In the Project Settings dialog box, select the build configuration which needs to generate a .dbg file symbol from the Settings for dropdown list. To apply the new settings to all configurations, select All Configurations.
    2. Select the names of the projects which will contribute symbol information to .dbg files, such as static libraries. Projects which build DLLs need to generate separate .dbg files, and need to have their settings changed as well. Select more than one project name by holding down the Ctrl key when clicking on the name.
    3. Click the C/C++ tab. Select the General category, then select the type of debug information to be generated for each source file from the Debug Info dropdown list. We recommend Program Database.

      Note In Visual C++ version 6.0, you may select Program Database for Edit and Continue for the Debug configuration; however, that setting is incompatible with the default optimization settings for the Release configuration. Notice that it is set to None by default for the Release configuration. Changing this setting will not make the Release build run slower.
    4. Click the Link tab. Select Debug and choose the Debug info box, and select either COFF format or Both Formats.
    5. Also under the Link tab, select the Customize category. Clear the Use program database box.
    6. If you did not select All Configurations in step a, repeat steps a through e for each build configuration which should generate .dbg files.
  2. Build the executable file or DLL with the embedded debug information.
  3. By default, REBASE is installed to the \bin subdirectory of the Visual C++ installation path. In order to run it, you may need to run the Vcvars32.bat file in the command window first to set the system path properly. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
    168403 BUG: Setup doesn't ask to register environment variables
  4. Get the image base address by executing DUMPBIN as follows. This action is required to extract the symbols without changing the base address of the module.
    dumpbin /headers IMAGE_FILE
    Where IMAGE_FILE is the name of the executable or DLL file. DUMPBIN /headers will dump an ample amount of header information. The image base value can be found in the OPTIONAL HEADER VALUES section labeled image base. By default, the image base value is 0x400000 for executable files and 0x10000000 for DLLs.
  5. Strip the symbols from the executable file or DLL and place them in a .dbg file by using REBASE as follows:
    Where IMAGE_BASE is the preferred base address of the image.

    DBG_PATH is the directory where the .dbg file will be created. DBG_PATH can be either "." or an absolute or relative path. If an absolute or relative path is specified, then the .dbg file is created in a subdirectory corresponding to the file type; for example: \exe or \dll, in that directory. If "." is specified, then the .dbg file will is created in the directory where IMAGE_FILE is located. IMAGE_FILE is the name of the executable or DLL file.
    e.g. rebase -b 0x10000000 -x . sample.dll
    This strips the debug information from the sample.dll file and creates the sample.dbg file in the directory where the sample.dll file is located.
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
121366 Description of the .PDB files and of the .DBG files
128372 How to remove symbols from device drivers

Article ID: 216356 - Last Review: 12/05/2015 12:45:15 - Revision: 5.0

Microsoft Visual C++ 4.0 Standard Edition, Microsoft Visual C++ 6.0 Service Pack 5, Microsoft Visual C++ 5.0 Standard Edition

  • kbnosurvey kbarchive kbhowto kbinfo kbbug kbkernbase kbdebug KB216356