summaryrefslogtreecommitdiffstats
path: root/Documentation/kdump
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2016-05-23 19:24:25 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-23 20:04:14 -0400
commita0c20deae992527ba90df9a6f87d396b7cee3922 (patch)
treee02f029e0e13cd7a62a06c5994cbf0a4aefd2d8a /Documentation/kdump
parent7a0058ec78602da02b34fa2ae3afc523e90d1ab2 (diff)
kdump: fix gdb macros work work with newer and 64-bit kernels
Lots of little changes needed to be made to clean these up, remove the four byte pointer assumption and traverse the pid queue properly. Also consolidate the traceback code into a single function instead of having three copies of it. Link: http://lkml.kernel.org/r/1462926655-9390-1-git-send-email-minyard@acm.org Signed-off-by: Corey Minyard <cminyard@mvista.com> Acked-by: Baoquan He <bhe@redhat.com> Cc: Vivek Goyal <vgoyal@redhat.com> Cc: Haren Myneni <hbabu@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/kdump')
-rw-r--r--Documentation/kdump/gdbmacros.txt96
1 files changed, 44 insertions, 52 deletions
diff --git a/Documentation/kdump/gdbmacros.txt b/Documentation/kdump/gdbmacros.txt
index 9b9b454b048a..35f6a982a0d5 100644
--- a/Documentation/kdump/gdbmacros.txt
+++ b/Documentation/kdump/gdbmacros.txt
@@ -15,15 +15,16 @@
15 15
16define bttnobp 16define bttnobp
17 set $tasks_off=((size_t)&((struct task_struct *)0)->tasks) 17 set $tasks_off=((size_t)&((struct task_struct *)0)->tasks)
18 set $pid_off=((size_t)&((struct task_struct *)0)->pids[1].pid_list.next) 18 set $pid_off=((size_t)&((struct task_struct *)0)->thread_group.next)
19 set $init_t=&init_task 19 set $init_t=&init_task
20 set $next_t=(((char *)($init_t->tasks).next) - $tasks_off) 20 set $next_t=(((char *)($init_t->tasks).next) - $tasks_off)
21 set var $stacksize = sizeof(union thread_union)
21 while ($next_t != $init_t) 22 while ($next_t != $init_t)
22 set $next_t=(struct task_struct *)$next_t 23 set $next_t=(struct task_struct *)$next_t
23 printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm 24 printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm
24 printf "===================\n" 25 printf "===================\n"
25 set var $stackp = $next_t.thread.esp 26 set var $stackp = $next_t.thread.sp
26 set var $stack_top = ($stackp & ~4095) + 4096 27 set var $stack_top = ($stackp & ~($stacksize - 1)) + $stacksize
27 28
28 while ($stackp < $stack_top) 29 while ($stackp < $stack_top)
29 if (*($stackp) > _stext && *($stackp) < _sinittext) 30 if (*($stackp) > _stext && *($stackp) < _sinittext)
@@ -31,13 +32,13 @@ define bttnobp
31 end 32 end
32 set $stackp += 4 33 set $stackp += 4
33 end 34 end
34 set $next_th=(((char *)$next_t->pids[1].pid_list.next) - $pid_off) 35 set $next_th=(((char *)$next_t->thread_group.next) - $pid_off)
35 while ($next_th != $next_t) 36 while ($next_th != $next_t)
36 set $next_th=(struct task_struct *)$next_th 37 set $next_th=(struct task_struct *)$next_th
37 printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm 38 printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm
38 printf "===================\n" 39 printf "===================\n"
39 set var $stackp = $next_t.thread.esp 40 set var $stackp = $next_t.thread.sp
40 set var $stack_top = ($stackp & ~4095) + 4096 41 set var $stack_top = ($stackp & ~($stacksize - 1)) + stacksize
41 42
42 while ($stackp < $stack_top) 43 while ($stackp < $stack_top)
43 if (*($stackp) > _stext && *($stackp) < _sinittext) 44 if (*($stackp) > _stext && *($stackp) < _sinittext)
@@ -45,7 +46,7 @@ define bttnobp
45 end 46 end
46 set $stackp += 4 47 set $stackp += 4
47 end 48 end
48 set $next_th=(((char *)$next_th->pids[1].pid_list.next) - $pid_off) 49 set $next_th=(((char *)$next_th->thread_group.next) - $pid_off)
49 end 50 end
50 set $next_t=(char *)($next_t->tasks.next) - $tasks_off 51 set $next_t=(char *)($next_t->tasks.next) - $tasks_off
51 end 52 end
@@ -54,42 +55,44 @@ document bttnobp
54 dump all thread stack traces on a kernel compiled with !CONFIG_FRAME_POINTER 55 dump all thread stack traces on a kernel compiled with !CONFIG_FRAME_POINTER
55end 56end
56 57
58define btthreadstack
59 set var $pid_task = $arg0
60
61 printf "\npid %d; comm %s:\n", $pid_task.pid, $pid_task.comm
62 printf "task struct: "
63 print $pid_task
64 printf "===================\n"
65 set var $stackp = $pid_task.thread.sp
66 set var $stacksize = sizeof(union thread_union)
67 set var $stack_top = ($stackp & ~($stacksize - 1)) + $stacksize
68 set var $stack_bot = ($stackp & ~($stacksize - 1))
69
70 set $stackp = *((unsigned long *) $stackp)
71 while (($stackp < $stack_top) && ($stackp > $stack_bot))
72 set var $addr = *(((unsigned long *) $stackp) + 1)
73 info symbol $addr
74 set $stackp = *((unsigned long *) $stackp)
75 end
76end
77document btthreadstack
78 dump a thread stack using the given task structure pointer
79end
80
81
57define btt 82define btt
58 set $tasks_off=((size_t)&((struct task_struct *)0)->tasks) 83 set $tasks_off=((size_t)&((struct task_struct *)0)->tasks)
59 set $pid_off=((size_t)&((struct task_struct *)0)->pids[1].pid_list.next) 84 set $pid_off=((size_t)&((struct task_struct *)0)->thread_group.next)
60 set $init_t=&init_task 85 set $init_t=&init_task
61 set $next_t=(((char *)($init_t->tasks).next) - $tasks_off) 86 set $next_t=(((char *)($init_t->tasks).next) - $tasks_off)
62 while ($next_t != $init_t) 87 while ($next_t != $init_t)
63 set $next_t=(struct task_struct *)$next_t 88 set $next_t=(struct task_struct *)$next_t
64 printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm 89 btthreadstack $next_t
65 printf "===================\n"
66 set var $stackp = $next_t.thread.esp
67 set var $stack_top = ($stackp & ~4095) + 4096
68 set var $stack_bot = ($stackp & ~4095)
69
70 set $stackp = *($stackp)
71 while (($stackp < $stack_top) && ($stackp > $stack_bot))
72 set var $addr = *($stackp + 4)
73 info symbol $addr
74 set $stackp = *($stackp)
75 end
76 90
77 set $next_th=(((char *)$next_t->pids[1].pid_list.next) - $pid_off) 91 set $next_th=(((char *)$next_t->thread_group.next) - $pid_off)
78 while ($next_th != $next_t) 92 while ($next_th != $next_t)
79 set $next_th=(struct task_struct *)$next_th 93 set $next_th=(struct task_struct *)$next_th
80 printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm 94 btthreadstack $next_th
81 printf "===================\n" 95 set $next_th=(((char *)$next_th->thread_group.next) - $pid_off)
82 set var $stackp = $next_t.thread.esp
83 set var $stack_top = ($stackp & ~4095) + 4096
84 set var $stack_bot = ($stackp & ~4095)
85
86 set $stackp = *($stackp)
87 while (($stackp < $stack_top) && ($stackp > $stack_bot))
88 set var $addr = *($stackp + 4)
89 info symbol $addr
90 set $stackp = *($stackp)
91 end
92 set $next_th=(((char *)$next_th->pids[1].pid_list.next) - $pid_off)
93 end 96 end
94 set $next_t=(char *)($next_t->tasks.next) - $tasks_off 97 set $next_t=(char *)($next_t->tasks.next) - $tasks_off
95 end 98 end
@@ -101,7 +104,7 @@ end
101define btpid 104define btpid
102 set var $pid = $arg0 105 set var $pid = $arg0
103 set $tasks_off=((size_t)&((struct task_struct *)0)->tasks) 106 set $tasks_off=((size_t)&((struct task_struct *)0)->tasks)
104 set $pid_off=((size_t)&((struct task_struct *)0)->pids[1].pid_list.next) 107 set $pid_off=((size_t)&((struct task_struct *)0)->thread_group.next)
105 set $init_t=&init_task 108 set $init_t=&init_task
106 set $next_t=(((char *)($init_t->tasks).next) - $tasks_off) 109 set $next_t=(((char *)($init_t->tasks).next) - $tasks_off)
107 set var $pid_task = 0 110 set var $pid_task = 0
@@ -113,29 +116,18 @@ define btpid
113 set $pid_task = $next_t 116 set $pid_task = $next_t
114 end 117 end
115 118
116 set $next_th=(((char *)$next_t->pids[1].pid_list.next) - $pid_off) 119 set $next_th=(((char *)$next_t->thread_group.next) - $pid_off)
117 while ($next_th != $next_t) 120 while ($next_th != $next_t)
118 set $next_th=(struct task_struct *)$next_th 121 set $next_th=(struct task_struct *)$next_th
119 if ($next_th.pid == $pid) 122 if ($next_th.pid == $pid)
120 set $pid_task = $next_th 123 set $pid_task = $next_th
121 end 124 end
122 set $next_th=(((char *)$next_th->pids[1].pid_list.next) - $pid_off) 125 set $next_th=(((char *)$next_th->thread_group.next) - $pid_off)
123 end 126 end
124 set $next_t=(char *)($next_t->tasks.next) - $tasks_off 127 set $next_t=(char *)($next_t->tasks.next) - $tasks_off
125 end 128 end
126 129
127 printf "\npid %d; comm %s:\n", $pid_task.pid, $pid_task.comm 130 btthreadstack $pid_task
128 printf "===================\n"
129 set var $stackp = $pid_task.thread.esp
130 set var $stack_top = ($stackp & ~4095) + 4096
131 set var $stack_bot = ($stackp & ~4095)
132
133 set $stackp = *($stackp)
134 while (($stackp < $stack_top) && ($stackp > $stack_bot))
135 set var $addr = *($stackp + 4)
136 info symbol $addr
137 set $stackp = *($stackp)
138 end
139end 131end
140document btpid 132document btpid
141 backtrace of pid 133 backtrace of pid
@@ -145,7 +137,7 @@ end
145define trapinfo 137define trapinfo
146 set var $pid = $arg0 138 set var $pid = $arg0
147 set $tasks_off=((size_t)&((struct task_struct *)0)->tasks) 139 set $tasks_off=((size_t)&((struct task_struct *)0)->tasks)
148 set $pid_off=((size_t)&((struct task_struct *)0)->pids[1].pid_list.next) 140 set $pid_off=((size_t)&((struct task_struct *)0)->thread_group.next)
149 set $init_t=&init_task 141 set $init_t=&init_task
150 set $next_t=(((char *)($init_t->tasks).next) - $tasks_off) 142 set $next_t=(((char *)($init_t->tasks).next) - $tasks_off)
151 set var $pid_task = 0 143 set var $pid_task = 0
@@ -157,13 +149,13 @@ define trapinfo
157 set $pid_task = $next_t 149 set $pid_task = $next_t
158 end 150 end
159 151
160 set $next_th=(((char *)$next_t->pids[1].pid_list.next) - $pid_off) 152 set $next_th=(((char *)$next_t->thread_group.next) - $pid_off)
161 while ($next_th != $next_t) 153 while ($next_th != $next_t)
162 set $next_th=(struct task_struct *)$next_th 154 set $next_th=(struct task_struct *)$next_th
163 if ($next_th.pid == $pid) 155 if ($next_th.pid == $pid)
164 set $pid_task = $next_th 156 set $pid_task = $next_th
165 end 157 end
166 set $next_th=(((char *)$next_th->pids[1].pid_list.next) - $pid_off) 158 set $next_th=(((char *)$next_th->thread_group.next) - $pid_off)
167 end 159 end
168 set $next_t=(char *)($next_t->tasks.next) - $tasks_off 160 set $next_t=(char *)($next_t->tasks.next) - $tasks_off
169 end 161 end