1. 참고링크 [Bottom] [Top]

2. Visual C++ Debugger Tips [Bottom] [Top]

Visual Studio's (native) C++ debugger has many useful features that can make your debugging much more pleasant, if you know what they are. These tend to accumulate over releases, and get forgotten and unused, unless you happen upon an archaic piece of documentation. On this topic, then, there are special expression and format specifiers that you can use to better examine the content in the debugger's watch windows.

For example, say we break after the following bit of code:

You can use the by, wo, and dw operators to view contents of a variable as an unsigned byte, word, or dword:

You can also use the operators on a register to do the same to the destination of the register:

These come in handy when debugging through assembly.

Another way to change debugger output is through format specifiers. These are directives passed after the expression, separated by a comma. For example, to change the radix out the output, you can append ',o' for octal, ',d' for decimal, or ',x' for hex:

To interpret a pointer expression as a string, you can use ',s' for an simple null-terminated string, ',s8' for a UTF-8 string, or ',su' for a Unicode string. (Note that the expression has to be a pointer type for this to work).

The memory operators can be used to display up to 64 bytes of memory in the preview line, as bytes, words, dwords, quads, or ascii characters.

You can use ,wc ,wm and ,hr to view data as a window class, window message, or HRESULT.

Finally, you can use ,! to turn off STL visualizations on the expression:

All of these operators can be used to ease the way you get to data while debugging, and become necessary whern creating custom visualizations. You can check-out the autoexp.dat file in your Visual Studio directory for examples of how to combine these operators and the visualization language to create custom visualizers for your own data.


CategoryDebug

Visual C++ 디버거 팁 (last edited 2009-07-20 08:30:47 by viper)