Search code examples
windbgbreakpoints

How to debug a child process beyond the initial breakpoint


My app has a.exe which launches b.exe and communicates with it. The sequence is:

  1. a.exe launches b.exe, and waits on an event from b.exe with a 10-second timeout
  2. b.exe starts, registers as a COM server, and signals the event
  3. a.exe calls a method in the COM interface
  4. b.exe interface method is called. <<<<< I want to break here

I want to break in b.exe interface method call. Currently, I do it like this:

  1. Run a.exe under windbg
  2. Enter .childdbg 1
  3. Wait until b.exe starts, and its initial breakpoint breaks.
  4. Set another breakpoint in b.exe and continue. I must do it within 10 seconds, otherwise a.exe will timeout and kill b.exe.

I managed to do it, but the 10-second timeout sometimes passes. Is there a better way to do it?


Solution

  • Reading my question, I found the answer - let the initial breakpoint set the real breakpoint:

    .childdbg 1
    sxe -c "bm b!*MyMethod*;g" ibp
    sxd epr