Index: share/man/man4/ddb.4 =================================================================== --- share/man/man4/ddb.4 +++ share/man/man4/ddb.4 @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 20, 2018 +.Dd August 31, 2018 .Dt DDB 4 .Os .Sh NAME @@ -1013,13 +1013,17 @@ header file. .\" .Pp -.It Ic show Cm thread Op Ar addr +.It Ic show Cm thread Op Ar addr | tid If no .Ar addr +or +.Ar tid is specified, show detailed information about current thread. -Otherwise, information about thread at -.Ar addr -is printed. +Otherwise, print information about the thread with ID +.Ar tid +or kernel address +.Ar addr . +(If the argument is a decimal number, it is assumed to be a tid.) .\" .Pp .It Ic show Cm threads @@ -1249,6 +1253,13 @@ reports whether a textdump has been scheduled. .Ic textdump unset cancels a request to perform a textdump as the next kernel core dump. +.Pp +.It Ic thread Ar addr | tid +Switch the debugger to the thread with ID +.Ar tid , +if the argument is a decimal number, or address +.Ar addr , +otherwise. .El .Sh VARIABLES The debugger accesses registers and variables as Index: sys/ddb/db_command.c =================================================================== --- sys/ddb/db_command.c +++ sys/ddb/db_command.c @@ -145,7 +145,7 @@ { "reset", db_reset, 0, NULL }, { "kill", db_kill, CS_OWN, NULL }, { "watchdog", db_watchdog, CS_OWN, NULL }, - { "thread", db_set_thread, CS_OWN, NULL }, + { "thread", db_set_thread, 0, NULL }, { "run", db_run_cmd, CS_OWN, NULL }, { "script", db_script_cmd, CS_OWN, NULL }, { "scripts", db_scripts_cmd, 0, NULL }, Index: sys/ddb/db_thread.c =================================================================== --- sys/ddb/db_thread.c +++ sys/ddb/db_thread.c @@ -55,20 +55,10 @@ db_set_thread(db_expr_t tid, bool hastid, db_expr_t cnt, char *mod) { struct thread *thr; - db_expr_t radix; int err; - /* - * We parse our own arguments. We don't like the default radix. - */ - radix = db_radix; - db_radix = 10; - hastid = db_expression(&tid); - db_radix = radix; - db_skip_to_eol(); - if (hastid) { - thr = kdb_thr_lookup(tid); + thr = db_lookup_thread(tid, false); if (thr != NULL) { err = kdb_thr_select(thr); if (err != 0) {