summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2006-08-28 15:02:57 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2006-08-28 15:02:57 +0000
commitffb64eeb9e1c34e92cc90994412bf79094c5a7de (patch)
tree1a112d3e454d219776a31dbeefb035f898d365b3 /gnu/usr.bin
parent99400158c3c2d20a4fb0fd4f9ba122b562ad0263 (diff)
Notes
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/gdb/kgdb/kthr.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gnu/usr.bin/gdb/kgdb/kthr.c b/gnu/usr.bin/gdb/kgdb/kthr.c
index 9156f1a9cf66..a93026455120 100644
--- a/gnu/usr.bin/gdb/kgdb/kthr.c
+++ b/gnu/usr.bin/gdb/kgdb/kthr.c
@@ -41,10 +41,14 @@ __FBSDID("$FreeBSD$");
#include <frame-unwind.h>
#include "kgdb.h"
+#include <machine/pcb.h>
static uintptr_t dumppcb;
static int dumptid;
+static uintptr_t stoppcbs;
+static __cpumask_t stopped_cpus;
+
static struct kthr *first;
struct kthr *curkthr;
@@ -91,6 +95,14 @@ kgdb_thr_init(void)
else
dumptid = -1;
+ addr = lookup("_stopped_cpus");
+ if (addr != 0)
+ kvm_read(kvm, addr, &stopped_cpus, sizeof(stopped_cpus));
+ else
+ stopped_cpus = 0;
+
+ stoppcbs = lookup("_stoppcbs");
+
while (paddr != 0) {
if (kvm_read(kvm, paddr, &p, sizeof(p)) != sizeof(p))
warnx("kvm_read: %s", kvm_geterr(kvm));
@@ -101,8 +113,13 @@ kgdb_thr_init(void)
kt = malloc(sizeof(*kt));
kt->next = first;
kt->kaddr = addr;
- kt->pcb = (td.td_tid == dumptid) ? dumppcb :
- (uintptr_t)td.td_pcb;
+ if (td.td_tid == dumptid)
+ kt->pcb = dumppcb;
+ else if (td.td_state == TDS_RUNNING && ((1 << td.td_oncpu) & stopped_cpus)
+ && stoppcbs != 0)
+ kt->pcb = (uintptr_t) stoppcbs + sizeof(struct pcb) * td.td_oncpu;
+ else
+ kt->pcb = (uintptr_t)td.td_pcb;
kt->kstack = td.td_kstack;
kt->tid = td.td_tid;
kt->pid = p.p_pid;