From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14425 invoked by alias); 12 Dec 2004 17:53:55 -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 14388 invoked from network); 12 Dec 2004 17:53:50 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 12 Dec 2004 17:53:50 -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 iBCHre0G007514 for ; Sun, 12 Dec 2004 12:53:50 -0500 Received: from localhost.redhat.com (vpn50-50.rdu.redhat.com [172.16.50.50]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id iBCHrZr21378; Sun, 12 Dec 2004 12:53:35 -0500 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 7D39A3EF9; Sun, 12 Dec 2004 12:51:31 -0500 (EST) Message-ID: <41BC8521.9060107@gnu.org> Date: Sun, 12 Dec 2004 17:59:00 -0000 From: Andrew Cagney User-Agent: Mozilla Thunderbird 0.8 (X11/20041020) MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: [RFC] Use target vector inheritance for GNU/Linux References: <20041205184549.GA19814@nevyn.them.org> In-Reply-To: <20041205184549.GA19814@nevyn.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-12/txt/msg00334.txt.bz2 > -LONGEST > -ia64_linux_xfer_unwind_table (struct target_ops *ops, > - enum target_object object, > - const char *annex, > - void *readbuf, const void *writebuf, > - ULONGEST offset, LONGEST len) > +LONGEST (*saved_xfer_partial) (struct target_ops *, enum target_object, > + const char *, void *, const void *, > + ULONGEST, LONGEST); > + > +static LONGEST > +ia64_linux_xfer_partial (struct target_ops *ops, > + enum target_object object, > + const char *annex, > + void *readbuf, const void *writebuf, > + ULONGEST offset, LONGEST len) > { > - return syscall (__NR_getunwind, readbuf, len); > + if (object == TARGET_OBJECT_UNWIND_TABLE && writebuf == NULL && offset == 0) > + return syscall (__NR_getunwind, readbuf, len); > + > + return saved_xfer_partial (ops, object, annex, readbuf, writebuf, > + offset, len); > +} 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 :-( +#ifndef FETCH_INFERIOR_REGISTERS + +/* Fetch register REGNUM from the inferior. */ + +static void +fetch_register (int regnum) +{ Why is this wrapped in in an #ifdef? +/* Create a generic GNU/Linux target vector. If T is non-NULL, base + the new target vector on it. */ + +struct target_ops * +linux_target (struct target_ops *t) Can this be renamed to inf_linux_target (to be consistent with the other inf_*_target() methods? > A new function, linux_target, is added to linux-nat.c. Then any GNU/Linux > target can call it, and pass the result to add_target - after specializing > whatever methods it needs to. Sometimes it's necessary to specialize a > method between inf_ptrace_target and linux_target, so it accepts an optional > argument. This wouldn't be necessary if all target methods took a > target_ops parameter, so they could call the overridden method. As in this? > +void > +_initialize_i386_linux_nat (void) > +{ > + struct target_ops *t = inf_ptrace_target (); > + > + /* Override the default ptrace resume method. */ > + t->to_resume = i386_linux_resume; > + > + /* Fill in the generic GNU/Linux methods. */ > + t = linux_target (t); which is violating the inheritance structure. Can you instead add a one-of method (deprecated_set_super_linux_resume?) to handle this case? We can then see about fixing the problem (I'm left wondering if that method is still needed). > + /* FIXME drow/2004-12-04: For now, these functions must keep the standard > + names because only some GNU/Linux targets use inf-ptrace.o. When all > + have been converted, these functions can be renamed and made static. */ Is this still true? I thought the patch was so large because it touched all the linux targets. Andrew