[launchd-dev] Attaching to launchd via gdb?

Matt DeFoor mattdefoor at gmail.com
Thu Nov 15 12:39:50 PST 2007


Is there a means to attach to and debug launchd? Or to attach to a per
user launchd process? I get the following when logged in as root and
trying to attach to launchd:

(gdb) attach launchd.1
Attaching to program: `/sbin/launchd', process 1.
Unable to attach to process-id 1: Operation not permitted (1).
This request requires that the target process be neither setuid nor
setgid and have the same real userid as the debugger, or that the
debugger be running with administrator privileges.

I'm trying to determine why the call to getpwuid() in
job_postfork_become_user() is failing. Here's a snippet from
system.log:

Nov 15 14:39:35 dc3 com.apple.launchd[1]
(com.apple.launchd.peruser.166128603[1036]): getpwuid("166128603")
failed
Nov 15 14:39:35 dc3 com.apple.launchd[1]
(com.apple.launchd.peruser.166128603[1036]): PID 1002
"authorizationhos" has no account to back it! Real/effective/saved
UIDs
: 0/166128603/0
Nov 15 14:39:35 dc3 com.apple.launchd[1]
(com.apple.launchd.peruser.166128603[1036]): PID 112
"authorizationhos" has no account to back it! Real/effective/saved
UIDs:
 0/166128603/0
Nov 15 14:39:35 dc3 com.apple.launchd[1]
(com.apple.launchd.peruser.166128603[1036]): Exited with exit code: 1
Nov 15 14:39:35 dc3 com.apple.launchd[1]
(com.apple.launchd.peruser.166128603): Throttling respawn: Will start
in 10 seconds

Cheers,
Matt


More information about the launchd-dev mailing list