gpt4 book ai didi

windbg - 过滤windbg的输出

转载 作者:行者123 更新时间:2023-12-03 15:08:40 27 4
gpt4 key购买 nike

我正在尝试过滤命令的输出,例如 lm 的输出太长。

类似于 lm | find "some_string" 的东西.

windbg 支持吗?我在网上找不到任何关于它的文件。

最佳答案

我通常使用 .shell命令,可以使用 Windows 工具(如 findstr)或使用 cygwin 安装的二进制文件。 .shell command help from MSDN

例子 :

Windbg 版本,尽管这也适用于旧版本:

0:000> version
[snip]
Microsoft (R) Windows Debugger Version 10.0.14321.1024 X86
Copyright (c) Microsoft Corporation. All rights reserved.

开始记事本
0:000> |
. 0 id: 31a0 create name: notepad.exe

列出模块:
0:000> lm
start end module name
00030000 0006e000 notepad (deferred)
52270000 52280000 FeClient (deferred)
6d360000 6d4af000 PROPSYS (deferred)
6f650000 6f879000 iertutil (deferred)
6f880000 6fa14000 urlmon (deferred)
73c40000 73c5b000 bcrypt (deferred)
73dc0000 73e2a000 WINSPOOL (deferred)
73ee0000 740ea000 COMCTL32 (deferred)
74130000 7413a000 CRYPTBASE (deferred)
74140000 7415e000 SspiCli (deferred)
746b0000 7472b000 msvcp_win (deferred)
74730000 7488f000 USER32 (deferred)
74890000 74970000 KERNEL32 (deferred)
749d0000 74a58000 shcore (deferred)
[snip]

使用 window findstr使用“kern”获取所有模块(不区分大小写)
0:000> .shell -ci "lm" findstr /i kern
74890000 74970000 KERNEL32 (deferred)
76ac0000 76acd000 kernel_appcore (deferred)
77530000 776d1000 KERNELBASE (deferred)
.shell: Process exited

与 grep.exe 相同(来自 cygwin,在我的 %PATH% 中)
0:000> .shell -ci "lm" grep.exe -i kern
74890000 74970000 KERNEL32 (deferred)
76ac0000 76acd000 kernel_appcore (deferred)
77530000 776d1000 KERNELBASE (deferred)
.shell: Process exited

[编辑]

这个命令非常强大,因为您可以轻松地将 windbg 的命令输出发送到脚本解释器(我在工作中经常使用 python):
.shell -ci "<windbg command>" python mypythonscript.py

关于windbg - 过滤windbg的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42153409/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com