All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Amit S. Kale" <amitkale@emsyssoft.com>
To: Tom Rini <trini@kernel.crashing.org>
Cc: Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, george@mvista.com, pavel@ucw.cz
Subject: Re: kgdb for mainline kernel: core-lite [patch 1/3]
Date: Tue, 9 Mar 2004 14:28:42 +0530	[thread overview]
Message-ID: <200403091428.42560.amitkale@emsyssoft.com> (raw)
In-Reply-To: <20040308151912.GD15065@smtp.west.cox.net>

On Monday 08 Mar 2004 8:49 pm, Tom Rini wrote:
> On Mon, Mar 08, 2004 at 05:14:05PM +0530, Amit S. Kale wrote:
> > On Monday 08 Mar 2004 4:50 pm, Amit S. Kale wrote:
> > > On Monday 08 Mar 2004 4:37 pm, Andrew Morton wrote:
> > > > "Amit S. Kale" <amitkale@emsyssoft.com> wrote:
> > > > > On Monday 08 Mar 2004 3:56 pm, Andrew Morton wrote:
> > > > >  > "Amit S. Kale" <amitkale@emsyssoft.com> wrote:
> > > > >  > > Here are features that are present only in full kgdb:
> > > > >  > >  1. Thread support  (aka info threads)
> > > > >  >
> > > > >  > argh, disaster.  I discussed this with Tom a week or so ago when
> > > > >  > it looked like this it was being chopped out and I recall being
> > > > >  > told that the discussion was referring to something else.
> > > > >  >
> > > > >  > Ho-hum, sorry.  Can we please put this back in?
> > > > >
> > > > >  Err., well this is one of the particularly dirty parts of kgdb.
> > > > > That's why it's been kept away. It takes care of correct thread
> > > > > backtraces in some rare cases.
> > > >
> > > > Let me just make sure we're taking about the same thing here.  Are
> > > > you saying that with kgdb-lite, `info threads' is completely missing,
> > > > or does it just not work correctly with threads (as opposed to
> > > > heavyweight processes)?
> > >
> > > info threads shows a list of threads. Heavy/light weight processes
> > > doesn't matter. Thread frame shown is incorrect.
> > >
> > > I looked at i386 dependent code again. Following code in it is
> > > incorrect. I never noticed it because this code is rarely used in full
> > > version of kgdb:
> > >
> > > +void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct
> > > task_struct *p)
> > > ....
> > > +	gdb_regs[_EBP] = *(int *)p->thread.esp;
> > >
> > > We can't guss ebp this way. This line should be removed.
> > >
> > > +	gdb_regs[_DS] = __KERNEL_DS;
> > > +	gdb_regs[_ES] = __KERNEL_DS;
> > > +	gdb_regs[_PS] = 0;
> > > +	gdb_regs[_CS] = __KERNEL_CS;
> > > +	gdb_regs[_PC] = p->thread.eip;
> > > +	gdb_regs[_ESP] = p->thread.esp;
> > >
> > > This should be gdb_regs[_ESP] = &p->thread.esp
> >
> > That's not correct it. It should be gdb_regs[_ESP] = p->thread.esp;
> > Even with these changes I can't get thread listing correctly.
> >
> > Here is the intrusive piece of code that helps get thread state
> > correctly. Any ideas on cleaning it?
>
> Here's where what Andi said about being able to get the pt_regs stuff
> off the stack (I think that's what he said at least) started to confuse
> me slightly.  But if I understand it right (and I never got around to

That's an in interesting idea. We can at least get first pt_regs from the 
stack. That way we can get to user space eip in case a thread is in user 
space.

The do_schedule and save all regs is definitely required if we want _exact_ 
state of all kernel threads. [exact state: all registers]

Finding function frames below pt_regs becomes difficult or impossible, as 
exact dept of stack for each function in a stack is not known. EBP chains 
allow walking "up" but not "down".
-Amit


> testing this) we can replace the do_schedule() stuffs at least with
> something like kgdb_get_pt_regs(), since (and I lost my notes on this,
> so it's probably not quite right) (thread_info->esp0)-1


  parent reply	other threads:[~2004-03-09  8:59 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-08  9:39 kgdb for mainline kernel: core-lite [patch 1/3] Amit S. Kale
2004-03-08  9:54 ` Andrew Morton
2004-03-08 10:15   ` Amit S. Kale
2004-03-08 10:26     ` Andrew Morton
2004-03-08 10:49       ` Amit S. Kale
2004-03-08 11:07         ` Andrew Morton
2004-03-08 11:20           ` Amit S. Kale
2004-03-08 11:44             ` Amit S. Kale
2004-03-08 11:54               ` Andrew Morton
2004-03-08 12:00                 ` Amit S. Kale
2004-03-08 15:19               ` Tom Rini
2004-03-08 22:26                 ` George Anzinger
2004-03-09  8:58                 ` Amit S. Kale [this message]
2004-03-08 22:19               ` George Anzinger
2004-03-09  5:08                 ` Amit S. Kale
2004-03-09 15:37                   ` Tom Rini
2004-03-08 11:48             ` Andrew Morton
2004-03-08 22:21               ` George Anzinger
2004-03-08 15:22             ` Tom Rini
2004-03-08 16:32               ` Amit S. Kale
2004-03-08 22:29               ` George Anzinger
2004-03-08 22:15         ` George Anzinger
2004-03-09  4:46           ` Amit S. Kale
2004-03-09  9:29         ` Amit S. Kale
2004-03-09  9:32           ` i386-lite [patch 2/3] [Re: kgdb for mainline kernel: core-lite [patch 1/3]] Amit S. Kale
2004-03-09 15:06           ` kgdb for mainline kernel: core-lite [patch 1/3] Tom Rini
2004-03-10  4:05             ` Amit S. Kale
     [not found] <1xpyM-2Op-21@gated-at.bofh.it>
     [not found] ` <1xqXN-44F-13@gated-at.bofh.it>
     [not found]   ` <1xr7w-4c4-9@gated-at.bofh.it>
     [not found]     ` <1xrqW-4rh-51@gated-at.bofh.it>
     [not found]       ` <1xuS8-83Q-11@gated-at.bofh.it>
2004-03-08 16:57         ` Andi Kleen
2004-03-08 17:18           ` Tom Rini
2004-03-09  4:29             ` Amit S. Kale
2004-03-09  4:36           ` Amit S. Kale
2004-03-10 12:36             ` Andi Kleen
2004-03-10 15:27               ` Tom Rini
2004-03-11  4:57                 ` Amit S. Kale
2004-03-11  5:05                   ` Randy.Dunlap
2004-03-11  5:11                   ` Andi Kleen

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=200403091428.42560.amitkale@emsyssoft.com \
    --to=amitkale@emsyssoft.com \
    --cc=akpm@osdl.org \
    --cc=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=trini@kernel.crashing.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.