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

Function dumpthread

freebsd/ddb/db_ps.c:261–344  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261static void
262dumpthread(volatile struct proc *p, volatile struct thread *td, int all)
263{
264 char state[9], wprefix;
265 const char *wmesg;
266 const void *wchan;
267
268 if (all) {
269 db_printf("%6d ", td->td_tid);
270 switch (td->td_state) {
271 case TDS_RUNNING:
272 snprintf(state, sizeof(state), "Run");
273 break;
274 case TDS_RUNQ:
275 snprintf(state, sizeof(state), "RunQ");
276 break;
277 case TDS_CAN_RUN:
278 snprintf(state, sizeof(state), "CanRun");
279 break;
280 case TDS_INACTIVE:
281 snprintf(state, sizeof(state), "Inactv");
282 break;
283 case TDS_INHIBITED:
284 state[0] = '\0';
285 if (TD_ON_LOCK(td))
286 strlcat(state, "L", sizeof(state));
287 if (TD_IS_SLEEPING(td)) {
288 if (td->td_flags & TDF_SINTR)
289 strlcat(state, "S", sizeof(state));
290 else
291 strlcat(state, "D", sizeof(state));
292 }
293 if (TD_IS_SWAPPED(td))
294 strlcat(state, "W", sizeof(state));
295 if (TD_AWAITING_INTR(td))
296 strlcat(state, "I", sizeof(state));
297 if (TD_IS_SUSPENDED(td))
298 strlcat(state, "s", sizeof(state));
299 if (state[0] != '\0')
300 break;
301 default:
302 snprintf(state, sizeof(state), "???");
303 }
304 db_printf(" %-6.6s ", state);
305 }
306 wprefix = ' ';
307 if (TD_ON_LOCK(td)) {
308 wprefix = '*';
309 wmesg = td->td_lockname;
310 wchan = td->td_blocked;
311 } else if (TD_ON_SLEEPQ(td)) {
312 wmesg = td->td_wmesg;
313 wchan = td->td_wchan;
314 } else if (TD_IS_RUNNING(td)) {
315 snprintf(state, sizeof(state), "CPU %d", td->td_oncpu);
316 wmesg = state;
317 wchan = NULL;
318 } else {

Callers 2

db_ps_procFunction · 0.85
db_ps.cFile · 0.85

Calls 4

db_printfFunction · 0.85
snprintfFunction · 0.85
dump_argsFunction · 0.70
strlcatFunction · 0.50

Tested by

no test coverage detected