Page MenuHomeFreeBSD

ddb: add ability to print user registers
ClosedPublic

Authored by mhorne on Dec 21 2020, 8:52 PM.

Details

Summary

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.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

sys/ddb/db_print.c
62

s/kdb_frame/kdb_thread/?

bcr added a subscriber: bcr.

OK from manpages.

It's a bit odd in that this doesn't always show user registers, but that is ok. It might be worth documenting that this really just shows the previous trap frame's registers.

This revision is now accepted and ready to land.Dec 30 2020, 10:17 PM

Fix typo, kdb_frame -> kdb_thread. Make it a little clearer that this is the
previous trapframe and not necissarily the user trapframe.

This revision now requires review to proceed.Jan 4 2021, 2:49 PM
This revision is now accepted and ready to land.Jan 4 2021, 3:13 PM
This revision was automatically updated to reflect the committed changes.