I need to log some data when some functions are hit, both at the start of execution and and the end of it. While i have no problem with putting breakpoints at the start of the functions(using bu [module]!functionname
, I dont know how to put a breakpoint at the end of a function, SUCH THAT i dont need to edit the breakpoint everytime i add/delete somelines from the file/function. I'm sure its a very common scenario, just that I dont know how its done !! Can anyone elucidate ?
views:
55answers:
2
+2
A:
Here is what you are exactly looking for
Get function return values and profiling information in .NET using Windbg
It is explained how to set a break-point on function return
The same is applicable for native code also.
Hope this helps.
Naveen
2010-04-02 12:30:50
+1
A:
You can use the breakpoint at the start of the function to setup the breakpoint at the return address. Like this:
bu [module]!functionname "bp /1 @$ra \".echo Exit functionname ; g\"; .echo Enter functionname; g"
Caveat: this may not work if an exception is thrown in the function.
plodoc
2010-04-17 21:23:23