BUG: The Visual C++ .NET or Visual C++ 2005 debugger cannot display std::string and std::wstring variables correctly (326616)
The information in this article applies to:
- Microsoft Visual C++ 2005 Express Edition
- Microsoft Visual C++ .NET (2002)
This article was previously published under Q326616 SYMPTOMSThe debugger may not display values appropriately for the
following strings:
- std::string variables, if the length of the string is
greater than 15 characters.
- std::wstring variables, if the length of the string is less
than 15 characters.
CAUSEThe std::string or std::wstring variable is stored as static
buffer if the length is less than 15 characters. If the length of the string is
greater than 15 characters, the string is stored as a pointer to memory.
You can modify the Autoexp.dat file to control the debugger display
of std::string variable. The _Bx._Buf member is used to specify the std::string stored as static
buffer. The _Bx._Ptr member is used to specify that std::string is stored as a pointer
to memory. When the _Bx._Ptr member is not specified for std::string in autoexp.dat file, the
debugger does not display the std::string variables that have length greater
than 15 characters. When _Bx._Buf member is not specified for std::wstring in autoexp.dat file, the
debugger does not display the std::wstring variables that have length less than
15 characters.RESOLUTION The Debugger component that displays variable values is
known as Expression Evaluator (EE). One instance of EE handles the native code,
and the other instance handles the managed code. The Autoexp.dat file provides
customization for the native EE, and the Mcee_mc.dat file provides
customization of managed EE. To resolve this problem, modify the Autoexp.dat
file. To modify the Autoexp.dat file, follow these steps:
- Open Notepad or any other text editor.
- Open the Autoexp.dat file from the c:\Program
Files\Microsoft Visual Studio .NET\Common7\Packages\Debugger folder.
- In the Autoexp.dat file, locate the following lines:
std::basic_string<char,std::char_traits<char>,std::allocator<char> >=<_Bx._Buf> std::basic_string<unsigned short,std::char_traits<unsigned short>,std::allocator<unsigned short> >=<_Bx._Ptr> std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >=<_Bx._Ptr>
- Replace the lines that you located in step 3 with the
following lines:
std::basic_string<char,std::char_traits<char>,std::allocator<char> >=
_Buf=<_Bx._Buf> _Ptr= <_Bx._Ptr> std::basic_string<unsigned short,std::char_traits<unsigned short>,std::allocator<unsigned short> >=_Buf=<_Bx._Buf> _Ptr= <_Bx._Ptr> std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >=<_Bx._Buf> _Ptr= <_Bx._Ptr>
STATUS Microsoft
has confirmed that this is a problem in the Microsoft products that are listed
at the beginning of this article.
Notice
Modification Type: | Major | Last Reviewed: | 1/12/2006 |
---|
Keywords: | kbDebug kbBug KB326616 kbAudDeveloper kbAudITPRO |
---|
|