In ddb ps, left justify the non-numeric fields 'state' and 'wmesg' and

the fixed-width numeric field 'wchan', as in ps(1).  They were sort
of centered, although the template shows 'state' as right-justified.
The `wmesg' field very rarely has a prefix of '*' (for lock names)
that is still to the left of the header, and the width of this field
is reduced from 8 to 7 (more than 6 is an error).

The 'wmesg' and 'wchan' fields are still misnamed and poorly handled.
They are named sort of backwards relative to ps(1):
- wmesg in ddb = mwchan in ps
- wmesg in ddb = wchan in ps (if it is a wait channel name, not a lock name)
- wchan in ddb = nwchan in ps
ddb ps wastes lots of space for the unimportant 'wchan' field (20
columns altogether on 64-bit arches).  ps(1) documents using a
compressed format, but the compression only omits leading nybbles of
0 so it has neveqr worked on arches that put the kernel in the top half
of the address space.  It just avoids wasting space for an 0x prefix.
This commit is contained in:
Bruce Evans 2016-08-14 15:26:40 +00:00
parent cecc0aa9f9
commit 2b7a7ace9e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=304080

View File

@ -69,10 +69,10 @@ DB_SHOW_ALL_COMMAND(procs, db_procs_cmd)
*
* 1 2 3 4 5 6 7
* 1234567890123456789012345678901234567890123456789012345678901234567890
* pid ppid pgrp uid state wmesg wchan cmd
* <pid> <ppi> <pgi> <uid> <stat> < wmesg > < wchan > <name>
* pid ppid pgrp uid state wmesg wchan cmd
* <pid> <ppi> <pgi> <uid> <stat> <wmesg> <wchan > <name>
* <pid> <ppi> <pgi> <uid> <stat> (threaded) <command>
* <tid > <stat> < wmesg > < wchan > <name>
* <tid > <stat> <wmesg> <wchan > <name>
*
* For machines with 64-bit pointers, we expand the wchan field 8 more
* characters.
@ -95,9 +95,9 @@ db_ps(db_expr_t addr, bool hasaddr, db_expr_t count, char *modif)
p = &proc0;
#ifdef __LP64__
db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n");
db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n");
#else
db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n");
db_printf(" pid ppid pgrp uid state wmesg wchan cmd\n");
#endif
while (--np >= 0 && !db_pager_quit) {
if (p == NULL) {
@ -279,15 +279,15 @@ dumpthread(volatile struct proc *p, volatile struct thread *td, int all)
wmesg = "";
wchan = NULL;
}
db_printf("%c%-8.8s ", wprefix, wmesg);
db_printf("%c%-7.7s ", wprefix, wmesg);
if (wchan == NULL)
#ifdef __LP64__
db_printf("%18s ", "");
db_printf("%18s ", "");
#else
db_printf("%10s ", "");
db_printf("%10s ", "");
#endif
else
db_printf("%p ", wchan);
db_printf("%p ", wchan);
if (p->p_flag & P_SYSTEM)
db_printf("[");
if (td->td_name[0] != '\0')