From owner-svn-src-head@freebsd.org Wed Sep 25 18:03:16 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37ED312EBA1; Wed, 25 Sep 2019 18:03:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dmBX0g2qz4GTF; Wed, 25 Sep 2019 18:03:16 +0000 (UTC) (envelope-from glebius@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 EE6701B82E; Wed, 25 Sep 2019 18:03:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PI3FRi082613; Wed, 25 Sep 2019 18:03:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PI3Fjw082612; Wed, 25 Sep 2019 18:03:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201909251803.x8PI3Fjw082612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 25 Sep 2019 18:03:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r352702 - head/tools/debugscripts X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/tools/debugscripts X-SVN-Commit-Revision: 352702 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: Wed, 25 Sep 2019 18:03:16 -0000 Author: glebius Date: Wed Sep 25 18:03:15 2019 New Revision: 352702 URL: https://svnweb.freebsd.org/changeset/base/352702 Log: Enhance the 'ps' command so that it prints a line per proc and a line per thread, so that instead of repeating the same info for all threads in proc, it would print thread specific info. Also includes thread number that would match 'info threads' info and can be used as argument for thread swithcing with 'thread' command. Modified: head/tools/debugscripts/gdbinit.kernel Modified: head/tools/debugscripts/gdbinit.kernel ============================================================================== --- head/tools/debugscripts/gdbinit.kernel Wed Sep 25 17:59:58 2019 (r352701) +++ head/tools/debugscripts/gdbinit.kernel Wed Sep 25 18:03:15 2019 (r352702) @@ -199,28 +199,29 @@ define ps set $nproc = nprocs set $aproc = allproc.lh_first set $proc = allproc.lh_first - printf " pid proc uid ppid pgrp flag stat comm wchan\n" + set $tid = 1 + printf "pid/ID ppid/tid uid pgrp flag st comm/name proc/thread\n" while (--$nproc >= 0) set $pptr = $proc.p_pptr if ($pptr == 0) set $pptr = $proc end if ($proc.p_state) + printf " %5d %6d %4d %5d %8x %2d %-10s %p\n", \ + $proc.p_pid, $pptr->p_pid, \ + $proc.p_ucred->cr_ruid, \ + $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_state, \ + &$proc.p_comm[0], $aproc set $thread = $proc->p_threads.tqh_first while ($thread) - printf "%5d %08x %4d %5d %5d %06x %d %-10s ", \ - $proc.p_pid, $aproc, \ - $proc.p_ucred->cr_ruid, $pptr->p_pid, \ - $proc.p_pgrp->pg_id, $proc.p_flag, $proc.p_state, \ - &$proc.p_comm[0] - if ($thread.td_wchan) - if ($thread.td_wmesg) - printf "%s ", $thread.td_wmesg - end - printf "%x", $thread.td_wchan + printf "(%5d) %6d %-10s %p", \ + $tid, $thread->td_tid, $thread->td_name, $thread + if ($thread.td_wmesg) + printf " %s", $thread.td_wmesg end - printf "\n" + printf "\n" set $thread = $thread->td_plist.tqe_next + set $tid = $tid + 1 end end set $aproc = $proc.p_list.le_next