What are you trying to do with ImmLib first, and then we might be able to help. So far I have done some code coverage, hooking, fast hooking (thanks Nico), and a few other things. It's quite powerful but much different than PyDBG.
Well, I was wanting to basically intercept all the user commands and do something different. So that if the user hit "step into", my function would get called and I could report what was going on, color the contents of the screen, check for conditions, and possibly step into or do something else entirely.
It would seem I would need to overload the debugger.Stepin() function. It doesn't seem like we have the code for this as it comes in a .pyc, I think. Is it even possible to do what I want to do? If this debugger was written on top of pydbg as opposed to the debugger class, I'd know what to do... Any suggestions?
if I didn't missunderstand it, you want to hook on Single Step.
We dont have specials Single Step hooks (Probably something that we are gonna add in the future), although we do have "All Exception Hook", that combined by getEvent it will give you want you want. Let me do some pseudo code for you:
class SingleStepHook(AllExceptHook):
def __init__(self):
AllExceptHook.__init__(self)
def run(self,regs):
imm = immlib.Debugger()
v_event = imm.getEvent()
if v_event.Exception[0].getType() == "SingleStep":
# SINGLE STEP CODE HERE
imm.Log("SINGLE STEP!"
def main(args):
s = SingleStepHook()
s.add("Hooking_Single_Step")
For more info, check the following info:
Event handling: http://debugger.immunityinc.com/update/Documentation/ref/libevent-module.html
(You can also check PyCommand/getevent.py)
Thanks for the excellent advice. It may be enough fro what I want to do, but its not exactly what I'm looking for. It would give me the ability to "follow along", i.e. get to run code after any debugging event. What I really want to do is to run code after any "user event", I guess GUI events. Suppose I wanted to do something everytime a user set a breakpoint or hit the "continue" button. For example, maybe I want to open a window showing the code with the breakpoint or analyze the next 100 instructions and set a breakpoint at all the "dangerous" ones coming up. These are things I want to do before the breakpoint is actually set or the next event occurs. Is this possible? Thanks again!