!std_map 00000000`0019fd48 "testcreatedc!std::pair <int,char const *>" 你这写法就不对,!std_map后面只有一个地址参数,就是map变量的地址命令的帮助如下:!std_mapThe !std_map extension displays the entries of a std::map tree. Syntax !std_map Address [Module!Type [TypeSize]] !std_map -?Parameters Address Specifies the address of the std::map tree to display. Module Specifies the module in which the data structure is defined. Type Specifies the name of a data structure. This must be expressed in Module!std::pair<Type1,Type2> form. If the TypeSize parameter is used, this parameter must be enclosed in quotation s. TypeSize Specifies the size of the data structure to make the symbols unambiguous. -? Displays some brief Help text for this extension in the Debugger Command window
0019fd48 是模块句柄,不是地址!std_map Address [Module!Type [TypeSize]]Address Specifies the address of the std::map tree to display. Module Specifies the module in which the data structure is defined. Type Specifies the name of a data structure. This must be expressed in Module!std::pair<Type1,Type2> form. If the TypeSize parameter is used, this parameter must be enclosed in quotation s. TypeSize Specifies the size of the data structure to make the symbols unambiguous.
每个m.insert之间加一个 i++;
再dt
你这写法就不对,!std_map后面只有一个地址参数,就是map变量的地址命令的帮助如下:!std_mapThe !std_map extension displays the entries of a std::map tree.
Syntax
!std_map Address [Module!Type [TypeSize]]
!std_map -?Parameters
Address
Specifies the address of the std::map tree to display.
Module
Specifies the module in which the data structure is defined.
Type
Specifies the name of a data structure. This must be expressed in Module!std::pair<Type1,Type2> form. If the TypeSize parameter is used, this parameter must be enclosed in quotation s.
TypeSize
Specifies the size of the data structure to make the symbols unambiguous.
-?
Displays some brief Help text for this extension in the Debugger Command window
帮助我看了很多遍了,也尝试了所有所能想到的可能。
比如用dt看m的地址,然后使用该地址:但总提示地址无效。
实在是没招了。
Local var @ 0x12ff44 Type std::map<int,char const *,std::less<int>,std::allocator<std::pair<int const ,char const *> > >
+0x000 _Myfirstiter : (null)
+0x004 comp : std::less<int>
+0x008 _Alnod : std::allocator<std::_Tree_nod<std::_Tmap_traits<int,char const *,std::less<int>,std::allocator<std::pair<int const ,char const *> >,0> >::_Node>
+0x00c _Alptr : std::allocator<std::_Tree_nod<std::_Tmap_traits<int,char const *,std::less<int>,std::allocator<std::pair<int const ,char const *> >,0> >::_Node *>
+0x010 _Alval : std::allocator<std::pair<int const ,char const *> >
+0x014 _Myhead : 0x00394df0 std::_Tree_nod<std::_Tmap_traits<int,char const *,std::less<int>,std::allocator<std::pair<int const ,char const *> >,0> >::_Node
+0x018 _Mysize : 3
0:000> !std_map 0012ff44 test!std::pair<int,char const *>
ReadMemory error for address 35c0b9ec
ReadMemory error for address 35c0b9f4
std::map @ 0012ff44 - empty
Specifies the address of the std::map tree to display.
Module
Specifies the module in which the data structure is defined.
Type
Specifies the name of a data structure. This must be expressed in Module!std::pair<Type1,Type2> form. If the TypeSize parameter is used, this parameter must be enclosed in quotation s.
TypeSize
Specifies the size of the data structure to make the symbols unambiguous.
还是不行。
我将m改为全局变量:
#include <map>using namespace std;map<int, const char *> m;int i = 8;
const char* str = "Test string!!";int main()
{
i++;
m.insert(pair<int, const char*>(10, "This is 10"));
m.insert(pair<int, const char*>(1, "This is 1"));
i += 3;
m.insert(pair<int, const char*>(11, "This is 11"));
m.insert(pair<int, const char*>(15, "This is 15")); return 0;
}i的值和str的值都可以显示,但m的值显示不了:
0:000> dt test!i
12
0:000> dt test!str
0x0045fe7c "Test string!!"
0:000> !std_map test!m "test!std::pair <int,char const *>"
invalid head at 00473564我用dt test!m*查看变量m的地址:
0:000> dt test!m*
test!mbstate_t
test!MEMORY_BASIC_INFORMATION
test!Mod
test!Mod::<unnamed-tag>
test!Mod
00473588 test!mtx
004730a0 test!mspdbName
00473560 test!m
0045f208 test!m$initializer$
00474190 test!mspdb
0042e780 test!mbtowc
00401600 test!main
00413650 test!memcpy
004139c0 test!memmove
0040feb0 test!malloc
00427410 test!mbstowcs
00408360 test!memmove_s
00408710 test!mainCRTStartup
004277e0 test!mbstowcs_s
004081d0 test!memcpy_s
00433de0 test!memcmp
00410450 test!memset
发现其地址也提示错误的值之间相差4。我再尝试:
0:000> !std_map 00473560 "test!std::pair <int,char const *>"
invalid head at 00473564
说明test!m的值就是地址00473560。可是,为什么不能打印map的值呢?
请指点,谢谢!
TestCSDN!i
90:000> dt str
TestCSDN!str
0x004781b8 "Test string!!"0:000> !std_map testCSDN!m "testCSDN!std::pair <int,char const *>"
std::map @ 00485f68 - size 00000002
00000000 - 015f4998 (015f4630,015f4920,015f4630)
00000001 - 015f4920 (015f4998,015f46a8,015f4630)
0:000> dt testCSDN!m*
TestCSDN!mbstate_t
TestCSDN!MENUTEMPLATEA
TestCSDN!MENUTEMPLATEW
00485f68 TestCSDN!m
00437060 TestCSDN!mbtowc
004073c0 TestCSDN!main
004259a0 TestCSDN!memcpy
00425660 TestCSDN!memmove
00426e60 TestCSDN!malloc
00425ce0 TestCSDN!mainCRTStartup
00413d40 TestCSDN!mbsrtowcs
00425560 TestCSDN!memchr
004299a0 TestCSDN!memcmp
00413bc0 TestCSDN!mbrlen
00413c60 TestCSDN!mbrtowc
00425500 TestCSDN!memset0:000> !std_map 00485f68 "testCSDN!std::pair <int,char const *>"
std::map @ 00485f68 - size 00000002
00000000 - 015f4998 (015f4630,015f4920,015f4630)
00000001 - 015f4920 (015f4998,015f46a8,015f4630)
刚才又看了一下微软论坛上的答复,这个 00000000`0019fd48 是因为回答的人的os是64位的,所以是64位长度的地址
请问你的VS版本?我查资料时,似乎有说WinDbg的!std_map不支持VS2008.
我是VS2008SP1。
不管怎样,看到你可以成功,我非常兴奋!
那说明我离成功也不远了。
谢谢!