Skip to content

Instantly share code, notes, and snippets.

@AlainODea
Created March 23, 2014 17:15
Show Gist options
  • Save AlainODea/9726316 to your computer and use it in GitHub Desktop.
Save AlainODea/9726316 to your computer and use it in GitHub Desktop.
Using DTrace to stop (freeze, but not kill) a program when it runs ld (used to debug GHC issues)
#!/usr/sbin/dtrace -s
#pragma D option destructive
syscall::exec*:entry
/copyinstr(arg0) == "/usr/bin/ld"/
{
trace(pid);
stop();
system("pargs %d", pid);
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment