简体   繁体   English

在windbg中,如何在kernel32.dll中的所有函数上设置断点?

[英]In windbg, How to set breakpoint on all functions in kernel32.dll?

I want figure out the call sequence and functions to kernel32.dll in a function example() in example.DLL . 我想在example.DLL的函数example()中弄清楚调用序列和函数kernel32.dll。

In windbg, how to set breakpoint on all functions in kernel32.dll? 在windbg中,如何在kernel32.dll中的所有函数上设置断点?

I tried bm kernel32!* , but seems not work. 我试过bm kernel32!* ,但似乎不行。

I would not do just as stated. 我不会像上述那样做。 Of course it is possible, but if done with bm /a kernel32!* you inadvertently set bps also on data symbols (as opposed to actual functions). 当然有可能,但如果用bm /a kernel32!*完成,你无意中也会在数据符号上设置bps(而不是实际函数)。 In your case wt - trace and watch data (you can look it up in the debugger.chm provided with your windbg package) might be what you're after. 在您的情况下, wt - trace和监视数据(您可以在随windbg包提供的debugger.chm中查找)可能就是您所追求的。

Setting breakpoints at some low level kernel service DLL call may cause application exceptions. 在某些低级内核服务DLL调用中设置断点可能会导致应用程序异常。

You may use rohitab's API monitor to observe its DLL calls and then set breakpoints on your interesting calls. 您可以使用rohitab的API监视器来观察其DLL调用,然后在您有趣的调用上设置断点。

Kernel32 is a heavily used DLL - you'll probably find that breaking on every function is way too noisy. Kernel32是一个使用频繁的DLL - 你可能会发现打破每个函数都太吵了。 You also don't need to break on every kernel32 function, just the ones it exports. 你也不需要打破每个kernel32函数,只需要输出它们。

If I were you, I'd run "link /dump /exports kernel32.dll", write the outputs to a file, then write a simple script that will grab the function name and write out "bp kernel32!" 如果我是你,我会运行“link / dump / exports kernel32.dll”,将输出写入文件,然后编写一个简单的脚本来获取函数名称并写出“bp kernel32!” + the function name to a new file. +新文件的函数名称。 Then, simply paste the contents of that file into the windbg command window. 然后,只需将该文件的内容粘贴到windbg命令窗口即可。

There is probably a straightforward way to do this with the scripting support in the debuggers, but you could hack the above script together in the time less time it'd take to learn how to do it via debugger scripting. 使用调试器中的脚本支持可能有一种简单的方法来执行此操作,但是您可以在更短的时间内通过调试器脚本来学习如何执行此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM