문제

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.

도움이 되었습니까?

해결책

Use gdb --wait. For example, try

gdb --wait TextEdit

from the command line, then launch TextEdit.

다른 팁

I don't think that you can have gdb launch in the same manner. Instead, run your parent process from within gdb or attach to the running process before it forks the helper off. There is a setting called follow-fork-mode that controls which process the debugger follows. Take a look at the GDB Manual for a nice description.

If you're using launchd to spawn processes, then there's a WaitForDebugger boolean key which goes in the job's plist file. If it's yes, then launchd waits (surprisingly!) for the debugger before exec()ing the job.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top