Tune the debugger using AutoExp.dat

Environment: VC6.0

Visual C++ v6.0 is shipped with a very good integrated debugger, but it has even more features then is documented in the online help files. I'll briefly describe some of these features, so you can use them to make your own programming a little more efficient. Some of these tips were mentioned during the European Visual C++ Developer's Conference in January 1999 in Amsterdam (WARNING: the NoStepInto is an undocumented feature, this means: no support, may change, may not work...!). The AutoExp.dat file (in the \Program Files\Microsoft Visual Studio\Common\MSDev98\Bin directory) has some very neat features that can help you tune the debugger. This file is read when the debugger is started and looks just like an INI-file. Both the Automatic expansion of structures and avoid stepping into particular functions are configured using this file.

Automatic expansion of structures

The debugger is capable of displaying the contents of a structure (or class) in a watch or a tooltip. For some structures, you can actually see what's inside the structure (i.e. the CString class). For your own structures you only see three dots and that's it. Of course you can expand these watches in the debugger, but for tooltips you're out of luck. Fortunately, this mechanism of displaying the contents of a structure wasn't hardcoded in the debugger, but it's done using a special section in the AutoExp.dat file. Open the file and look for the [AutoExpand] section and you'll see how this is accomplished. The following piece of text is extracted from this file, but is included here for reference.

AutoExpand rules use the following syntax. The equals sign (=), angle brackets (<>), and comma are taken literally. Square brackets ([]) indicate optional items.
type=[text]<member[,format]>...
Type Name of the type (may be followed by <*> for template types such as the ATL types listed below).
Text Any text.Usually the name of the member to display, or a shorthand name for the member.
Member Name of a member to display.
Format Watch format specifier. One of the following:
Letter Description Sample Display
d,i Signed decimal integer 0xF000F065,d -268373915
u Unsigned decimal integer 0x0065,u 101
o Unsigned octal integer 0xF065,o 0170145
x,X Hexadecimal integer 61541,X 0X0000F065
l,h long or short prefix for d, i, u, o, x, X 00406042,hx 0x0c22
f Signed floating-point 3./2.,f 1.500000
e Signed scientific-notation 3./2.,e 1.500000e+000
g Shorter of e and f 3./2.,g 1.5
c Single character 0x0065,c 'e'
s Zero-terminated string 0x0012fde8,s "Hello world"
su Unicode string 0x007200c4,su "Hello world"
st String in ANSI or Unicode depending on current setting

The special format <,t> specifies the name of the most-derived type of the object. This is especially useful with pointers or references to a base class. If there is no rule for a class, the base classes are checked for a matching rule.

Avoid stepping into particular functions

Did you also debug some code, where you had to step into some functions but you're stepping more in CString's internal functions then in the code which you wanted to debug? There is an (undocumented) solution to this problem and it's in the AutoExp.dat file as well. Create a section called [ExecutionControl] and add the following line for functions that should be treated as "atomic":

Function=NoStepInto Avoid stepping into this specific function
Classname::Method=NoStepInto Avoid stepping into the specific method of this class
Classname::*=NoStepInto Avoid stepping into any of the methods of this class

The CString class is used throughout the code, so you're normally not interested in the construction, destruction and assignments of this class. Add the following code to the AutoExp.dat file to prevent stepping into these functions:


[ExecutionControl]
    CString::CString=NoStepInto
    CString::~CString=NoStepInto
    CString::operator==NoStepInto



Comments

  • How about VC .NET?

    Posted by Legacy on 12/03/2003 12:00am

    Originally posted by: CL Mok

    If I am using VC.NET, is there the same function as autoexp.dat?

    Thanks!

    Reply
  • Any luck with nested namespaces?

    Posted by Legacy on 08/24/2003 12:00am

    Originally posted by: Mike

    for NoStepInto that is.
    
    

    I was trying to trick CComPtr into a nested namespace, with a forward declaration

    namespace ATL
    {
    namespace SP
    {
    template <class T> class CComPtr;
    };

    using SP::CComPtr;
    };

    #include <atlbase.h>

    then in the autoexp.dat file to ignore only SP instead of the complete ATL,

    ATL::SP::*=NoStepInto

    but it still steps into CComPtr member functions, although in the call stack I can see it compiled with the nested namespace.

    Thanks,
    Mike

    Reply
  • New line in debug ?

    Posted by Legacy on 01/15/2003 12:00am

    Originally posted by: francois

    Is it possible to specify a new line in a debug type
    in the autoexp.dat ?

    for example displaying a matrix :
    matrix 1 0 0 0
    0 1 0 0
    0 0 1 0
    0 0 0 1

    i tryied to put a \n , but it appears as text ...
    any other idea ?

    Reply
  • Couple more formatting chars

    Posted by Legacy on 07/25/2002 12:00am

    Originally posted by: Baga

    Some more useful formats:

    ,wc - Window class flag. (0x00000040 -> WC_DEFAULTCHAR)

    ,wm - Windows message numbers (0x0010 -> WM_CLOSE)

    and some more for formatting memory content.

    BTW, found in Studio Help after searching for "autoexp.dat"

    Reply
  • Case sensitive

    Posted by Legacy on 11/16/2001 12:00am

    Originally posted by: Patrick Morris

    After some investigation it appears that this feature is case insensitive. I wrote a class cString (before porting to the microsoft c compiler) with a member char *m_text. When I added the appropriate bit in autoexp.dat:

    cString =<m_text,s>

    The debugger displays ??? when I move the mouse over a variable of this type. I tested this by writing a new class called TestString with the same member type and it worked in this case.

    I guess this means I will have to rename my type for it to work under the debugger.


    Reply
  • Return value from functions

    Posted by Legacy on 03/29/2000 12:00am

    Originally posted by: Srikanth

    Hi,
    I am used to directly watching the return value from functions in the Watch window in VC5. But now I see that there is no such facility in VC6 debugger. Is it like a feature which should be turned on???.

    Thanks in Advance,
    Srikanth

    Reply
  • Yahoo!!!! Template issue solved!

    Posted by Legacy on 01/13/2000 12:00am

    Originally posted by: Scott Childs

    I've been able to do it for templates like this:

    ATL::CComBSTR::Copy=NoStepInto

    Quite simply put, I believe as long as your text matches what is shown in the call stack window, it can be skipped.

    Now if I could just figure out how to use the wildcards properly. For example, I'm calling a method in a library that shows on my call stack as:

    ATL::CComPtr<HCMYLIBLib::IHCMyFunc>::operator->.........

    I can make it skip it as well by doing:

    ATL::CComPtr<HCMYLIBLib::IHCMyFunc>::operator->=NoStepInto

    But I'm fairly confident there is a trick to making this easier.

    Reply
  • GUID variables in AutoExp.dat

    Posted by Legacy on 07/28/1999 12:00am

    Originally posted by: Vedran Brnicevic

    I'll appreciate a tip on how to show GUID member variable in a structure. Does that have smth to do with the $BUILTIN macro in autoexp.dat?

    Reply
  • Any luck with templates?

    Posted by Legacy on 05/28/1999 12:00am

    Originally posted by: Chris Ling

    Just wondering if anyone has had any luck with the ExecutionControl section, and the NoStepInto operator with template classes?

    Reply
  • anyway to specify template class routines

    Posted by Legacy on 02/24/1999 12:00am

    Originally posted by: Glenn Carr

    Anyone know of a way to specify template classes in this [ExecutionControl] section? E.g., it would be nice to step over CComPtr::operator->, etc.

    Glenn

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • 10 Rules that Make or Break Enterprise App Development Projects In today's app-driven world, application development is a top priority. Even so, 68% of enterprise application delivery projects fail. Designing and building applications that pay for themselves and adapt to future needs is incredibly difficult. Executing one successful project is lucky, but making it a repeatable process and strategic advantage? That's where the money is. With help from our most experienced project leads and software engineers, …

  • IT decision support impacts all aspects of technology management, from governance and strategy to budgets and resource planning. IT decision support effectiveness often falls prey to data-driven challenges that make it difficult to understand the data in context. These challenges: overwhelming data volumes, heterogeneous data types, and growing data complexity. This Forrester Consulting Paper reports the three key findings from their study conducted, on behalf of BDNA, to test the hypothesis that data …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds