Search code examples
debuggingmacoschild-process

How does one automatically attach a debugger to a process at process start on OS X?


I have a process that spawns a helper process. Sometimes I need to debug start-up failures in the second process.

On Windows, I would use Image File Execution Options, or ntsd -o. However, I have no idea how to do this with GDB on OS X.


Solution

  • Use gdb --wait. For example, try

    gdb --wait TextEdit
    

    from the command line, and then launch TextEdit.