Autoexp. dat

Source: Internet
Author: User

In the debugging status, VC displays the content of a variable in three ways:Preview,ChildrenAndStringviewAs shown in, define a STD: string type variable. The displayed content after hovering is preview, and children is the content displayed after clicking the "+" symbol, for variables containing the string content, click the magnifier symbol to display the string content in a separate window.

For this function, Microsoft provides developers with a custom interface by modifying autoexp. dat, a small file that looks ugly, is stored in the "$ (vsinstalldir)/common7/packages/Debugger" directory. Microsoft does not provide instructions on this file, there are some simple instructions at the beginning of this file. Fortunately, the structure of this file is not complex. By analyzing the existing examples, you can probably understand the structure of this file.
The following example shows how to use the file, open the file, and add the following content under the line "[visualizer ]".

Myclass {
Preview
(
#(
"Hello, world! "
)
)
}

Start VC and define a class named myclass. When you use the VC debugger to view the content of this class, you will find that the displayed debugging content has changed to "Hello, world!"

Next let's look at a slightly complex example, such as a custom array class.

Struct myclass
{
Int size [32];
Int * Buf;
};

When debugging this data structure, we want to display the number of elements in this array, the values of each element, and the parity of each element, so we need to define it as follows:

Myclass {
Preview
(
#(
"[Count is", $ C. Size, "]",
"(BUF ",
# Array
(
Expr: $ C. Buf [$ I],
Size: $ C. Size
): $ E,
")",
"(Odd ",
# Array
(
Expr: $ C. Buf [$ I],
Size: $ C. Size
): $ E & 1,
")"
)
)
}

The actual display result is:

Where,$ CIndicates the currently defined data structure,# ArrayThe content is displayed as an array,$ IIndicates the index of each element in the array,$ EThe value of each element. Similarly, you can use # tree and # list to display the data structure of the tree data structure and the linked list type respectively.
Autoexp. dat has defined the default STL data structure provided by VC, such as vector and map. By analyzing these definitions, we can also explore many interesting functions, for example, using the # If/# else/# Switch/# case and other condition judgment functions can be very useful in processing complicated data structures of the combination type.
The following is a copy of the data structure I created. For the definition of some data structures in another common STL library stlport, it is applicable to stlport 5.2, the method is to copy the content to autoexp. if you are interested in the "[visualizer]" section of dat, you can use it. If you find any error or supplement it, please let me know.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.