INFO: Visual C++ Project Settings and .DBG File Creation

ID: Q216356


The information in this article applies to:


SUMMARY

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.


MORE INFORMATION

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. Choose the appropriate Project Settings for generating debug information.


  2. Select the type of debug information that needs to be generated in the Debug Info section under the Debug category.


  3. Under the Link tab:


    1. Select the type of debug information that needs to be generated under the Debug info drop-down menu in the General category of the C/C++ settings.


    2. Clear the Use program database selection under the Customize category.


  4. Build the executable file or DLL with the embedded debug information.


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


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

  7. Strip the symbols from the executable file or DLL and place them in a .dbg file by using REBASE as follows:


  8. rebase -b IMAGE_BASE -x DBG_PATH IMAGE_FILE
    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 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.


REFERENCES

Q121366: INFO: PDB and DBG Files - What They Are and How They Work
Q128372: HOWTO: Remove Symbols from Device Drivers

Additional query words:


Keywords          : kbDebug kbKernBase 
Version           : winnt:4.0,5.0,6.0
Platform          : winnt 
Issue type        : kbinfo 

Last Reviewed: April 9, 1999