public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Amit S. Kale" <amitkale@emsyssoft.com>
To: Daniel Jacobowitz <dan@debian.org>
Cc: George Anzinger <george@mvista.com>, Pavel Machek <pavel@suse.cz>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	KGDB bugreports <kgdb-bugreport@lists.sourceforge.net>,
	Matt Mackall <mpm@selenic.com>,
	discuss@x86-64.org, Tom Rini <trini@kernel.crashing.org>
Subject: Re: KGDB 2.0.3 with fixes and development in ethernet interface
Date: Thu, 22 Jan 2004 11:19:23 +0530	[thread overview]
Message-ID: <200401221119.24021.amitkale@emsyssoft.com> (raw)
In-Reply-To: <20040121183940.GA23200@nevyn.them.org>

On Thursday 22 Jan 2004 12:09 am, Daniel Jacobowitz wrote:
> On Wed, Jan 21, 2004 at 07:16:48PM +0530, Amit S. Kale wrote:
> > Now back to gdb problem of not being able to locate registers.
> > schedule results in code of this form:
> >
> > schedule:
> > framesetup
> > registers save
> > ...
> > ...
> > save registers
> > change esp
> > call switchto
> > restore registers
> > ...
> > ...
> >
> > GDB can't analyze code other than frame setup and registers save. It may
> > not show values of variables that are present in registers correctly.
> > This used to be a problem some time ago (gdb 5.X). Perhaps gdb 6.x does a
> > better job. hmm...
> > May be its time I should look at gdb's x86 register info code again.
>
> You should try GDB 6.0, which will use the dwarf2 unwind information to
> accurately locate registers in any GCC-compiled code with -gdwarf-2 (-g
> on Linux targets).

Here is the code generated for function schedule. #APP where assembly inline 
code is emitted. I believe gdb has correct register information available 
from gcc upto .LBB197. kgdb reports a thread having stopped at label 1. 
eax->edx aren't saved explicitely, so we can't have debugging info telling it 
how they are saved. Figuring out eax->edx is of lesser importance as it's the 
function that calls schedule that we are usually interested in. If gdb gets 
ebp right, that can be done corretly. GDB 5.2 had a difficulties walking up a 
stack in absence of ebp. GDB 6.0 can work with just esp, I believe.

.LBE195:
	movl	104(%ebx), %eax
	testl	%eax, %eax
	je	.L466
.L421:
	.loc 1 823 0
.LBB197:
	movl	%ebx, %eax
	movl	%esi, %edx
#APP
	pushfl
	pushl %ebp
	movl %esp,852(%ebx)
	movl 852(%esi),%esp
	movl $1f,848(%ebx)
	pushl 848(%esi)
	jmp __switch_to
1:	popl %ebp
	popfl
#NO_APP
	movl	%eax, -48(%ebp)
	.loc 1 1592 0

I guess we can keep the CONFIG_KGDB_THREAD code in entry.S optional only, 
which should be enabled only if one wants to debug function schedule. It 
shouldn't be enabled on i386.

CONFIG_KGDB_THREAD save code will still be required on other processors. 
Powerpc for example has _switch assembly function that does a lot of things, 
including saving registers on stack.
-- 
Amit Kale
EmSysSoft (http://www.emsyssoft.com)
KGDB: Linux Kernel Source Level Debugger (http://kgdb.sourceforge.net)


  parent reply	other threads:[~2004-01-22  5:49 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16 12:29 KGDB 2.0.3 with fixes and development in ethernet interface Amit S. Kale
2004-01-16 12:58 ` Pavel Machek
2004-01-16 14:07   ` Christoph Hellwig
2004-01-16 14:24     ` Amit S. Kale
2004-01-16 14:17   ` Amit S. Kale
2004-01-16 14:45     ` Pavel Machek
2004-01-16 13:05 ` [discuss] " Andi Kleen
2004-01-16 14:21   ` Amit S. Kale
2004-01-16 14:45     ` Pavel Machek
2004-01-16 15:12       ` Amit S. Kale
2004-01-16 14:47     ` Pavel Machek
2004-01-16 15:15       ` Amit S. Kale
2004-01-16 15:52         ` Pavel Machek
2004-01-17  6:27           ` KGDB documentation [Re: [discuss] KGDB 2.0.3 with fixes and development in ethernet interface] Amit S. Kale
2004-01-17  9:00             ` George Anzinger
2004-01-16 18:39     ` [discuss] KGDB 2.0.3 with fixes and development in ethernet interface Matt Mackall
2004-01-16 16:13 ` Pavel Machek
2004-01-16 20:48 ` George Anzinger
2004-01-16 21:51 ` Pavel Machek
2004-01-17  1:23   ` George Anzinger
2004-01-17  9:29     ` Amit S. Kale
2004-01-17 19:54       ` George Anzinger
2004-01-21 13:46         ` Amit S. Kale
2004-01-21 18:39           ` Daniel Jacobowitz
2004-01-21 23:14             ` George Anzinger
2004-01-22  5:49             ` Amit S. Kale [this message]
2004-01-22 20:33               ` Daniel Jacobowitz
2004-01-21 23:00           ` George Anzinger
2004-01-22  5:09             ` Amit S. Kale
2004-01-22 17:20               ` Tom Rini
2004-01-22 22:54                 ` George Anzinger
2004-01-22 22:57                   ` Daniel Jacobowitz
2004-01-23 19:10               ` Tom Rini

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=200401221119.24021.amitkale@emsyssoft.com \
    --to=amitkale@emsyssoft.com \
    --cc=dan@debian.org \
    --cc=discuss@x86-64.org \
    --cc=george@mvista.com \
    --cc=kgdb-bugreport@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=pavel@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox