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

Baoquan He bhe at redhat.com
Mon May 9 18:37:28 PDT 2016


On 05/09/16 at 10:40am, Corey Minyard wrote:
> >>>>>  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.
> 
> I think you are correct.  We should use something like:
> 
>    set var $stack_top = ($stackp & ~(sizeof(thread_union) - 1)) +
>    sizeof(thread_union)
> 
> Is this what you are suggesting?

Exactly, it's cool. Thanks!





More information about the kexec mailing list