Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set breakpoints in windbg that does not stop the execution of the program just logs the function called

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

like image 637
tmj Avatar asked Oct 07 '14 10:10

tmj


1 Answers

Figured it out. Thanks to EdChum.

The command: bm *module_name!* ".frame;gc"

like image 77
tmj Avatar answered Oct 14 '22 04:10

tmj