mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-08 16:23:24 -04:00
DEV: dev/gdb: add simple thread dump
The thread_dump function dumps the list of known threads and a few info on them (pointer, current run queue, flags etc). This should help more easily spot a particular one and find stuck ones. E.g: (gdb) thread_dump Tid 0: pth=0x7ffff7e797c0 mono=2222322327950732 now_ms=4294947291 fl=0x38 rq=-1 cq=0 current=(nil) Tid 1: pth=0x7ffff78d8640 mono=2222322327928085 now_ms=4294947291 fl=0x38 rq=-1 cq=0 current=(nil) Tid 2: pth=0x7ffff6b7e640 mono=2222322327927150 now_ms=4294947291 fl=0x38 rq=-1 cq=0 current=(nil) Tid 3: pth=0x7ffff637d640 mono=2222322327924878 now_ms=4294947291 fl=0x38 rq=-1 cq=0 current=(nil) Tid 4: pth=0x7ffff5b7c640 mono=2222322327925676 now_ms=4294947291 fl=0x38 rq=-1 cq=0 current=(nil) Tid 5: pth=0x7ffff537b640 mono=2222322327929524 now_ms=4294947291 fl=0x38 rq=-1 cq=0 current=(nil) Tid 6: pth=0x7ffff4b7a640 mono=2222322327926817 now_ms=4294947291 fl=0x38 rq=-1 cq=0 current=(nil) Tid 7: pth=0x7fffdffff640 mono=2222322327947960 now_ms=4294947291 fl=0x38 rq=-1 cq=0 current=(nil)
This commit is contained in:
parent
c82ac139f4
commit
ca5f6cd053
1 changed files with 10 additions and 0 deletions
10
dev/gdb/thread.gdb
Normal file
10
dev/gdb/thread.gdb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# list info about current threads (ptr, now_ms, queue, current)
|
||||
define thread_dump
|
||||
set $t = 0
|
||||
while $t < $g.nbthread
|
||||
set $i = $ti[$t].pth_id
|
||||
set $h = $tc[$t].current
|
||||
printf "Tid %4d: pth=%p mono=%llu now_ms=%u fl=0x%02x rq=%d cq=%d current=%p\n", $t, $i, $tc[$t].curr_mono_time, (unsigned)(($tc[$t].curr_mono_time + now_offset)/1000000), $tc[$t].flags, $tc[$t].current_queue, $tc[$t].rq_total, $h
|
||||
set $t = $t + 1
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue