While debugging a problem today I wanted to see which options where passed to the linker. I could have used the compiler drivers verbose option, but that would have dislayed a slew of information along with the link line (if anyone knows an environment varaible to limit output, I would love to hear about it). Since the DTraceToolkit comes with the execsnoop script, I decided to use that to limit what was displayed:
$ execsnoop -c ld
UID PID PPID ARGS
100 15576 15575 /usr/ccs/bin/ld -G -dy -z text -Y P,/usr/ccs/lib:/usr/lib -Qy -o .libs/shibby.s
The “-c” option limits output to a specific command. Nice!