From owner-p4-projects@FreeBSD.ORG Sun Jun 13 05:33:27 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C0F0916A4D1; Sun, 13 Jun 2004 05:33:26 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B70916A4CE for ; Sun, 13 Jun 2004 05:33:26 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D12643D2F for ; Sun, 13 Jun 2004 05:33:26 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i5D5VBmP027907 for ; Sun, 13 Jun 2004 05:31:11 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5D5VBN6027900 for perforce@freebsd.org; Sun, 13 Jun 2004 05:31:11 GMT (envelope-from marcel@freebsd.org) Date: Sun, 13 Jun 2004 05:31:11 GMT Message-Id: <200406130531.i5D5VBN6027900@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 54788 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Jun 2004 05:33:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=54788 Change 54788 by marcel@marcel_nfs on 2004/06/13 05:30:58 o In kdb_trap(), save the current context in kdb_pcb. o In kdb_thr_first() and kdb_thr_next(), remove checking td_last_frame and instead check PS_INMEM. o In kdb_thr_select(), switch kdb_thrctx to the PCB of the thread we're selecting, unless it's curthread. For curthread the context is in kdb_pcb. Affected files ... .. //depot/projects/gdb/sys/kern/subr_kdb.c#14 edit .. //depot/projects/gdb/sys/sys/kdb.h#11 edit Differences ... ==== //depot/projects/gdb/sys/kern/subr_kdb.c#14 (text+ko) ==== @@ -38,10 +38,13 @@ #include #include +#include int kdb_active = 0; void *kdb_jmpbufp = NULL; struct kdb_dbbe *kdb_dbbe = NULL; +struct pcb kdb_pcb; +struct pcb *kdb_thrctx = NULL; struct thread *kdb_thread = NULL; struct trapframe *kdb_frame = NULL; @@ -282,11 +285,11 @@ p = LIST_FIRST(&allproc); while (p != NULL) { - thr = FIRST_THREAD_IN_PROC(p); - while (thr != NULL && thr->td_last_frame == NULL) - thr = TAILQ_NEXT(thr, td_plist); - if (thr != NULL) - return (thr); + if (p->p_sflag & PS_INMEM) { + thr = FIRST_THREAD_IN_PROC(p); + if (thr != NULL) + return (thr); + } p = LIST_NEXT(p, p_list); } return (NULL); @@ -311,12 +314,10 @@ p = thr->td_proc; thr = TAILQ_NEXT(thr, td_plist); do { - while (thr != NULL && thr->td_last_frame == NULL) - thr = TAILQ_NEXT(thr, td_plist); if (thr != NULL) return (thr); p = LIST_NEXT(p, p_list); - if (p != NULL) + if (p != NULL && (p->p_sflag & PS_INMEM)) thr = FIRST_THREAD_IN_PROC(p); } while (p != NULL); return (NULL); @@ -325,10 +326,10 @@ int kdb_thr_select(struct thread *thr) { - if (thr == NULL || thr->td_last_frame == NULL) + if (thr == NULL) return (EINVAL); kdb_thread = thr; - kdb_frame = kdb_thread->td_last_frame; + kdb_thrctx = (thr == curthread) ? &kdb_pcb : thr->td_pcb; return (0); } @@ -348,11 +349,13 @@ if (kdb_active) return (0); + savectx(&kdb_pcb); + critical_enter(); kdb_active++; - kdb_thread = curthread; kdb_frame = tf; + kdb_thr_select(curthread); #ifdef SMP stop_cpus(PCPU_GET(other_cpus)); ==== //depot/projects/gdb/sys/sys/kdb.h#11 (text+ko) ==== @@ -52,13 +52,15 @@ }; \ DATA_SET(kdb_dbbe_set, name##_dbbe) +struct pcb; struct thread; struct trapframe; extern int kdb_active; /* Non-zero while in debugger. */ extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or NULL. */ +extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ +extern struct pcb *kdb_thrctx; /* Current context. */ extern struct thread *kdb_thread; /* Current thread. */ -extern struct trapframe *kdb_frame; /* Current frame. */ int kdb_alt_break(int, int *); void kdb_backtrace(void);