Click here to Skip to main content
Click here to Skip to main content

DebuggerEx – Customizing Visual C++ Debugger

, 12 Jun 2005
Rate this:
Please Sign up or sign in to vote.
This is a Visual Studio add-in component built in ATL COM. This will help you to customize some features of the Visual C++ debugger. The addin will configure your own data types into debugger's tool-tip display using Autoexp.dat file.

Introduction

Microsoft Visual C++ provides very good support for debugging. It not only provides default-debugging facilities but also supports customizations. Since debugging is the most important phase of development, this feature can be considered as the exact power of Visual C++. In this article, I am introducing a utility, which is a Visual Studio Add-In component built in ATL COM. The add-in will help you customize some of the features of Visual C++ debugger.

Theory

All of us are familiar with the tool-tip display of debugger. During debugging, we can see the data by just pointing the cursor on the corresponding variable. But it is not possible to use this method to view all types of data. This functionality is restricted to some basic data types and some MFC classes and structures. Also we can’t see the data of a variable, that is an object of a custom class or structure. For our own structures or classes you only see three dots. We can use the watch window to verify the data. But the tool-tip display is impossible in this case. This makes our job a little difficult while debugging. As I said earlier, here we can use the real power of Visual C++ debugger, i.e. customize the debugger with our custom data types.

Visual C++ debugger has a configuration file named AutoExp.dat, using which we can customize the data types and its tool-tip display by simply hard coding it. The file can be found at <InstallDir>\ Microsoft Visual Studio\Common\MSDev98\Bin. We can add our own entries in the [AutoExpand] section of this file. The add-in will help you configure your own data types into the debugger’s tool-tip display using this file.

DebuggerEx Add-in

Following are the functionalities provided by this add-in:

  • Support tool-tip display for the following data types.
    • Basic data types (int, float, char, char[] etc).
    • Standard data types supported by VC++ (CString, SYSTEMTIME, COleDateTime etc.).
  • Support tool tip display for any specific number of array elements for data types like CStringArray, CUIntArray etc.
  • Support tool-tip display for our own classes and structures.

What is in the source code

The following are the main classes and their responsibilities:

  • CMainDlg

    This class contains the code for the main window of this utility. This class has the following responsibilities:

    • Read the existing debugger configuration from AutoExp.dat.
    • Display them in the main window.
    • Facilitate the user to add, delete and edit entries.
    • Store the updated debugger configuration into AutoExp.dat.
  • CInputDlg

    This class helps you to add or edit an entry to the debugger.

  • CRegistryManager

    This class handles all the registry operations on behalf of this utility.

Installation

Since the need to update the registry depends on the installed version of Visual Studio, there is an application named SetUp.exe used for the installation of this add-in. Following are the installation steps:

  1. Run SetUp.exe. (Before this, close all instances of msdev.exe, else the setup program will prompt you to close them.)
  2. Run MSDEV.exe.
  3. Invoke Tools->Options->Customize from Visual Studio IDE.
  4. Go to Add-ins and Macros tab.
  5. Select the DebuggerEx class from the left pane.
  6. Click the Close button.

In the absence of setup.exe, we can install this debugger utility using the following steps:

  1. Stop all instances of MSDEV.exe.
  2. Run RegSetup.reg, or create the following registry key.

    HKEY_CURRENT_USER\Software\DebuggerEx\SetUp.

  3. Give the Visual Studio version as the value of the registry key. [E.g.: For Visual Studio 6, use 6.0 as the value.]
  4. Copy DebuggerEx.dll to <InstallDir>\ Microsoft Visual Studio\Common\MSDev98\Bin.
  5. Run MSDEV.exe.
  6. Invoke Tools->Options->Customize from Visual Studio IDE.
  7. Go to Add-ins And Macros tab.
  8. Select the DebuggerEx class from the left pane.
  9. Click the Close button.

Uninstallation

  1. Run MSDEV.exe. (Make sure that only one instance of MSDEV.exe is running.)
  2. Invoke Tools->Options->Customize from Visual Studio IDE.
  3. Go to Add-ins And Macros tab.
  4. Uncheck the DebuggerEx class from the left pane.
  5. Click the Close button.
  6. Run UnInstall.exe.

Customizing our own data types

By completing the installation procedure, the first functionality will be active. But for the second functionality, (i.e. Tool-Tip display for our own types), we have to do the following steps:

  1. Invoke DebuggerEx add-in from the toolbar of Visual Studio IDE. A dialog as shown in figure 1 will be displayed. Following are the controls in the dialog:
    • A list control for displaying the names of all customized classes.
    • Add button, for adding a new class to the customized class list.
    • Edit button, for modifying a class, which is already entered into the class list.
    • Remove button, which will help you to remove a class from the class list.
    • Apply button, for applying changes to the debugger.
    • OK button, for closing the dialog after applying changes to the debugger.
    • Cancel button, for closing the dialog without applying changes to the debugger.
    • About button, for displaying some information about the DebugerEx.
    • Edit field and a Spin control for customizing the tool-tip display of some data types such as CStgingArray, CUIntArray, CByteArray etc.. The number in the field specifies how many array elements are to be displayed in the tool-tip.
  2. Click Add button. A new dialog (in figure 2) will be displayed for reading the information about your new class. The following are the controls displayed in that dialog:
    • Class Name edit field, for entering the name of the new class.
    • A list control, which will display information about the new class.
    • Three edit boxes below each column of the list control, to add and update the information in the list control.
    • Add button will add a new item to the list control from the data entered in the edit fields.
    • Update button will update an existing item in the list control from the data entered in the edit fields.
    • Remove button will remove an item from the list control.
    • OK button.
    • Cancel button.
  3. After entering all the data member information, click the OK button.
  4. Then click Apply-OK or OK button of the main dialog.

Conclusion

This version of DebuggerEx may have some limitations. Please feel free to send feedbacks and extend this to a helpful debugging utility.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Brigil V
Web Developer
India India
I am a Software Engineer from Trivandrum, India. I am very much interested in Software Development activities, especially in Design and Coding. Currently I am working with VC++ projects.

Comments and Discussions

 
QuestionCan DebuggerEx be Used To parse C macros PinmemberForNow8-May-07 15:08 
QuestionCan not install it PinmemberAngelMischa198113-Jun-05 4:04 
AnswerRe: Can not install it PinmemberRudolf Jan Heijink13-Jun-05 11:49 
GeneralRe: Can not install it PinmemberBrigil V22-Jun-05 19:05 
AnswerRe: Can not install it PinmemberBrigil V14-Jun-05 1:32 
GeneralRe: Can not install it PinmemberAngelMischa198117-Jun-05 5:19 
GeneralCopying 'dll' failed in Setup. PinmemberWREY12-Jun-05 22:56 
GeneralRe: Copying 'dll' failed in Setup. PinmemberBrigil V14-Jun-05 1:34 
GeneralRe: Copying 'dll' failed in Setup. PinmemberBrigil V22-Jun-05 19:06 
GeneralNice work from Indian Fellow Pinmembersudhir mangla12-Jun-05 22:22 
GeneralRe: Nice work from Indian Fellow PinmemberBrigil V14-Jun-05 1:36 
GeneralRe: Nice work from Indian Fellow PinmemberBrigil V22-Jun-05 19:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 12 Jun 2005
Article Copyright 2005 by Brigil V
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid