From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24859 invoked by alias); 13 Dec 2004 22:29:34 -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 24842 invoked from network); 13 Dec 2004 22:29:28 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 13 Dec 2004 22:29:28 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id iBDMTSER013240 for ; Mon, 13 Dec 2004 17:29:28 -0500 Received: from localhost.redhat.com (vpn50-64.rdu.redhat.com [172.16.50.64]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id iBDMTRr22033; Mon, 13 Dec 2004 17:29:27 -0500 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id E6A3F3EF9; Mon, 13 Dec 2004 17:27:18 -0500 (EST) Message-ID: <41BE1743.8010902@gnu.org> Date: Mon, 13 Dec 2004 22:57:00 -0000 From: Andrew Cagney User-Agent: Mozilla Thunderbird 0.8 (X11/20041020) MIME-Version: 1.0 To: Mark Kettenis Cc: drow@false.org, gdb-patches@sources.redhat.com Subject: Re: [RFC] Use target vector inheritance for GNU/Linux References: <20041205184549.GA19814@nevyn.them.org> <41BC8521.9060107@gnu.org> <200412122107.iBCL7KEi011314@elgar.sibelius.xs4all.nl> <41BDFE94.9060401@gnu.org> <200412132134.iBDLYFHm002578@elgar.sibelius.xs4all.nl> In-Reply-To: <200412132134.iBDLYFHm002578@elgar.sibelius.xs4all.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-12/txt/msg00368.txt.bz2 Mark Kettenis wrote: > Date: Mon, 13 Dec 2004 15:41:56 -0500 > From: Andrew Cagney > > Mark Kettenis wrote: > > > Can you rename saved_xfer_partial to super_xfer_partial_hack and add a > > FIXME. It should be calling super.xfer_partial but that's not available :-( > > > > Can you explain what you're hinting at here Andrew? What makes this > > specific saved_xfer_partial so different from the other saved_xxx > > instances that the patch introduces? > > Nothing? Changing those to be consistent with this would be a logical > next step. > > I suspect I don't see the big picture like you do, and I don't see why > you'd want a super.xfer_partial_hack. This construction isn't a hack > at all; it explicitly shows how the method is inherited. However, > super_xfer_partial is perhaps a better name than saved_xfer_partial. What big picture? You're starting to make this sound like a conspiracy ;-) If we had an O-O language we could call t.super.xfer_partial; we don't so we hack around it using the global variable super_xfer_partial_hack. As I noted later, we should fix things so that the global variable hack isn't needed. But hey, in the mean time, lets fix it's name and move on. > > No it isn't. At a very low level, all Linux ports are slightly > > different. Most ports will need to adjust the generic ptrace target > > before it can be inherited by the generic Linux target. In fact I > > think that when the FETCH_INFERIOR_REGISTERS issue above is sorted > > out, you'll see that *all* Linux ports will need to do this trick of > > adjusting the ptrace target before passing it to linux_target(). > > > > (And yes, I'm fairly certain the method is still needed. While the > > problem may have been fixed in recent kernels, there are many older > > Linux kernels out there.) > > You're on the right track, however the inheritance structure that the C > code is trying to mimic is: > > i386LinuxInferior IS-A LinuxInferior IS-A PtraceInferior > > Ah but that's not how the Linux-interfaces work (unless we drop > support for multi-threading). LinuxInferior needs platform-dependent > functionality that PtraceInferior doesn't (and shouldn't) provide. That is due to limitations in the current implementation, and not due to issues with the Linux threading model (why you choose to blame GDB's design flaws on the Linux threading model I don't know). The LWP layer needs to always be active, and with that done the juggling you refer to is eliminated. However, attempting that is clearly a follow-on (and one that Daniel wizely avoided), hence my suggestion to add a function as the interum. Andrew > with the i386LinuxInferior.resume method overriding LinuxInferior.resume > (which overrid PtraceInferior.resume); and not: > > But having i386LinuxInferior override LinuxInferior.resume really > sucks because then it too has to do this insane dance of fiddling with > LWPs because of the braindamaged Linux threading model. > > LinuxInferior IS-A i386LinuxInferior IS-A PtraceInferior > > This reflects reality better, although it might even be: > > i386LinuxInferior IS-A LinuxInferior IS-A i386LinuxPtraceInferior > IS-A PtraceInferior > > But that breaks some OO rules of course. > > That the current inferior code doesn't facilitate this is a recognized > problem, but not one that we should get hung-up over. Hence my > suggestion of deprecated_set_super_linux_resume as a workaround until > that is fixed. > > It's not a problem with the current inferior code. There may be some > issues with the inferior code (like the ptrace_ops_hack), but this is > a fundamental problem with the Linux threads debugging interface. > Perhaps there simply shouldn't be a LinuxInferior: > > i386LinuxInferior IS-A PtraceInferior > > where we'de have some Linux-specific helper functions that can be used > to implement i386LinuxInferior. >