Default 'show all procs' to /l. People tend to type 'ps' without modifiers

when providing information about deadlocks. Without the thread info it's
not very useful.
This commit is contained in:
ad 2009-02-04 20:17:58 +00:00
parent b511f1cdcf
commit 563a207d33
2 changed files with 30 additions and 25 deletions

View File

@ -1,6 +1,6 @@
.\" $NetBSD: ddb.4,v 1.121 2009/01/11 16:15:37 skrll Exp $ .\" $NetBSD: ddb.4,v 1.122 2009/02/04 20:17:58 ad Exp $
.\" .\"
.\" Copyright (c) 1997 - 2007 The NetBSD Foundation, Inc. .\" Copyright (c) 1997 - 2009 The NetBSD Foundation, Inc.
.\" All rights reserved. .\" All rights reserved.
.\" .\"
.\" This code is derived from software contributed to The NetBSD Foundation .\" This code is derived from software contributed to The NetBSD Foundation
@ -56,7 +56,7 @@
.\" any improvements or extensions that they make and grant Carnegie Mellon .\" any improvements or extensions that they make and grant Carnegie Mellon
.\" the rights to redistribute these changes. .\" the rights to redistribute these changes.
.\" .\"
.Dd January 11, 2009 .Dd Febuary 2, 2009
.Dt DDB 4 .Dt DDB 4
.Os .Os
.Sh NAME .Sh NAME
@ -645,7 +645,7 @@ Valid modifiers:
.It Cm /n .It Cm /n
show process information in a show process information in a
.Xr ps 1 .Xr ps 1
style format (this is the default). style format.
Information printed includes: process ID, parent process ID, Information printed includes: process ID, parent process ID,
process group, UID, process status, process flags, process process group, UID, process status, process flags, process
command name, and process wait channel message. command name, and process wait channel message.
@ -662,6 +662,7 @@ address, and wait channel message.
.It Cm /l .It Cm /l
show each process' associated LWP information, including each LWP's show each process' associated LWP information, including each LWP's
LID, flags, kernel LWP structure address, u-area, and wait channel. LID, flags, kernel LWP structure address, u-area, and wait channel.
This is the default.
.El .El
.It Ic show arptab .It Ic show arptab
Dump the entire Dump the entire

View File

@ -1,4 +1,4 @@
/* $NetBSD: db_xxx.c,v 1.54 2008/11/25 15:14:07 ad Exp $ */ /* $NetBSD: db_xxx.c,v 1.55 2009/02/04 20:17:58 ad Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1991, 1993 * Copyright (c) 1982, 1986, 1989, 1991, 1993
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.54 2008/11/25 15:14:07 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.55 2009/02/04 20:17:58 ad Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include "opt_aio.h" #include "opt_aio.h"
@ -47,7 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.54 2008/11/25 15:14:07 ad Exp $");
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/msgbuf.h> #include <sys/msgbuf.h>
#include <sys/callout.h> #include <sys/callout.h>
#include <sys/file.h> #include <sys/file.h>
#include <sys/filedesc.h> #include <sys/filedesc.h>
@ -59,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.54 2008/11/25 15:14:07 ad Exp $");
#include <sys/mqueue.h> #include <sys/mqueue.h>
#include <sys/vnode.h> #include <sys/vnode.h>
#include <sys/module.h> #include <sys/module.h>
#include <sys/cpu.h>
#include <machine/db_machdep.h> #include <machine/db_machdep.h>
@ -190,13 +190,15 @@ db_show_all_procs(db_expr_t addr, bool haddr,
db_expr_t count, const char *modif) db_expr_t count, const char *modif)
{ {
const char *mode; const char *mode;
struct proc *p, *pp, *cp; struct proc *p, *pp;
struct lwp *l, *cl; struct lwp *l, *cl;
const struct proclist_desc *pd; const struct proclist_desc *pd;
char db_nbuf[MAXCOMLEN + 1]; char db_nbuf[MAXCOMLEN + 1];
bool run;
int cpuno;
if (modif[0] == 0) if (modif[0] == 0)
mode = "n"; /* default == normal mode */ mode = "l"; /* default == lwp mode */
else else
mode = strchr("mawln", modif[0]); mode = strchr("mawln", modif[0]);
@ -215,8 +217,8 @@ db_show_all_procs(db_expr_t addr, bool haddr,
"COMMAND", "STRUCT PROC *", "UAREA *", "VMSPACE/VM_MAP"); "COMMAND", "STRUCT PROC *", "UAREA *", "VMSPACE/VM_MAP");
break; break;
case 'l': case 'l':
db_printf(" PID %4s S %9s %18s %18s %-8s\n", db_printf("PID %4s S %3s %9s %18s %18s %-8s\n",
"LID", "FLAGS", "STRUCT LWP *", "NAME", "WAIT"); "LID", "CPU", "FLAGS", "STRUCT LWP *", "NAME", "WAIT");
break; break;
case 'n': case 'n':
db_printf("PID %8s %8s %10s S %7s %4s %16s %7s\n", db_printf("PID %8s %8s %10s S %7s %4s %16s %7s\n",
@ -229,9 +231,7 @@ db_show_all_procs(db_expr_t addr, bool haddr,
break; break;
} }
/* XXX LOCKING XXX */
pd = proclists; pd = proclists;
cp = curproc;
cl = curlwp; cl = curlwp;
for (pd = proclists; pd->pd_list != NULL; pd++) { for (pd = proclists; pd->pd_list != NULL; pd++) {
LIST_FOREACH(p, pd->pd_list, p_list) { LIST_FOREACH(p, pd->pd_list, p_list) {
@ -240,7 +240,7 @@ db_show_all_procs(db_expr_t addr, bool haddr,
continue; continue;
} }
l = LIST_FIRST(&p->p_lwps); l = LIST_FIRST(&p->p_lwps);
db_printf("%c%-10d", (cp == p ? '>' : ' '), p->p_pid); db_printf("%-5d", p->p_pid);
switch (*mode) { switch (*mode) {
@ -260,9 +260,15 @@ db_show_all_procs(db_expr_t addr, bool haddr,
snprintf(db_nbuf, snprintf(db_nbuf,
sizeof(db_nbuf), sizeof(db_nbuf),
"%s", p->p_comm); "%s", p->p_comm);
db_printf("%c%4d %d %9x %18lx %18s %-8s\n", run = (l->l_stat == LSONPROC ||
(cl == l ? '>' : ' '), l->l_lid, (l->l_pflag & LP_RUNNING) != 0);
l->l_stat, l->l_flag, (long)l, if (l->l_cpu != NULL)
cpuno = cpu_index(l->l_cpu);
else
cpuno = -1;
db_printf("%c%4d %d %3d %9x %18lx %18s %-8s\n",
(run ? '>' : ' '), l->l_lid,
l->l_stat, cpuno, l->l_flag, (long)l,
db_nbuf, db_nbuf,
(l->l_wchan && l->l_wmesg) ? (l->l_wchan && l->l_wmesg) ?
l->l_wmesg : ""); l->l_wmesg : "");
@ -291,10 +297,8 @@ db_show_all_procs(db_expr_t addr, bool haddr,
(l->l_wchan && l->l_wmesg) ? (l->l_wchan && l->l_wmesg) ?
l->l_wmesg : "", (long)l->l_wchan); l->l_wmesg : "", (long)l->l_wchan);
l = LIST_NEXT(l, l_sibling); l = LIST_NEXT(l, l_sibling);
if (l != NULL) { if (l)
db_printf("%c%-10d", (cp == p ? db_printf("%11s","");
'>' : ' '), p->p_pid);
}
} }
break; break;
} }