Hacking Mac OS X - Black Hat
Hacking Mac OS X - Black Hat
Hacking Mac OS X - Black Hat
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Memory Tracer<br />
pid$target::malloc:entry,<br />
pid$target::valloc:entry<br />
{<br />
allocation = arg0;<br />
}<br />
pid$target::realloc:entry<br />
{<br />
allocation = arg1;<br />
}<br />
pid$target::calloc:entry<br />
{<br />
allocation = arg0 * arg1;<br />
}<br />
pid$target::calloc:return,<br />
pid$target::malloc:return,<br />
pid$target::valloc:return,<br />
pid$target::realloc:return<br />
/allocation > 300 && allocation < 9000/<br />
{<br />
printf("m: 0x%x (0x%x)\n", arg1, allocation);<br />
mallocs[arg1] = allocation;<br />
}<br />
pid$target::free:entry<br />
/mallocs[arg0]/<br />
{<br />
printf("f: 0x%x (0x%x)\n", arg0, mallocs[arg0]);<br />
mallocs[arg0] = 0;<br />
}