The debugger is always entered for the first time via breakpoint in
kdb_enter(). This means that the most recent trapframe will include
kernel state at the time of the breakpoint instruction, when often it is
desirable to the developer to view the contents of the previous
trapframe. This usually (always?) corresponds to the entry from
userspace.
I discovered that the ddb(4) man page claims this is already supported,
via the 'u' modifier to show registers. It may have been at one time,
but I found no evidence of this now, nor could I find exactly when it
might have been removed. Implement this in an architecture agnostic way,
by temporarily swapping out kdb_thread for the body of the db_show_regs
function.