From owner-svn-src-head@freebsd.org Sat Oct 20 20:45:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F8F6FF52A5; Sat, 20 Oct 2018 20:45:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 250A087556; Sat, 20 Oct 2018 20:45:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B5DA23309; Sat, 20 Oct 2018 20:45:50 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9KKjnqF013590; Sat, 20 Oct 2018 20:45:49 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9KKjnMa013588; Sat, 20 Oct 2018 20:45:49 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201810202045.w9KKjnMa013588@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 20 Oct 2018 20:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339486 - in head: share/man/man4 sys/ddb X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man4 sys/ddb X-SVN-Commit-Revision: 339486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Oct 2018 20:45:50 -0000 Author: cem Date: Sat Oct 20 20:45:49 2018 New Revision: 339486 URL: https://svnweb.freebsd.org/changeset/base/339486 Log: ddb: Enable 'thread
' Currently, the 'thread' command (to switch the debugger to another thread) only accepts decimal-encoded tids. Use the same parsing logic as 'show thread ' to accept hex-encoded thread pointers in addition to decimal-encoded tids. Document the 'thread' command in ddb.4 and expand the 'show thread' documentation to cover the tid usage. Reported by: bwidawsk Reviewed by: bwidawsk (earlier version), kib (earlier version), markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D16962 Modified: head/share/man/man4/ddb.4 head/sys/ddb/db_command.c head/sys/ddb/db_thread.c Modified: head/share/man/man4/ddb.4 ============================================================================== --- head/share/man/man4/ddb.4 Sat Oct 20 20:41:25 2018 (r339485) +++ head/share/man/man4/ddb.4 Sat Oct 20 20:45:49 2018 (r339486) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 7, 2018 +.Dd September 21, 2018 .Dt DDB 4 .Os .Sh NAME @@ -1013,13 +1013,17 @@ For exact interpretation of output, visit 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 @@ rather than a traditional memory dump or minidump. 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 Modified: head/sys/ddb/db_command.c ============================================================================== --- head/sys/ddb/db_command.c Sat Oct 20 20:41:25 2018 (r339485) +++ head/sys/ddb/db_command.c Sat Oct 20 20:45:49 2018 (r339486) @@ -145,7 +145,7 @@ static struct command db_cmds[] = { { "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 }, Modified: head/sys/ddb/db_thread.c ============================================================================== --- head/sys/ddb/db_thread.c Sat Oct 20 20:41:25 2018 (r339485) +++ head/sys/ddb/db_thread.c Sat Oct 20 20:45:49 2018 (r339486) @@ -55,20 +55,10 @@ void 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) {