Author: cem
Date: Thu Apr  2 20:47:51 2020
New Revision: 359581
URL: https://svnweb.freebsd.org/changeset/base/359581

Log:
  ddb(4): show lockchain: Don't dereference LK_KERNPROC
  
  Also, print a little more information for otherwise unhandled inhibited 
states.
  
  Finally, improve the grammar of some prints.  Some of the print statements
  missing verb.
  
  Sponsored by: Dell EMC Isilon

Modified:
  head/sys/kern/subr_turnstile.c

Modified: head/sys/kern/subr_turnstile.c
==============================================================================
--- head/sys/kern/subr_turnstile.c      Thu Apr  2 20:06:37 2020        
(r359580)
+++ head/sys/kern/subr_turnstile.c      Thu Apr  2 20:47:51 2020        
(r359581)
@@ -1180,17 +1180,21 @@ print_lockchain(struct thread *td, const char *prefix)
         * blocked on a lock that has an owner.
         */
        while (!db_pager_quit) {
-               db_printf("%sthread %d (pid %d, %s) ", prefix, td->td_tid,
+               if (td == (void *)LK_KERNPROC) {
+                       db_printf("%sdisowned (LK_KERNPROC)\n", prefix);
+                       return;
+               }
+               db_printf("%sthread %d (pid %d, %s) is ", prefix, td->td_tid,
                    td->td_proc->p_pid, td->td_name);
                switch (td->td_state) {
                case TDS_INACTIVE:
-                       db_printf("is inactive\n");
+                       db_printf("inactive\n");
                        return;
                case TDS_CAN_RUN:
-                       db_printf("can run\n");
+                       db_printf("runnable\n");
                        return;
                case TDS_RUNQ:
-                       db_printf("is on a run queue\n");
+                       db_printf("on a run queue\n");
                        return;
                case TDS_RUNNING:
                        db_printf("running on CPU %d\n", td->td_oncpu);
@@ -1218,7 +1222,7 @@ print_lockchain(struct thread *td, const char *prefix)
                                td = owner;
                                break;
                        }
-                       db_printf("inhibited\n");
+                       db_printf("inhibited: %s\n", KTDSTATE(td));
                        return;
                default:
                        db_printf("??? (%#x)\n", td->td_state);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to