Page MenuHomeFreeBSD

D16603.id46330.diff
No OneTemporary

D16603.id46330.diff

Index: share/man/man4/ddb.4
===================================================================
--- share/man/man4/ddb.4
+++ share/man/man4/ddb.4
@@ -537,13 +537,16 @@
cached stack address.
Otherwise, prints nothing.
.Pp
-.It Ic show Cm all procs Ns Op Li / Ns Cm m
-.It Ic ps Ns Op Li / Ns Cm m
+.It Ic show Cm all procs Ns Op Li / Ns Cm am
+.It Ic ps Ns Op Li / Ns Cm am
Display all process information.
The process information may not be shown if it is not
supported in the machine, or the bottom of the stack of the
target process is not in the main memory at that time.
The
+.Cm a
+modifier will print command line arguments for each process.
+The
.Cm m
modifier will alter the display to show VM map
addresses for the process and not show other information.
Index: sys/ddb/db_ps.c
===================================================================
--- sys/ddb/db_ps.c
+++ sys/ddb/db_ps.c
@@ -50,8 +50,13 @@
#include <ddb/ddb.h>
+#define PRINT_NONE 0
+#define PRINT_ARGS 1
+
static void dumpthread(volatile struct proc *p, volatile struct thread *td,
int all);
+static int ps_mode;
+
/*
* At least one non-optional show-command must be implemented using
* DB_SHOW_ALL_COMMAND() so that db_show_all_cmd_set gets created.
@@ -62,6 +67,19 @@
db_ps(addr, have_addr, count, modif);
}
+static void
+dump_args(volatile struct proc *p)
+{
+ char *args = p->p_args->ar_args;
+ int i, len = (int)p->p_args->ar_length;
+ for (i = 0; i < len; i++) {
+ if (args[i] == '\0')
+ db_printf(" ");
+ else
+ db_printf("%c", args[i]);
+ }
+}
+
/*
* Layout:
* - column counts
@@ -90,6 +108,12 @@
char state[9];
int np, rflag, sflag, dflag, lflag, wflag;
+ if (modif[0] == 'a') {
+ ps_mode = PRINT_ARGS;
+ } else {
+ ps_mode = PRINT_NONE;
+ }
+
np = nprocs;
if (!LIST_EMPTY(&allproc))
@@ -207,6 +231,9 @@
db_printf("%s", p->p_comm);
if (p->p_flag & P_SYSTEM)
db_printf("]");
+ if (ps_mode == PRINT_ARGS && p->p_args != NULL) {
+ dump_args(p);
+ }
db_printf("\n");
}
FOREACH_THREAD_IN_PROC(p, td) {
@@ -299,6 +326,9 @@
db_printf("%s", td->td_proc->p_comm);
if (p->p_flag & P_SYSTEM)
db_printf("]");
+ if (ps_mode == PRINT_ARGS && all == 0 && p->p_args != NULL) {
+ dump_args(p);
+ }
db_printf("\n");
}
@@ -445,12 +475,7 @@
db_printf(" ABI: %s\n", p->p_sysent->sv_name);
if (p->p_args != NULL) {
db_printf(" arguments: ");
- for (i = 0; i < (int)p->p_args->ar_length; i++) {
- if (p->p_args->ar_args[i] == '\0')
- db_printf(" ");
- else
- db_printf("%c", p->p_args->ar_args[i]);
- }
+ dump_args(p);
db_printf("\n");
}
db_printf(" repear: %p reapsubtree: %d\n",

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 11:37 PM (11 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15599548
Default Alt Text
D16603.id46330.diff (2 KB)

Event Timeline