Deleted Added
sdiff udiff text old ( 132624 ) new ( 142151 )
full compact
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 132624 2004-07-25 05:29:15Z marcel $");
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>
37#include <stdio.h>
38#include <stdlib.h>
39
40#include "kgdb.h"
41
42static uintptr_t dumppcb;
43static int dumptid;
44
45static struct kthr *first;
46struct kthr *curkthr;
47

--- 49 unchanged lines hidden (view full) ---

97 warnx("kvm_read: %s", kvm_geterr(kvm));
98 kt = malloc(sizeof(*kt));
99 kt->next = first;
100 kt->kaddr = addr;
101 kt->pcb = (td.td_tid == dumptid) ? dumppcb :
102 (uintptr_t)td.td_pcb;
103 kt->kstack = td.td_kstack;
104 kt->tid = td.td_tid;
105 first = kt;
106 addr = (uintptr_t)TAILQ_NEXT(&td, td_plist);
107 }
108 paddr = (uintptr_t)LIST_NEXT(&p, p_list);
109 }
110 curkthr = kgdb_thr_lookup(dumptid);
111 if (curkthr == NULL)
112 curkthr = first;
113 return (first);
114}
115
116struct kthr *
117kgdb_thr_lookup(int tid)
118{
119 struct kthr *kt;
120
121 kt = first;
122 while (kt != NULL && kt->tid != tid)
123 kt = kt->next;
124 return (kt);
125}
126
127struct kthr *
128kgdb_thr_next(struct kthr *kt)
129{
130 return (kt->next);
131}
132
133struct kthr *
134kgdb_thr_select(struct kthr *kt)
135{
136 struct kthr *pcur;
137
138 pcur = curkthr;
139 curkthr = kt;
140 return (pcur);
141}