public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Owens <kaos@sgi.com>
To: Tigran Aivazian <tigran@veritas.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Jan Hubicka <jh@suse.cz>,
	Jack F Vogel <jfv@bluesong.net>,
	linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>
Subject: Re: [discuss] booting a kernel compiled with -mregparm=0
Date: Wed, 19 Jan 2005 07:38:26 +1100	[thread overview]
Message-ID: <7152.1106080706@kao2.melbourne.sgi.com> (raw)
In-Reply-To: Your message of "Mon, 17 Jan 2005 09:30:17 -0000." <Pine.LNX.4.61.0501170909040.4593@ezer.homenet>

On Mon, 17 Jan 2005 09:30:17 +0000 (GMT), 
Tigran Aivazian <tigran@veritas.com> wrote:
>Hmmm, interesting, then -g compiled Linux kernel should also be useable, 
>with perhaps some tweaks to kdb to decode these frames correctly, right?

kdb on i386 uses heuristics to guess at what parameters have been
passed on stack.  When the parameters are passed by register, there is
not enough information in the code to work out which parameters have
been passed nor what gcc has done with them once the function has been
entered.

Why use heuristics and guess?  Because when kdb was started we were
still using a.out and stabs.  In those days there was no way for code
in the running kernel to access the kernel's debugging information to
track the parameter and register usage.

Since then the world has moved on.  The IA64 ABI mandates that the
information required to do backtrace is stored in the running kernel,
and kdb uses that unwind data, including tracking parameters passed in
registers.

Nobody has been concerned enough about the backtraces on i386 and
x86_64 to add the required unwind data to the kernel for those
platforms.  If you want to extract the dwarf data from a kernel
compiled with -g, include the dwarf data in the running kernel and add
a dwarf unwinder to the kernel then I will happily accept patches to
kdb.  Don't forget about support for adding and removing unwind data as
modules are loaded and unloaded.

To hpa: kdb is designed to run completely in kernel.  It is not (repeat
not) intended to be a remote client debugger.

BTW, even on IA64 which has unwind data, we still get problems because
the unwind data only says what parameters are passed in registers, it
says nothing about register reuse.  gcc can reuse a parameter register
if the parameter value is no longer required, for example :-

  void function foo(struct bar *b)
  {
    // On entry, ia64 r32 contains *b
    int i = b->i;
    // If b is not used after this point, gcc can reuse r32 for the value of i.
    // Debugging after this point will show a misleading value in r32 for b.
    ...
  }


  parent reply	other threads:[~2005-01-18 20:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-14 16:34 booting a kernel compiled with -mregparm=0 Tigran Aivazian
2005-01-14 20:56 ` [discuss] " Jan Hubicka
2005-01-14 21:28   ` linux-os
2005-01-15  2:29     ` H. Peter Anvin
2005-01-17  9:30       ` Tigran Aivazian
2005-01-17  9:53         ` Arjan van de Ven
2005-01-17 10:04           ` Tigran Aivazian
2005-01-17 18:10             ` H. Peter Anvin
2005-01-17 20:22               ` Andi Kleen
2005-01-17 20:38                 ` H. Peter Anvin
2005-01-17 22:08                   ` Andi Kleen
2005-01-18 11:25                   ` Tigran Aivazian
2005-01-18 11:51                     ` Arjan van de Ven
2005-01-18 13:04                     ` Tigran Aivazian
2005-01-18 13:16                       ` Tigran Aivazian
2005-01-17 10:59         ` Andi Kleen
2005-01-17 13:17           ` Tigran Aivazian
2005-01-17 16:38         ` Linus Torvalds
2005-01-18 20:38         ` Keith Owens [this message]
2005-01-18 23:15           ` 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=7152.1106080706@kao2.melbourne.sgi.com \
    --to=kaos@sgi.com \
    --cc=hpa@zytor.com \
    --cc=jfv@bluesong.net \
    --cc=jh@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tigran@veritas.com \
    --cc=torvalds@osdl.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