summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-08-25 16:20:17 +0000
committerjhb <jhb@FreeBSD.org>2006-08-25 16:20:17 +0000
commit3bdf41a5e4b9ba205df0720537ea741058785c5e (patch)
treec88f637bbce799f0cd308440fa7e29d4d3df9223 /gnu
parent0db75312ec3bb7b608165bf534997c016988b8d6 (diff)
downloadFreeBSD-src-3bdf41a5e4b9ba205df0720537ea741058785c5e.zip
FreeBSD-src-3bdf41a5e4b9ba205df0720537ea741058785c5e.tar.gz
Use the pcb in stoppcbs[] if it is present for threads that were running
on other CPUs in system when a dump is written. Submitted by: ups Reviewed by: marcel MFC after: 3 days
Diffstat (limited to 'gnu')
-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 9156f1a..a930264 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;
OpenPOWER on IntegriCloud