I also did not find that it is documented, but noticed that Instruments supports recording the size of the user stack. Using the dtrace export, I defined it using the ustackdepth built-in variable.
For example, this script will start recording all method calls after calling the -abortEditing method, with a depth of up to 2 calls:
#!/usr/sbin/dtrace -s #pragma D option quiet objc$target::*abortEditing*:entry /thread == 0/ { start = ustackdepth; thread = tid; } objc$target:::entry /thread == tid && ustackdepth - start < 2/ { printf("%*s %s %s\n", ustackdepth - start + 3, "->", probemod, probefunc); } objc$target:::return /thread == tid && start == ustackdepth/ { thread = 0; }
source share