Skip to content

Instantly share code, notes, and snippets.

@jclulow
Created November 13, 2019 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jclulow/f2fcb50e6092fa84869eab75b4fa7a56 to your computer and use it in GitHub Desktop.
Save jclulow/f2fcb50e6092fa84869eab75b4fa7a56 to your computer and use it in GitHub Desktop.
#!/usr/sbin/dtrace -qCs
#define FC_OBJERR 0x5 /* underlying object returned errno value */
#define FC_CODE(fc) ((fc) & 0xff)
#define FC_ERRNO(fc) ((unsigned)(fc) >> 8)
BEGIN
{
printf("tracing...\n");
}
fbt::trap:entry
{
self->t = 1;
}
fbt:::return
/self->t && FC_CODE(arg1) == FC_OBJERR && FC_ERRNO(arg1) == ENOMEM/
{
printf("%Y: %s:\n", walltimestamp, probefunc);
stack();
printf("\n");
}
fbt::trap:return
/self->t/
{
self->t = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment