I have a process that spawns a helper process. Sometimes I need to debug startup errors 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.
Image File Execution Options
ntsd -o
Use gdb --wait. For example, try
gdb --wait TextEdit
from the command line, then run TextEdit.
I do not think you can run gdb in the same way. Instead, start the parent process from gdb or attach it to the running process before it disables the helper. There is a parameter called follow-fork-mode that determines which process follows the debugger. See the GDB Handbook for a nice description.
follow-fork-mode
If you use startd to start processes, that is, WaitForDebugger logical key that is included in the job plist file. If so, then startd waits (surprisingly!) For the debugger to execute exec() the job.
WaitForDebugger
exec()