cvs commit: src/sys/kern subr_witness.c
John Baldwin
jhb at FreeBSD.org
Tue Dec 28 13:50:50 PST 2004
On Monday 27 December 2004 05:27 pm, Andrew R. Reiter wrote:
> On Mon, 27 Dec 2004, John Baldwin wrote:
> :On Sunday 26 December 2004 07:54 pm, Kris Kennaway wrote:
> :> On Sun, Dec 26, 2004 at 10:52:24PM +0000, Robert Watson wrote:
> :> > rwatson 2004-12-26 22:52:24 UTC
> :> >
> :> > FreeBSD src repository
> :> >
> :> > Modified files:
> :> > sys/kern subr_witness.c
> :> > Log:
> :> > Add "show alllocks" command to DDB, which dumps a list of processes
> :> > and threads currently holding sleep mutexes (and spin mutexes for
> :> > curthread). This can be quite useful in looking for a lock
> :> > condition summary for a system, as it avoids manually iterating
> :> > through threads and processes to find all the interesting locks.
> :> >
> :> > NB: "alllocks" is up there with "lockedvnods" for a bad argument for
> :> > show.
> :>
> :> ITYM "allloks" or perhaps "alllockes" (conservation of vowels).
> :
> :If you want a better name you could do 'show locks /a' instead. That is,
> : add support to 'show locks' for the /a option (see 'show ktr' for how you
> : would handle this by looking at 'modif').
>
> Seems like a good idea to me, John. My only -- very minor -- issue with
> that is using '/' as the flag delimiter. Not trying to be an asshole or
> anything, just seems to me that (unless there is some ddb options already
> there that use '/') using the forward slash is very cmd.exe-esque.
>
> I agree, however, that having show locks <flag-option> is a good idea
> instead of two different commands.
The / is part of ddb itself. Each ddb command (except those that do their own
command line parsing) is called with a variable containing the arguments and
another variable (modif) containing a string of any options specified via /.
For example:
DB_SHOW_COMMAND(ktr, db_ktr_all)
{
int quit;
quit = 0;
tstate.cur = (ktr_idx - 1) & (KTR_ENTRIES - 1);
tstate.first = -1;
if (strcmp(modif, "v") == 0)
db_ktr_verbose = 1;
else
db_ktr_verbose = 0;
if (strcmp(modif, "a") == 0) {
while (cncheckc() != -1)
if (db_mach_vtrace() == 0)
break;
} else {
db_setup_paging(db_simple_pager, &quit, db_lines_per_page);
while (!quit)
if (db_mach_vtrace() == 0)
break;
}
}
This implements 'show ktr' and allows 'show ktr /a' and 'show ktr /v'. Note
that it doesn't handle 'show ktr /av' or 'show ktr /va'. :-)
--
John Baldwin <jhb at FreeBSD.org> <>< http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the cvs-all
mailing list