Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] Use target vector inheritance for GNU/Linux
Date: Sun, 12 Dec 2004 17:59:00 -0000	[thread overview]
Message-ID: <41BC8521.9060107@gnu.org> (raw)
In-Reply-To: <20041205184549.GA19814@nevyn.them.org>

> -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


  parent reply	other threads:[~2004-12-12 17:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-05 18:48 Daniel Jacobowitz
2004-12-06 14:41 ` Mark Kettenis
2004-12-06 14:43   ` Daniel Jacobowitz
2004-12-12 17:53 ` Andrew Cagney
2004-12-12 17:59 ` Andrew Cagney [this message]
2004-12-12 21:45   ` Mark Kettenis
2004-12-13 20:45     ` Andrew Cagney
2004-12-13 22:29       ` Mark Kettenis
2004-12-13 22:57         ` Andrew Cagney
2004-12-14  2:06           ` Mark Kettenis
2004-12-14 15:41             ` Andrew Cagney
2004-12-15  0:07               ` 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=41BC8521.9060107@gnu.org \
    --to=cagney@gnu.org \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    /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