public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Corey Minyard <minyard@acm.org>
Cc: kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
	Vivek Goyal <vgoyal@redhat.com>, Haren Myneni <hbabu@us.ibm.com>,
	Corey Minyard <cminyard@mvista.com>,
	dyoung@redhat.com
Subject: Re: [PATCH] kdump: Fix gdb macros work work with newer and 64-bit kernels
Date: Tue, 10 May 2016 09:48:35 +0800	[thread overview]
Message-ID: <20160510014835.GB2629@x1.redhat.com> (raw)
In-Reply-To: <57307E53.4060300@acm.org>

Hi Corey,

On 05/09/16 at 07:10am, Corey Minyard wrote:
> >>>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
> >>>@@ -54,42 +54,43 @@ document bttnobp
> >>>  	dump all thread stack traces on a kernel compiled with !CONFIG_FRAME_POINTER
> >>>  end
> >>>+define btthreadstruct
> >This is a nice wrapping, but I guess you want to name it as
> >btthreadstack, right? Since I didn't get at all why it's related to
> >thread_struct except of getting 'sp'.
> >
> 
> The name is based on what is passed into the function.  You do a
> backtrace when given a thread structure.  In my experience it is
> best to name functions based upon how the function's user sees it.
> Though I'm not stuck on the name, if you would prefer btthreadstack.

About the name, in fact a task struct is passed in. Mainly there's a
thread_struct defined in x86 ARCH, I thought you are handling
thread_struct related things when I look at the first glance.
btthreadstack is far better name that that, I like it.

******************************
arch/x86/include/asm/processor.h
struct thread_struct {         
        /* Cached TLS descriptors: */   
        struct desc_struct      tls_array[GDT_ENTRY_TLS_ENTRIES];
        unsigned long           sp0;    
        unsigned long           sp;     
#ifdef CONFIG_X86_32           
        unsigned long           sysenter_cs;
#else
......
}

Thanks
Baoquan

> 
> >>>+	set var $pid_task = $arg0
> >>>+
> >>>+	printf "\npid %d; comm %s:\n", $pid_task.pid, $pid_task.comm
> >>>+	printf "task struct: "
> >>>+	print $pid_task
> >>>+	printf "===================\n"
> >>>+	set var $stackp = $pid_task.thread.sp
> >>>+	set var $stack_top = ($stackp & ~4095) + 4096
> >>>+	set var $stack_bot = ($stackp & ~4095)
> >>>+
> >>>+	set $stackp = *((unsigned long *) $stackp)
> >>>+	while (($stackp < $stack_top) && ($stackp > $stack_bot))
> >>>+		set var $addr = *(((unsigned long *) $stackp) + 1)
> >>>+		info symbol $addr
> >>>+		set $stackp = *((unsigned long *) $stackp)
> >>>+	end
> >>>+end
> >>>+document btthreadstruct
> >>>+	 dump a thread stack using the given task structure pointer
> >>>+end

      parent reply	other threads:[~2016-05-10  1:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-25 13:51 [PATCH] kdump: Fix gdb macros work work with newer and 64-bit kernels minyard
2016-04-27 12:21 ` Corey Minyard
2016-05-05  2:37   ` Baoquan He
2016-05-09  5:18   ` Baoquan He
2016-05-09 12:10     ` Corey Minyard
2016-05-09 14:29       ` Baoquan He
2016-05-09 15:40         ` Corey Minyard
2016-05-10  1:37           ` Baoquan He
2016-05-10  1:48       ` Baoquan He [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160510014835.GB2629@x1.redhat.com \
    --to=bhe@redhat.com \
    --cc=cminyard@mvista.com \
    --cc=dyoung@redhat.com \
    --cc=hbabu@us.ibm.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minyard@acm.org \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox