kthr.c (161621) | kthr.c (163440) |
---|---|
1/* 2 * Copyright (c) 2004 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2004 Marcel Moolenaar 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/kthr.c 161621 2006-08-25 16:20:17Z jhb $"); | 28__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/kthr.c 163440 2006-10-16 20:07:23Z jhb $"); |
29 30#include <sys/param.h> 31#include <sys/proc.h> 32#include <sys/types.h> 33#include <sys/signal.h> 34#include <err.h> 35#include <inttypes.h> 36#include <kvm.h> --- 60 unchanged lines hidden (view full) --- 97 98 addr = lookup("_stopped_cpus"); 99 if (addr != 0) 100 kvm_read(kvm, addr, &stopped_cpus, sizeof(stopped_cpus)); 101 else 102 stopped_cpus = 0; 103 104 stoppcbs = lookup("_stoppcbs"); | 29 30#include <sys/param.h> 31#include <sys/proc.h> 32#include <sys/types.h> 33#include <sys/signal.h> 34#include <err.h> 35#include <inttypes.h> 36#include <kvm.h> --- 60 unchanged lines hidden (view full) --- 97 98 addr = lookup("_stopped_cpus"); 99 if (addr != 0) 100 kvm_read(kvm, addr, &stopped_cpus, sizeof(stopped_cpus)); 101 else 102 stopped_cpus = 0; 103 104 stoppcbs = lookup("_stoppcbs"); |
105 | 105 |
106 while (paddr != 0) { 107 if (kvm_read(kvm, paddr, &p, sizeof(p)) != sizeof(p)) 108 warnx("kvm_read: %s", kvm_geterr(kvm)); 109 addr = (uintptr_t)TAILQ_FIRST(&p.p_threads); 110 while (addr != 0) { 111 if (kvm_read(kvm, addr, &td, sizeof(td)) != sizeof(td)) 112 warnx("kvm_read: %s", kvm_geterr(kvm)); 113 kt = malloc(sizeof(*kt)); 114 kt->next = first; 115 kt->kaddr = addr; 116 if (td.td_tid == dumptid) 117 kt->pcb = dumppcb; 118 else if (td.td_state == TDS_RUNNING && ((1 << td.td_oncpu) & stopped_cpus) 119 && stoppcbs != 0) 120 kt->pcb = (uintptr_t) stoppcbs + sizeof(struct pcb) * td.td_oncpu; | 106 while (paddr != 0) { 107 if (kvm_read(kvm, paddr, &p, sizeof(p)) != sizeof(p)) 108 warnx("kvm_read: %s", kvm_geterr(kvm)); 109 addr = (uintptr_t)TAILQ_FIRST(&p.p_threads); 110 while (addr != 0) { 111 if (kvm_read(kvm, addr, &td, sizeof(td)) != sizeof(td)) 112 warnx("kvm_read: %s", kvm_geterr(kvm)); 113 kt = malloc(sizeof(*kt)); 114 kt->next = first; 115 kt->kaddr = addr; 116 if (td.td_tid == dumptid) 117 kt->pcb = dumppcb; 118 else if (td.td_state == TDS_RUNNING && ((1 << td.td_oncpu) & stopped_cpus) 119 && stoppcbs != 0) 120 kt->pcb = (uintptr_t) stoppcbs + sizeof(struct pcb) * td.td_oncpu; |
121 else | 121 else |
122 kt->pcb = (uintptr_t)td.td_pcb; 123 kt->kstack = td.td_kstack; 124 kt->tid = td.td_tid; 125 kt->pid = p.p_pid; 126 kt->paddr = paddr; 127 first = kt; 128 addr = (uintptr_t)TAILQ_NEXT(&td, td_plist); 129 } --- 85 unchanged lines hidden --- | 122 kt->pcb = (uintptr_t)td.td_pcb; 123 kt->kstack = td.td_kstack; 124 kt->tid = td.td_tid; 125 kt->pid = p.p_pid; 126 kt->paddr = paddr; 127 first = kt; 128 addr = (uintptr_t)TAILQ_NEXT(&td, td_plist); 129 } --- 85 unchanged lines hidden --- |