In windbg, How to set breakpoint on all functions in kernel32.dll?
Asked Answered
E

3

6

I want figure out the call sequence and functions to kernel32.dll in a function example() in example.DLL.

In windbg, how to set breakpoint on all functions in kernel32.dll?

I tried bm kernel32!* , but seems not work.

Ectosarc answered 4/12, 2009 at 17:31 Comment(0)
T
7

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). 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.

Trammel answered 4/12, 2009 at 20:3 Comment(0)
T
7

Setting breakpoints at some low level kernel service DLL call may cause application exceptions.

You may use rohitab's API monitor to observe its DLL calls and then set breakpoints on your interesting calls.

Tonita answered 19/12, 2013 at 9:7 Comment(1)
Thanks for suggesting API Monitor. That is exactly what I was looking for!Craven
O
2

Kernel32 is a heavily used DLL - you'll probably find that breaking on every function is way too noisy. You also don't need to break on every kernel32 function, just the ones it exports.

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!" + the function name to a new file. Then, simply paste the contents of that file into the windbg command window.

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.

Onstage answered 4/12, 2009 at 18:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.