Refactor Debugger trace/backtrace logic.