add stack trace processor and refactor introspection processor to reduce code duplication

@stof Thanks, the formatter looks like a much better way to do it.