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 redo much of rev 1.45 and make the _KERNE...



details:   https://anonhg.NetBSD.org/src/rev/03bef6e3ecfd
branches:  trunk
changeset: 955326:03bef6e3ecfd
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Sep 26 20:38:27 2020 +0000

description:
redo much of rev 1.45 and make the _KERNEL path look like it
used to before.

while it uses less total lines of code and looks less ugly,
the merged crash+ddb code here is less correct and harder to
follow for the kernel path.

diffstat:

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

diffs (77 lines):

diff -r fdb516a455c2 -r 03bef6e3ecfd sys/arch/mips/mips/db_trace.c
--- a/sys/arch/mips/mips/db_trace.c     Sat Sep 26 19:38:45 2020 +0000
+++ b/sys/arch/mips/mips/db_trace.c     Sat Sep 26 20:38:27 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_trace.c,v 1.46 2020/09/26 04:11:48 simonb Exp $     */
+/*     $NetBSD: db_trace.c,v 1.47 2020/09/26 20:38:27 mrg Exp $        */
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.46 2020/09/26 04:11:48 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.47 2020/09/26 20:38:27 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -141,8 +141,6 @@
 {
 #ifndef DDB_TRACE
        struct pcb *pcb;
-       struct proc p;
-       struct lwp l;
        const char *cp = modif;
        char c;
        bool lwpaddr = false;
@@ -173,27 +171,42 @@
        }
 
        if (lwpaddr) {
-               db_read_bytes(addr, sizeof(l), (char *)&l);
-               db_read_bytes((db_addr_t)l.l_proc, sizeof(p), (char *)&p);
-               (*pr)("pid %d.%d ", p.p_pid, l.l_lid);
+#ifdef _KERNEL
+               struct lwp *l;
+
+               l = (struct lwp *)(intptr_t)addr;
+               (*pr)("pid %d.%d ", l->l_proc->p_pid, l->l_lid);
+               pcb = lwp_getpcb(l);
+#else
+               struct proc pstore;
+               struct lwp lstore;
+
+               db_read_bytes(addr, sizeof(lstore), (char *)&lstore);
+               db_read_bytes((db_addr_t)lstore.l_proc, sizeof(pstore), 
+                   (char *)&pstore);
+               (*pr)("pid %d.%d ", pstore.p_pid, lstore.l_lid);
+               pcb = lwp_getpcb(&lstore);
+#endif
        } else {
                /* "trace/t" */
 
                (*pr)("pid %d ", (int)addr);
 #ifdef _KERNEL
-               struct proc *p2 = proc_find_raw(addr);
-               if (p2 == NULL) {
+               struct lwp *l;
+               struct proc *p = proc_find_raw(addr);
+
+               if (p == NULL) {
                        (*pr)("not found\n");
                        return;
                }       
-               l = *LIST_FIRST(&p2->p_lwps); /* XXX NJWLWP */
+               l = LIST_FIRST(&p->p_lwps); /* XXX NJWLWP */
+               pcb = lwp_getpcb(l);
 #else
                (*pr)("no proc_find_raw() in crash\n");
                return;
 #endif
        }
 
-       pcb = lwp_getpcb(&l);
        (*pr)("at %p\n", pcb);
 
 #ifdef _KERNEL



Home | Main Index | Thread Index | Old Index