Add stacktrace middleware to plugin.
Add tests for stacktrace middleware.

Also, use keywords for stack frame file types instead of strings. This
makes no difference to the client, but keeps things more consistent and
tidier for testing.