使用WinDbg转储STL字符串

问题描述 投票:2回答:5

我不能再使用WinDbg转储STL字符串 - 我曾经能够使用命令转储STL字符串:dt -r (MSVCP90!string) address,或宽字符串,dt -r (MSVCP90!wstring) address。不幸的是我不能再这样了 - 我有一个符号路径,当我列出模块时,它显示为MSVCP90加载了符号:

74110000 7419e000 MSVCP90 (pdb symbols) x:\symbols\msvcp90.i386.pdb\A23D796E66BB430B891568A6EF0C750C1\msvcp90.i386.pdb

当我执行命令时,我得到的输出是这样的:

0:025> dt -r (MSVCP90!string)
*************************************************************************
***                                                                   ***
***                                                                   ***
***    Your debugger is not using the correct symbols                 ***
***                                                                   ***
***    In order for this command to work properly, your symbol path   ***
***    must point to .pdb files that have full type information.      ***
***                                                                   ***
***    Certain .pdb files (such as the public OS symbols) do not      ***
***    contain the required information.  Contact the group that      ***
***    provided you with these symbols if you need this command to    ***
***    work.                                                          ***
***                                                                   ***
***    Type referenced: MSVCP90!string                                ***
***                                                                   ***
*************************************************************************
Symbol MSVCP90!string not found.

我的符号路径设置如下:

0:025> .sympath
Symbol search path is: srv*X:\Symbols*http://msdl.microsoft.com/download/symbols
Expanded Symbol search path is: srv*x:\symbols*http://msdl.microsoft.com/download/symbols

我找到了SDbgExt扩展,但从我读到的是7.0版本的运行时 - 这是9.0。

有没有人知道为什么这个功能已经停止工作?没有它我真的活不下去!

谢谢!

编辑:为了更好的衡量,我也尝试启用嘈杂的符号模式。我得到了这个输出:

0:025> .reload /f MSVCP90.dll
DBGHELP: MSVCP90 - public symbols  
         x:\symbols\msvcp90.i386.pdb\A23D796E66BB430B891568A6EF0C750C1\msvcp90.i386.pdb

所以看起来我的符号很好。

windbg
5个回答
4
投票

如果它仅用于STL字符串,则可以手动转储字符串。这很容易。唯一的轻微复杂性是由于STL字符串可以在结构内部保留短字符串(并且更长的字符串总是在堆中)。 STL字符串以sting本身(非常短的一个)或指向字符串的指针开始。这两个命令将转储单字节字符串:

da <address>
da poi <address>

请记住,只有一个命令会实际显示字符串 - 您通常可以通过输出找出。如果不确定,dd <address> + 0x10 l1是字符串的长度。

类似地,对于宽字符串:

du <address>
du poi <address>

6
投票

你也可以使用

!stl <name>

来自文档:

!stl扩展显示了一些已知的标准模板库(STL)模板。此扩展目前支持以下类型的STL模板:stringwstringvector<string>vector<wstring>list<string>list<wstring>以及指向任何前述类型的指针。


1
投票

公共符号没有类型信息。您需要为DLL找到“私有”符号。您还可以使用可执行文件/ DLL进行类型定义。


1
投票

尝试'dx'命令,很好地显示std :: string内容

我认为'dx'是Windows 10中的新功能

dx(显示NatVis表达式)https://msdn.microsoft.com/en-us/library/windows/hardware/dn936815(v=vs.85).aspx


0
投票
  1. 创建脚本mystr.txt $$保存到文件myStr.txt .if(@@ C ++($ {$ arg1} - > _ Mypair._Myval2._Mysize)<16){da @@ C ++($ {$ arg1} - > _ Mypair._Myval2._Bx。 _Buf)} .else {da @@ C ++($ {$ arg1} - > _ Mypair._Myval2._Bx._Ptr)}

2.使用参数调用脚本,例如

$$>a<c:\mystr.txt strVarName
  1. 看到stl字符串内容。
© www.soinside.com 2019 - 2024. All rights reserved.