Displaying linker options with DTrace


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!

This article was posted by Matty on 2006-01-13 16:49:00 -0400 -0400