Hi,

(manual "copypaste"):
nc2k4hp# sysctl ddb.trigger=1
Stopped at      db_enter+0x4:   popl    %ebp
ddb{0}> print/x "eax = " $eax "\necx = " $ecx "\n"
        3
ddb{0}> c
ddb.trigger: 0 -> 1

so, for reasons yet unknown to me, p[rint] doesn't seem to work at all
like described in the man page, tested on i386.
Should it work? I hope it would.

There's not much comments in sys/ddb/, so I don't think it's worth my
time to learn how to fix this.

For the lack of it, I came up with following diff, which is obviously
no replacement for p[rint] with support for strings and usability
without building&booting a kernel for it.. but it was usable for me,
fwiw.:)

-Artturi


You have mail.
av7cubieb# sysctl ddb.trigger=1                                         
Stopped at      db_enter:       ldrb    r15, [r15, r15, ror r15]!
ddb> p $ppres
       1
ddb> show struct sxitimer_registers sxitimer_regs
struct sxitimer_regs at 0xc080d450 (144 bytes) {timer_ier = 0xcc389c00, timer_i
sr = 0x2dc6c, __reserved_0 = 0, timer_ctrl0 = 0xa1, timer_intv0 = 0xa1, timer_c
urr0 = 0x0, __reserved_1 = 0xc, timer_ctrl1 = 0x0, timer_intv1 = 0xc07485c4, ti
mer_curr1 = 0x0, __reserved_2 = 0x0, timer_ctrl2 = 0xc080d47c, timer_intv2 = 0x
c6110fc8, timer_curr2 = 0xc6110fc8, __reserved_3 = 0xc5c70fc8, timer_ctrl3 = 0x
c600efc8, timer_intv3 = 0xc5c70fc8, timer_curr3 = 0x38, __reserved_4 = 0x0, tim
er_ctrl4 = 0x0, timer_intv4 = 0x8, timer_curr4 = 0xc, __reserved_5 = 0x48, time
r_ctrl5 = 0x0, timer_intv5 = 0x360, timer_curr5 = 0x281, __reserved_6 = 0xfffff
fff, __reserved_7 = 1, avs_cnt_ctrl = 0xc0747dc4, avs_cnt0 = 0x0, avs_cnt1 = 0x
c, avs_cnt_div = 0x0}
ddb> set $ppres = 0
ddb> p $ppres
       0
ddb> show struct sxitimer_registers sxitimer_regs
struct sxitimer_regs at 0xc080d450 (144 bytes) {timer_ier = 0xcc389c00, timer_i
sr = 0x2dc6c, timer_ctrl0 = 0xa1, timer_intv0 = 0xa1, timer_curr0 = 0x0, timer_
ctrl1 = 0x0, timer_intv1 = 0xc07485c4, timer_curr1 = 0x0, timer_ctrl2 = 0xc080d
47c, timer_intv2 = 0xc6110fc8, timer_curr2 = 0xc6110fc8, timer_ctrl3 = 0xc600ef
c8, timer_intv3 = 0xc5c70fc8, timer_curr3 = 0x38, timer_ctrl4 = 0x0, timer_intv
4 = 0x8, timer_curr4 = 0xc, timer_ctrl5 = 0x0, timer_intv5 = 0x360, timer_curr5
 = 0x281, avs_cnt_ctrl = 0xc0747dc4, avs_cnt0 = 0x0, avs_cnt1 = 0xc, avs_cnt_di
v = 0x0}
ddb> c
ddb.trigger: 0 -> 1
av7cubieb# 

/* what i used for the example */
struct sxitimer_registers {
        uint32_t        timer_ier;              /* 0x00 */
        uint32_t        timer_isr;              /* 0x04 */
        uint32_t        __reserved_0[2];        /* 0x08-0x0c */
        uint32_t        timer_ctrl0;            /* 0x10 */
        uint32_t        timer_intv0;            /* 0x14 */
        uint32_t        timer_curr0;            /* 0x18 */
        uint32_t        __reserved_1;           /* 0x1c */
        uint32_t        timer_ctrl1;            /* 0x20 */
        uint32_t        timer_intv1;            /* 0x24 */
        uint32_t        timer_curr1;            /* 0x28 */
        uint32_t        __reserved_2;           /* 0x2c */
        uint32_t        timer_ctrl2;            /* 0x30 */
        uint32_t        timer_intv2;            /* 0x34 */
        uint32_t        timer_curr2;            /* 0x38 */
        uint32_t        __reserved_3;           /* 0x3c */
        uint32_t        timer_ctrl3;            /* 0x40 */
        uint32_t        timer_intv3;            /* 0x44 */
        uint32_t        timer_curr3;            /* 0x48 */
        uint32_t        __reserved_4;           /* 0x4c */
        uint32_t        timer_ctrl4;            /* 0x50 */
        uint32_t        timer_intv4;            /* 0x54 */
        uint32_t        timer_curr4;            /* 0x58 */
        uint32_t        __reserved_5;           /* 0x5c */
        uint32_t        timer_ctrl5;            /* 0x60 */
        uint32_t        timer_intv5;            /* 0x64 */
        uint32_t        timer_curr5;            /* 0x68 */
        uint32_t        __reserved_6;           /* 0x6c */
        uint32_t        __reserved_7[4];        /* 0x70-0x7c */
        uint32_t        avs_cnt_ctrl;           /* 0x80 */
        uint32_t        avs_cnt0;               /* 0x84 */
        uint32_t        avs_cnt1;               /* 0x88 */
        uint32_t        avs_cnt_div;            /* 0x8c */
};



diff --git share/man/man4/ddb.4 share/man/man4/ddb.4
index 02ff2fd78a6..acd41000bd4 100644
--- share/man/man4/ddb.4
+++ share/man/man4/ddb.4
@@ -1132,6 +1132,12 @@ This is used by the
 feature.
 .It Va $tabstops
 Tab stop width.
+.It Va $ppres
+Controls whether the output of
+.Ic show struct
+is filtered for members of the structure with "__reserved_" prefix in
+the member name.
+This filtering is disabled by default.
 .It Va $log
 Controls whether the output of
 .Nm
diff --git sys/ddb/db_ctf.c sys/ddb/db_ctf.c
index 5671d5c96d6..588f0cd10ea 100644
--- sys/ddb/db_ctf.c
+++ sys/ddb/db_ctf.c
@@ -31,6 +31,7 @@
 #include <ddb/db_output.h>
 #include <ddb/db_sym.h>
 #include <ddb/db_access.h>
+#include <ddb/db_var.h>
 
 #include <sys/exec_elf.h>
 #include <sys/ctf.h>
@@ -49,6 +50,8 @@ struct ddb_ctf {
        uint32_t                 ctf_found;
 };
 
+int    db_pprint_reserved = 1;         /* pprint "__reserved_*" */
+
 struct ddb_ctf db_ctf;
 
 static const char      *db_ctf_off2name(uint32_t);
@@ -422,6 +425,9 @@ db_ctf_pprint_struct(const struct ctf_type *ctt, vaddr_t 
addr)
                        toff += sizeof(struct ctf_member);
 
                        name = db_ctf_off2name(ctm->ctm_name);
+                       if (name != NULL && db_pprint_reserved == 0)
+                               if (strncmp(name, "__reserved_", 11) == 0)
+                                       continue;
                        if (name != NULL)
                                db_printf("%s = ", name);
                        ref = db_ctf_type_by_index(ctm->ctm_type);
@@ -437,6 +443,9 @@ db_ctf_pprint_struct(const struct ctf_type *ctt, vaddr_t 
addr)
                        toff += sizeof(struct ctf_lmember);
 
                        name = db_ctf_off2name(ctlm->ctlm_name);
+                       if (name != NULL && db_pprint_reserved == 0)
+                               if (strncmp(name, "__reserved_", 11) == 0)
+                                       continue;
                        if (name != NULL)
                                db_printf("%s = ", name);
                        ref = db_ctf_type_by_index(ctlm->ctlm_type);
diff --git sys/ddb/db_var.h sys/ddb/db_var.h
index 3bb02b5d34d..5c3c16af890 100644
--- sys/ddb/db_var.h
+++ sys/ddb/db_var.h
@@ -63,6 +63,7 @@
 extern int     db_radix;
 extern int     db_max_width;
 extern int     db_tab_stop_width;
+extern int     db_pprint_reserved;
 extern int     db_max_line;
 extern int     db_panic;
 extern int     db_console;
diff --git sys/ddb/db_variables.c sys/ddb/db_variables.c
index 3e3f41b3ac7..e05f52c614c 100644
--- sys/ddb/db_variables.c
+++ sys/ddb/db_variables.c
@@ -44,6 +44,7 @@ struct db_variable db_vars[] = {
        { "maxoff",     (long *)&db_maxoff, db_var_rw_int },
        { "maxwidth",   (long *)&db_max_width, db_var_rw_int },
        { "tabstops",   (long *)&db_tab_stop_width, db_var_rw_int },
+       { "ppres",      (long *)&db_pprint_reserved, db_var_rw_int },
        { "lines",      (long *)&db_max_line, db_var_rw_int },
        { "log",        (long *)&db_log, db_var_rw_int }
 };

Reply via email to