kthr.c (166214) | kthr.c (167142) |
---|---|
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 166214 2007-01-25 06:39:25Z rodrigc $"); | 28__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/kthr.c 167142 2007-03-01 13:55:15Z kib $"); |
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> --- 10 unchanged lines hidden (view full) --- 47static int dumptid; 48 49static uintptr_t stoppcbs; 50static __cpumask_t stopped_cpus; 51 52static struct kthr *first; 53struct kthr *curkthr; 54 | 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> --- 10 unchanged lines hidden (view full) --- 47static int dumptid; 48 49static uintptr_t stoppcbs; 50static __cpumask_t stopped_cpus; 51 52static struct kthr *first; 53struct kthr *curkthr; 54 |
55static uintptr_t 56lookup(const char *sym) | 55uintptr_t 56kgdb_lookup(const char *sym) |
57{ 58 struct nlist nl[2]; 59 60 nl[0].n_name = (char *)(uintptr_t)sym; 61 nl[1].n_name = NULL; 62 if (kvm_nlist(kvm, nl) != 0) { 63 warnx("kvm_nlist(%s): %s", sym, kvm_geterr(kvm)); 64 return (0); --- 10 unchanged lines hidden (view full) --- 75struct kthr * 76kgdb_thr_init(void) 77{ 78 struct proc p; 79 struct thread td; 80 struct kthr *kt; 81 uintptr_t addr, paddr; 82 | 57{ 58 struct nlist nl[2]; 59 60 nl[0].n_name = (char *)(uintptr_t)sym; 61 nl[1].n_name = NULL; 62 if (kvm_nlist(kvm, nl) != 0) { 63 warnx("kvm_nlist(%s): %s", sym, kvm_geterr(kvm)); 64 return (0); --- 10 unchanged lines hidden (view full) --- 75struct kthr * 76kgdb_thr_init(void) 77{ 78 struct proc p; 79 struct thread td; 80 struct kthr *kt; 81 uintptr_t addr, paddr; 82 |
83 addr = lookup("_allproc"); | 83 addr = kgdb_lookup("_allproc"); |
84 if (addr == 0) 85 return (NULL); 86 kvm_read(kvm, addr, &paddr, sizeof(paddr)); 87 | 84 if (addr == 0) 85 return (NULL); 86 kvm_read(kvm, addr, &paddr, sizeof(paddr)); 87 |
88 dumppcb = lookup("_dumppcb"); | 88 dumppcb = kgdb_lookup("_dumppcb"); |
89 if (dumppcb == 0) 90 return (NULL); 91 | 89 if (dumppcb == 0) 90 return (NULL); 91 |
92 addr = lookup("_dumptid"); | 92 addr = kgdb_lookup("_dumptid"); |
93 if (addr != 0) 94 kvm_read(kvm, addr, &dumptid, sizeof(dumptid)); 95 else 96 dumptid = -1; 97 | 93 if (addr != 0) 94 kvm_read(kvm, addr, &dumptid, sizeof(dumptid)); 95 else 96 dumptid = -1; 97 |
98 addr = lookup("_stopped_cpus"); | 98 addr = kgdb_lookup("_stopped_cpus"); |
99 if (addr != 0) 100 kvm_read(kvm, addr, &stopped_cpus, sizeof(stopped_cpus)); 101 else 102 stopped_cpus = 0; 103 | 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"); | 104 stoppcbs = kgdb_lookup("_stoppcbs"); |
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 break; 110 } 111 addr = (uintptr_t)TAILQ_FIRST(&p.p_threads); 112 while (addr != 0) { --- 107 unchanged lines hidden --- | 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 break; 110 } 111 addr = (uintptr_t)TAILQ_FIRST(&p.p_threads); 112 while (addr != 0) { --- 107 unchanged lines hidden --- |