0

Is there any way to parse the output of WinDbg and set a "trigger" on a specific line of output? I mean - executing a line of WinDbg script / pykd script when a specific line of output appears.

I've tried performing this using WinDbg scripting, but I was unsuccessful.

golosovsky
  • 638
  • 1
  • 6
  • 19

2 Answers2

2

with pykd you can try make your own eventHandler:

class outputHandler(pykd.eventHandler):

     def onDebugOutput(self, str):
          if str == "something interesting":
              do_handler()

eh = outputHandler()

Then you should run you script with 'global' interpreter:

!py -g my_script.py

I hope it will work

ussrhero
  • 161
  • 1
  • 3
1

If you want to control the debugger using OutputDebugString(), then have a look at .ocommand.

Otherwise I'm not aware of something that could directly achieve what you want. You could write a PyKD script that runs forever and emulates the command prompt. You could then use dbgCommand() to execute the command and get the result back as a string. Forward it to the output and analyze it in order to run a script.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • Thomas, could you please explain what you mean by "a PyKD script that runs forever and emulates the command prompt"? Thank you very much for the answer. – golosovsky Sep 09 '17 at 16:53