public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: archer@sourceware.org, Chris Moller <cmoller@redhat.com>
Subject: Re: Proof-of-concept on fd-connected linux-nat.c server
Date: Sun, 10 May 2009 15:42:00 -0000	[thread overview]
Message-ID: <200905101642.49244.pedro@codesourcery.com> (raw)
In-Reply-To: <20090510145549.GA4932@host0.dyn.jankratochvil.net>

On Sunday 10 May 2009 15:55:49, Jan Kratochvil wrote:

> > > What do you think about implementing gdbserver.ko? 
> > 
> > What would this be solving?
> 
> ptrace interface is wrong:  Its binding on waitpid()/SIGCHLD/SIGSTOP is
> a nightmare conflicting with regular uses of waitpid/SIGCHLD/SIGSTOP.  Also
> its TID vs. PID handling is not right, just attaching to a whole process is
> a task for many screens of code in GDB.
> 
> One feature of dropping ptrace() is to make "step" faster.  While there exists
> now PTRACE_SINGLEBLOCK==DEBUGCTLMSR_BTF still the kernel can perform
> "step/"next" faster without the userland/kernelland switching, even for an
> inferior code loop on a single line of code (we want to step over).
> 
> PTRACE_SYSCALL is too general, it should be possible to stop for example only
> when inferior calls a syscall related to the specified file descriptor(s).
> 
> PTRACE_O_TRACE{FORK,VFORK,CLONE} works but it is a nightmare with new child
> tasks appearing before the original call reports the new task TID.
> 
> Also kernel (already?) contains debugging infrastructure for systemtap such as
> for placing/stepping-over breakpoints which can be reused by GDB if those
> GDB parts get appropriately disabled on the enhanced kernels.

I don't disagree with ptrace's use of signals assessment, but,
moving *gdb specific* interfaces to kernel space, and having to rely
on a kernel module seems like the wrong direction to me.  I consider
having the bulk of the work done on userspace a feature (as long as it
doesn't get in the way).

> (As i do not work on this project I may not know it all.)

Neither do I.  :-)

> > In all seriousness, I think that you're going the wrong direction
> > entirely.
> 
> Just to make it clear - my patch was just the "proof-of-concept", nothing
> I would ever want to get accepted anywhere.
> 
> Still it is not clear to me if gdbserver.ko is the right way to get rid of the
> ptrace/waitpid/SIGCHLD/SIGSTOP pain.
> 

Okay, we're talking about slightly different things.  I was talking
about the remote debugging part.  Putting too low level
actions through a remote interface is a mistake, IMO.

> > I really suggest you get acquainted with the remote
> > protocol and gdbserver, before coming up with a new solution.
> 
> May I ask why do you put effort both on linux-nat.c and gdbserver?  Isn't it
> cheaper to unify the codebase and start (transparently) using gdbserver even
> for local operations?

Probably, I think we're slowly going in that direction.  Making the
debug interface control parts of gdbserver into a library and reuse
it from gdb for native debugging (code sharing, that is) as been
suggested many times.

> > > * Removing local queue (waitpid_queue) would be IMHO good even for current FSF
> > >   GDB HEAD - 
> > 
> > It's going to happen:
> 
> http://sourceware.org/ml/gdb-patches/2009-04/msg00523.html
> > pselect/ppoll would be another fancy way, but that is unuseable, as you can
> > read on the BUGS section of the pselect man page.
> 
> As ppoll() is a way how to remove the local pipe entirely, what about
> a workaround for non-ppoll systems by using O_ASYNC/SIGIO/sigsuspend().
> Or do exist systems both without ppoll() and without O_ASYNC?

If we have to support older systems (not so old actually), and
other unixes, maintaining yet another way of waking up the
event-loop, and managing event sources, doesn't sound like it has
any benefit.  If you go the sigsuspend path, you have to
rely on signals for all kinds of wake ups and event sources;
SIGIO isn't a panacea either ---  SIGIO notifications on a pipe
doesn't work on all systems; if python or something else wants to
use it, you're in trouble too.  The self-pipe trick
works everywhere select on file descriptor works, so it
seems best to just stick to it.

-- 
Pedro Alves

      reply	other threads:[~2009-05-10 15:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-09 15:16 Jan Kratochvil
2009-05-09 19:50 ` Chris Moller
2009-05-10  9:19   ` Jan Kratochvil
2009-05-10 10:25 ` Pedro Alves
2009-05-10 14:59   ` Jan Kratochvil
2009-05-10 15:42     ` Pedro Alves [this message]

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=200905101642.49244.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=archer@sourceware.org \
    --cc=cmoller@redhat.com \
    --cc=jan.kratochvil@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).