Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Marcel Moolenaar <marcel@xcllnt.net>
To: Mark Kettenis <kettenis@chello.nl>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [PATCH] Add libkvm interface support for NetBSD/i386 and OpenBSD/i386
Date: Sun, 27 Jun 2004 17:39:00 -0000	[thread overview]
Message-ID: <20040627173854.GA7904@dhcp50.pn.xcllnt.net> (raw)
In-Reply-To: <200406271701.i5RH1wWJ007924@elgar.kettenis.dyndns.org>

On Sun, Jun 27, 2004 at 07:01:58PM +0200, Mark Kettenis wrote:
> 
>    Question: since this will do backtraces in the kernel, are there
>    plans to improve the frame sniffers (or frame sniffer framework)
>    to allow this code to add a sniffer for trapframes so that it's
>    possible to trace across them (if applicable) and also to improve
>    the termination of traces in the context of non-standard frames?
> 
> Defenitely.  It should be pretty easy to add unwinders for trap and
> interrupt frames.

In a sense, yes. I needed to add a sniffer in some other context, but
had to tweak the framework a bit to allow me to add the sniffer before
the last sniffer (i.e. the default sniffer). Without that tweak the
default sniffer was tried before mine and since the default sniffer
always takes the frame, mine ended up not being used at all. Not a
big issue, but something that requires a bit of thought and rewrite
to work well in a more dynamic context. In my case the following
hack sufficed:

/* Insert a predicate before the last in the table.  */
static void
penultimate_predicate (struct frame_unwind_table *table,
                  frame_unwind_sniffer_ftype *sniffer)
{
  if (table->nr > 0)
    {
      table->sniffer = xrealloc (table->sniffer, (table->nr + 1)
                                 * sizeof (frame_unwind_sniffer_ftype *));
      table->sniffer[table->nr] = table->sniffer[table->nr - 1];
      table->sniffer[table->nr - 1] = sniffer;
      table->nr++;
    }
  else
    append_predicate(table, sniffer);
}

:)

> Termination of traces is a bit of an issue.  If there is a fool-proof
> way to detect the end of a frame-chain, then we should defenitely use
> it.  When debugging the kernel you'd probably want to terminate on
> frames that cross the protection boundary between user-space and
> kernel-space.

I think the frame sniffers can help here. However, I don't think GDB
should have all the various and weird sniffers embedded, because they
tend to be highly volatile. For example: some frames are known only
by the bounds of the function and thus can be detected only by the PC.
This can be different for every recompilation of the system to which
it applies (in theory).
In general it requires knowledge that goes beyond the ABI and runtime
specs. and it might be a good idea to off-load this to MI or CLI
clients or provide hooks so that one can easily "plug" these in.

The same would apply to the unwind library on ia64. It's easy enough
to label a frame with unwind information, but knowing what to do with
such a frame may require more knowledge than what you like the unwind
library to have. Hooks to allow some "external" code to deal with it
would probably be the most flexible solution.

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net


  reply	other threads:[~2004-06-27 17:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-27 16:23 Mark Kettenis
2004-06-27 16:34 ` Marcel Moolenaar
2004-06-27 17:02   ` Mark Kettenis
2004-06-27 17:39     ` Marcel Moolenaar [this message]
2004-06-27 19:02       ` Daniel Jacobowitz
2004-06-27 20:25       ` Mark Kettenis

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=20040627173854.GA7904@dhcp50.pn.xcllnt.net \
    --to=marcel@xcllnt.net \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kettenis@chello.nl \
    /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