WinDBG 的命令分类?

5
我看到了一些关于WinDBG命令的参考和教程。其中一些命令如lm.echo!runningnt!_PDB
这些命令分类有什么区别?
  • xxx
  • .xxx
  • !xxx
  • xxx!yyy
它们看起来很混乱。

有关部分答案,请参见此问题 - Sean Cline
2个回答

13

有内置命令、元命令(点命令)和扩展命令(叹号命令)。

我个人的看法是,你不需要过多关注内置命令与元命令之间的区别,因为有足够的例子表明这些定义不匹配。了解它们一直存在且不需要加载扩展就足够了。

内置命令的好例子主要涉及控制和获取调试目标信息:

g - go
k - call stack
~ - list threads

在我看来,下面这些例子并不真正符合这个定义:

version    - show version of the debugger
vercommand - show command line that was used to start the debugger
n          - set number base

适用于元命令的良好示例,这些命令旨在仅影响调试器而不影响目标:

.cls        - clear screen
.chain      - display loaded extensions
.effmach    - change behavior of the debugger regarding the architecture
.prefer_dml - change output format

以下是我个人看法,认为这个定义并不完全正确的示例:

.lastevent  - show last exception or event that occurred (in the target)
.ttime      - display thread times (of the target)
.call       - call a function (in the target)
.dvalloc    - allocate memory (in the target)

然而,了解扩展命令的不同是很好的,尤其是因为相同的命令可能会导致不同的输出,这取决于加载哪个扩展或哪个扩展先出现在扩展列表中,并且您可以影响顺序(例如通过 .load.unload.setdll)。除了简单的形式 !command 之外,还请注意存在显式指定扩展的语法 !extension.command。我将在下面的示例中使用它。(甚至有 !c:\path\to\extension.command

扩展命令冲突的例子来自内核调试会话,其中一个 !heap 不提供任何输出,而另一个明显需要参数才能工作。

0: kd> !ext.heap
0: kd> !exts.heap
Invalid type information
您问题中提到的最后一种格式(xxx!yyy)并不是一个命令,而是一个方法或类型信息。其中,xxx代表模块(DLL),而yyy代表方法或类型名称。通常,在方法内的位置还会有一个额外的字节偏移量(xxx!yyy+0xhhh)。

好的回答。很高兴你指出了内置命令和元命令之间实际上没有严格的区别。还有许多其他例子,这些类型的命令也不符合它们的分类。 - user1354557

2
请看下面内容:
xxx - these are built in commands
.xxx - these are meta commands
!xxx - these are extension commands, so they call a command from an extension dll
xxx!yyy - this looks the syntax to reference an exported function from a dll:

<dll_name>!<method_name>

你可能会发现以下内容有用:http://windbg.info/doc/1-common-cmds.html。这是关于IT技术的常见命令的文档,可以帮助你更好地理解和应用相关知识。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接