在windbg中,如何从!heap -l结果中获取堆头地址?
我正在使用 Windbg 的 !heap 命令,特别是检测内存泄漏的“-l”开关。
当 -l 确实检测到泄漏时,我在从其结果导航到泄漏源的堆栈跟踪时遇到问题。
以下是 !heap -l 的结果片段。格式已更改以使输出更具可读性。
0:066> !堆-l 在内存中搜索潜在的无法访问的繁忙块。
进入用户堆段
0324b500 0324b508 01580000 03230000
0324b520 0324b528 01580000 03230000
(为简单起见,省略了 Size、PrevSize、Unused 和 Flags 列。)
Windbg 的 !heap 文档告诉我将 dt _DPH_BLOCK_INFORMATION 与标头地址一起使用,然后使用 dds 与块的 StackTrace 字段。但是 !heap -l 的输出没有指定标头地址!它仅指定 Entry、User、Heap 和 Segment。我绞尽脑汁查看其他命令,但不知道如何从这些字段中获取标头地址。有人可以帮忙吗?
I am playing around with windbg's !heap command, particular the "-l" switch which detects memory leaks.
When -l does detect a leak, I am having problems navigating from its results to a stack trace for the source of the leak.
Here is a snippet of the results from !heap -l. Formatting has been changed to make the output more readable.
0:066> !heap -l
Searching the memory for potential unreachable busy blocks.
Entry User Heap Segment
0324b500 0324b508 01580000 03230000
0324b520 0324b528 01580000 03230000
(Size, PrevSize, Unused, and Flags columns omitted for simplicity.)
Windbg's documentation for !heap tells me to use dt _DPH_BLOCK_INFORMATION with the header address, followed by dds with the blocks' StackTrace field. But the output for !heap -l doesn't specify a header address! It's only specififying Entry, User, Heap, and Segment. I've racked my brain looking over the other commands but can't figure out how to get the header address from any of these fields. Can someone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否使用 AppVerifier 或 Gflags 启用了所需的调试选项?仅当启用了 pageheap 选项时,内存块才会有 _DPH_BLOCK_INFORMATION,并且如果也启用了该选项,您将能够显示堆栈回溯。要显示块的堆栈跟踪,可以使用
!heap -p -a <块地址>
。请注意,如果在应用程序退出时不使用 !heap -l 可能会显示大量误报。您还可以尝试 umdh(也包含在 Windows 调试工具中)或 DebugDiag。
Did you enable the needed debug options with AppVerifier or Gflags ? Memory blocks will have a _DPH_BLOCK_INFORMATION only if pageheap option is enabled, and you will be able to display the stack backtrace if that option is also enabled. To display the stack trace of a block, you can use
!heap -p -a <block address>
.Be aware that !heap -l may display lots of false positives if not used at application exit time. You could also try umdh (also included in Debugging Tools for Windows), or DebugDiag.