Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/mips/mips add "trace/a" to trace by LWP address.



details:   https://anonhg.NetBSD.org/src/rev/8e85332482c9
branches:  trunk
changeset: 756133:8e85332482c9
user:      chs <chs%NetBSD.org@localhost>
date:      Wed Jul 07 01:22:35 2010 +0000

description:
add "trace/a" to trace by LWP address.

diffstat:

 sys/arch/mips/mips/db_trace.c |  35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 deletions(-)

diffs (63 lines):

diff -r a5202f2100d0 -r 8e85332482c9 sys/arch/mips/mips/db_trace.c
--- a/sys/arch/mips/mips/db_trace.c     Wed Jul 07 01:22:12 2010 +0000
+++ b/sys/arch/mips/mips/db_trace.c     Wed Jul 07 01:22:35 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_trace.c,v 1.39 2010/07/01 02:38:27 rmind Exp $      */
+/*     $NetBSD: db_trace.c,v 1.40 2010/07/07 01:22:35 chs Exp $        */
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.39 2010/07/01 02:38:27 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.40 2010/07/07 01:22:35 chs Exp $");
 
 #include "opt_ddb.h"
 
@@ -143,6 +143,9 @@
        struct pcb *pcb;
        struct proc *p;
        struct lwp *l;
+       const char *cp = modif;
+       char c;
+       bool lwpaddr = false;
 
        if (!have_addr) {
                stacktrace_subr(ddb_regs.f_regs[_R_A0],
@@ -158,14 +161,26 @@
                return;
        }
 
-       /* "trace/t" */
-       (*pr)("pid %d ", (int)addr);
-       p = proc_find_raw(addr);
-       if (p == NULL) {
-               (*pr)("not found\n");
-               return;
-       }       
-       l = LIST_FIRST(&p->p_lwps); /* XXX NJWLWP */
+       while ((c = *cp++) != 0) {
+               if (c == 'a') {
+                       lwpaddr = true;
+               }
+       }
+
+       if (lwpaddr) {
+               l = (struct lwp *)addr;
+               (*pr)("pid %d.%d ", l->l_proc->p_pid, l->l_lid);
+       } else {
+               /* "trace/t" */
+
+               (*pr)("pid %d ", (int)addr);
+               p = proc_find_raw(addr);
+               if (p == NULL) {
+                       (*pr)("not found\n");
+                       return;
+               }       
+               l = LIST_FIRST(&p->p_lwps); /* XXX NJWLWP */
+       }
        pcb = lwp_getpcb(l);
        (*pr)("at %p\n", pcb);
 



Home | Main Index | Thread Index | Old Index