I am debugging a windows component and want to view all the functions of a particular dll that are called (also in the exact order they are called). I can do this by attaching the component to windbg and setting breakpoints over all the exported functions (bm *module_name!*
) of the dll in question.
This works as expected. Whenever an exported function of that dll is called windbg breaks the execution and prints on the screen information about the breakpoint that is hit. After that I can manually resume execution by pressing F5 or giving the go command.
The problem: Some functions of the dll have to return very quickly (immediately) else the component crashes. In that case the breakpoint causes the component to crash. I can remove the breakpoint in question but then there would be no log of it being hit.
I looked around and found that I can run a command whenever a breakpoint is hit. bm module_name!func_name ".printf \"func_name\n\";gc"
But this is not feasible for every exported function. The dll has about a few 100 exported functions.
What can I do to log (on the screen itself) every exported function that is hit (even the breakpoint number would do if nothing else can be done). Is there a variable name I can use in the printf
command that can print the function name (or the breakpoint number if not the function name)?
.kframes=1;bm *modulename!* "kb;gc"
, this will set the call stack to 1, for every breakpoint hit it will dump just the first call which will be the function hit but you will get a lot of hits though – VariorumNumeric expression missing from '=1;bm *modulename!* "kb;gc"'
– Gregale"kb;gc"
will do that, if this is too verbose and you just want the function name then.kframes=0n1
will set the call stack depth to 1, sorry I had a typo in my original comment – Variorum.kframes=0n1
? – Gregale.kframes=0n1
before you enter the command to set the breakpoints – Variorum.kframes 1
sets the call stack to a depth of 1, this will reduce the verbosity of the call stacks being displayed – Variorumk
commands actually take a count argument, so you don't necessarily need to run.kframes
first:bm blah "k 1;gc"
– LudwickFrameCount: Specifies the number of stack frames to display.
– Ludwick