File: post-mortem.gdb

package info (click to toggle)
haproxy 3.2.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,880 kB
  • sloc: ansic: 267,692; sh: 3,277; xml: 1,756; python: 1,345; makefile: 1,155; perl: 168; cpp: 21
file content (47 lines) | stat: -rw-r--r-- 1,335 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# This script will set the post_mortem struct pointer ($pm) from the one found
# in the "post_mortem" symbol. If not found or if not correct, it's the same
# address as the "_post_mortem" section, which can be found using "info files"
# or "objdump -h" on the executable. The guessed value is the by a first call
# to pm_init, but if not correct, you just need to call pm_init again with the
# correct pointer, e.g:
#   pm_init 0xcfd400

define pm_init
  set $pm = (struct post_mortem*)$arg0
  set $g = $pm.global
  set $ti = $pm.thread_info
  set $tc = $pm.thread_ctx
  set $tgi = $pm.tgroup_info
  set $tgc = $pm.tgroup_ctx
  set $fd = $pm.fdtab
  set $pxh = *$pm.proxies
  set $po  = $pm.pools
  set $ac  = $pm.activity
end

# show basic info on the running process (OS, uid, etc)
define pm_show_info
  print $pm->platform
  print $pm->process
end

# show thread IDs to easily map between gdb threads and tid
define pm_show_threads
  set $t = 0
  while $t < $g.nbthread
    printf "Tid %4d: pthread_id=%#lx  stack_top=%#lx\n", $t, $ti[$t].pth_id, $ti[$t].stack_top
    set $t = $t + 1
  end
end

# dump all threads' dump buffers
define pm_show_thread_dump
  set $t = 0
  while $t < $g.nbthread
    printf "%s\n", $tc[$t].thread_dump_buffer->area
    set $t = $t + 1
  end
end

# initialize the various pointers
pm_init &post_mortem