MCPcopy Create free account
hub / github.com/F-Stack/f-stack / db_lookup_thread

Function db_lookup_thread

freebsd/ddb/db_thread.c:112–135  ·  view source on GitHub ↗

* Lookup a thread based on a db expression address. We assume that the * address was parsed in hexadecimal. We reparse the address in decimal * first and try to treat it as a thread ID to find an associated thread. * If that fails and check_pid is true, we treat the decimal value as a * PID. If that matches a process, we return the first thread in that * process. Otherwise, we treat the a

Source from the content-addressed store, hash-verified

110 * process. Otherwise, we treat the addr as a pointer to a thread.
111 */
112struct thread *
113db_lookup_thread(db_expr_t addr, bool check_pid)
114{
115 struct thread *td;
116 db_expr_t decaddr;
117
118 /*
119 * If the parsed address was not a valid decimal expression,
120 * assume it is a thread pointer.
121 */
122 decaddr = db_hex2dec(addr);
123 if (decaddr == -1)
124 return ((struct thread *)addr);
125
126 td = kdb_thr_lookup(decaddr);
127 if (td != NULL)
128 return (td);
129 if (check_pid) {
130 td = kdb_thr_from_pid(decaddr);
131 if (td != NULL)
132 return (td);
133 }
134 return ((struct thread *)addr);
135}
136
137/*
138 * Lookup a process based on a db expression address. We assume that the

Callers 6

pmap.cFile · 0.85
vm_machdep.cFile · 0.85
subr_turnstile.cFile · 0.85
subr_witness.cFile · 0.85
db_ps.cFile · 0.85
db_set_threadFunction · 0.85

Calls 3

db_hex2decFunction · 0.85
kdb_thr_lookupFunction · 0.85
kdb_thr_from_pidFunction · 0.85

Tested by

no test coverage detected