Fix getting (un)linked trace formatting
Don't crash if :dbg started before application

If :dbg is started, use the current handler until it exits
Add support for tracing to file