kthr.c (175452) | kthr.c (175771) |
---|---|
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 175452 2008-01-18 18:57:27Z emaste $"); | 28__FBSDID("$FreeBSD: head/gnu/usr.bin/gdb/kgdb/kthr.c 175771 2008-01-28 20:33:19Z 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> --- 18 unchanged lines hidden (view full) --- 55 56uintptr_t 57kgdb_lookup(const char *sym) 58{ 59 struct nlist nl[2]; 60 61 nl[0].n_name = (char *)(uintptr_t)sym; 62 nl[1].n_name = NULL; | 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> --- 18 unchanged lines hidden (view full) --- 55 56uintptr_t 57kgdb_lookup(const char *sym) 58{ 59 struct nlist nl[2]; 60 61 nl[0].n_name = (char *)(uintptr_t)sym; 62 nl[1].n_name = NULL; |
63 if (kvm_nlist(kvm, nl) != 0) { 64 warnx("kvm_nlist(%s): %s", sym, kvm_geterr(kvm)); | 63 if (kvm_nlist(kvm, nl) != 0) |
65 return (0); | 64 return (0); |
66 } | |
67 return (nl[0].n_value); 68} 69 70struct kthr * 71kgdb_thr_first(void) 72{ 73 return (first); 74} 75 76struct kthr * 77kgdb_thr_init(void) 78{ 79 struct proc p; 80 struct thread td; 81 struct kthr *kt; 82 uintptr_t addr, paddr; 83 84 addr = kgdb_lookup("_allproc"); | 65 return (nl[0].n_value); 66} 67 68struct kthr * 69kgdb_thr_first(void) 70{ 71 return (first); 72} 73 74struct kthr * 75kgdb_thr_init(void) 76{ 77 struct proc p; 78 struct thread td; 79 struct kthr *kt; 80 uintptr_t addr, paddr; 81 82 addr = kgdb_lookup("_allproc"); |
85 if (addr == 0) | 83 if (addr == 0) { 84 warnx("kvm_nlist(_allproc): %s", kvm_geterr(kvm)); |
86 return (NULL); | 85 return (NULL); |
86 } |
|
87 kvm_read(kvm, addr, &paddr, sizeof(paddr)); 88 89 dumppcb = kgdb_lookup("_dumppcb"); | 87 kvm_read(kvm, addr, &paddr, sizeof(paddr)); 88 89 dumppcb = kgdb_lookup("_dumppcb"); |
90 if (dumppcb == 0) | 90 if (dumppcb == 0) { 91 warnx("kvm_nlist(_dumppcb): %s", kvm_geterr(kvm)); |
91 return (NULL); | 92 return (NULL); |
93 } |
|
92 93 addr = kgdb_lookup("_dumptid"); 94 if (addr != 0) 95 kvm_read(kvm, addr, &dumptid, sizeof(dumptid)); 96 else 97 dumptid = -1; 98 99 addr = kgdb_lookup("_stopped_cpus"); --- 131 unchanged lines hidden --- | 94 95 addr = kgdb_lookup("_dumptid"); 96 if (addr != 0) 97 kvm_read(kvm, addr, &dumptid, sizeof(dumptid)); 98 else 99 dumptid = -1; 100 101 addr = kgdb_lookup("_stopped_cpus"); --- 131 unchanged lines hidden --- |