From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12803 invoked by alias); 27 Jun 2004 20:25:02 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 12783 invoked from network); 27 Jun 2004 20:24:59 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.77.109) by sourceware.org with SMTP; 27 Jun 2004 20:24:59 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i5RKOxM1001028; Sun, 27 Jun 2004 22:24:59 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i5RKOwU2008975; Sun, 27 Jun 2004 22:24:59 +0200 (CEST) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i5RKOv26008972; Sun, 27 Jun 2004 22:24:57 +0200 (CEST) Date: Sun, 27 Jun 2004 20:25:00 -0000 Message-Id: <200406272024.i5RKOv26008972@elgar.kettenis.dyndns.org> From: Mark Kettenis To: marcel@xcllnt.net CC: gdb-patches@sources.redhat.com In-reply-to: <20040627173854.GA7904@dhcp50.pn.xcllnt.net> (message from Marcel Moolenaar on Sun, 27 Jun 2004 10:38:54 -0700) Subject: Re: [PATCH] Add libkvm interface support for NetBSD/i386 and OpenBSD/i386 References: <200406271623.i5RGN4Hd007746@elgar.kettenis.dyndns.org> <20040627163414.GB7790@dhcp50.pn.xcllnt.net> <200406271701.i5RH1wWJ007924@elgar.kettenis.dyndns.org> <20040627173854.GA7904@dhcp50.pn.xcllnt.net> X-SW-Source: 2004-06/txt/msg00613.txt.bz2 Date: Sun, 27 Jun 2004 10:38:54 -0700 From: Marcel Moolenaar > 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); } :) Hmm. Such a hack shouldn't be necessary. You might need to re-arrange some of the code a bit though. Take a look at how the unwinders are handled on i386/amd64. > 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. Many of these special cases can be handled by adding unwind information to the code. The latest gas has directives to make generating CFI for assembler code much easier. 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. This only makes sense if it is possible to define a sane interface between GDB and the "external" code. Otherwise keeping things synchronized becomes a *really big* problem. Mark