[PATCH] kdump: Fix gdb macros work work with newer and 64-bit kernels

Baoquan He bhe at redhat.com
Mon May 9 07:29:53 PDT 2016


On 05/09/16 at 07:10am, Corey Minyard wrote:
> On 05/09/2016 12:18 AM, Baoquan He wrote:
> >Hi Corey,
> >
> >I am trying to review this patch now, and these fixes contained are very
> >great. Just several concerns are added in inline comment.
> >
> >By the way, did you run this in your side?
> 
> Yes, I tested on x86, x86_64, ARM and MIPS.
> 
> Comments inline...

That's awesome. I will have a try too.

> >>>diff --git a/Documentation/kdump/gdbmacros.txt b/Documentation/kdump/gdbmacros.txt
> >>>index 9b9b454..e5bbd8d 100644
> >>>--- a/Documentation/kdump/gdbmacros.txt
> >>>+++ b/Documentation/kdump/gdbmacros.txt
> >>>@@ -15,14 +15,14 @@
> >>>  define bttnobp
> >>>  	set $tasks_off=((size_t)&((struct task_struct *)0)->tasks)
> >>>-	set $pid_off=((size_t)&((struct task_struct *)0)->pids[1].pid_list.next)
> >>>+	set $pid_off=((size_t)&((struct task_struct *)0)->thread_group.next)
> >This is a quite nice fix.
> >
> >>>  	set $init_t=&init_task
> >>>  	set $next_t=(((char *)($init_t->tasks).next) - $tasks_off)
> >>>  	while ($next_t != $init_t)
> >>>  		set $next_t=(struct task_struct *)$next_t
> >>>  		printf "\npid %d; comm %s:\n", $next_t.pid, $next_t.comm
> >>>  		printf "===================\n"
> >>>-		set var $stackp = $next_t.thread.esp
> >>>+		set var $stackp = $next_t.thread.sp
> >>>  		set var $stack_top = ($stackp & ~4095) + 4096

Missed one place here. Currently the kernel stack is decided by
THREAD_SIZE since the definition:

union thread_union {
        struct thread_info thread_info;
        unsigned long stack[THREAD_SIZE/sizeof(long)];
};

Should we get the top and bottom of stack according to this now?

Correct me if I was wrong.

Thanks
Baoquan

> >>>  		while ($stackp < $stack_top)
> >>>@@ -31,12 +31,12 @@ define bttnobp
> >>>  			end
> >>>  			set $stackp += 4
> >>>  		end



More information about the kexec mailing list