pruneAndDumpStackTo

Dump a stacktrace generated by a user-supplied lambda, but attempt to remove irrelevant lines to the trace. This is a little ugly but seems to work well, there may be a better approach.