Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: lgustavo@codesourcery.com
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: Feature Parity: Remote fork following
Date: Tue, 06 Aug 2013 12:30:00 -0000	[thread overview]
Message-ID: <5200BD6A.2070404@redhat.com> (raw)
In-Reply-To: <51FFF307.4070207@codesourcery.com>

On 08/05/2013 07:46 PM, Luis Machado wrote:

> Risking creating more work, how does it sound to require even the 
> single-process (target remote) mode to use PID's for context, just like 
> the extended-remote mode does? I wonder how hard that is and how much 
> work is involved there. Implementing single-process mode on top of 
> multi-process... similar to all-stop on top of non-stop.

I'm confused.  Is that any different from:

On 07/24/2013 12:45 PM, Pedro Alves wrote:
>> Originally, the multi-process extensions were always off if you connected
>> with "target remote"; they'd only be available to extended-remote.  But
>> nowadays that's no longer true -- multi-process is always available even
>> in "target remote", if the target supports them.  The push in that direction
>> had follow-fork in mind.  So, if multi-process extensions make this easier,
>> we can just require them.

> 
> A big problem is backwards compatibility in this case. There are a bunch 
> of gdbserver/gdb versions out there that would try to speak to each 
> other without mentioning PID's no matter what.

Support for the multi-process extensions is broadcast in qSupported
("multiprocess+").  This works presently.  Try connecting to gdbserver
with plain "target remote", and you'll see PIDs.  But if the target
doesn't support the extension, then GDB will still cope.  It just wont
support certain things.  Fork would just be another of those things.


>> GDB needs to undo things from the child before detaching it
>> (gdb-side breakpoints, displaced stepping, etc.).  Only if it's really
>> sure nothing will need to be removed, could pushing follow-fork-mode/detach-on-fork
>> to the remote side be useful.  I do believe such an optimization (where
>> the target handles fork following) might be useful for plain "continue until
>> SEGV in some child" scenario, but otherwise, I believe it to be better to start
>> with the basics first.  Make catch fork/vfork/exec work, and build up from
>> that.  Proper vfork handling, where you have shared memory region between parent/child
>> until TARGET_WAITKIND_VFORK_DONE (which needs RSP modelling as well) also needs to
>> be factored in.
> 
> Handling these events inside gdbserver seems to be more straightforward 
> than doing back-and-forth to inform GDB of things that are happening.
> 
> The problem i see is the lack of displaced stepping support in 
> gdbserver. Everything is controlled by GDB in this case. In the future, 
> i imagine displaced stepping will just disappear and the debugger will 
> just ask for "stepi/step" and things will happen.

Sure, that's certainly possible, but I'm also certain that there'll always
be corner cases of run control where GDB will need to be informed of the fork
events, even if most handling can be done 99% of the time of the program
run in the server.  "catch fork" is the most obvious example.  New
fork events are a necessary condition to support these catchpoints, and
everything else can be built on top, while anything beyond the
catchpoints can be seen as optimization work, IMO.  Even then, you're
_requiring_ always implementing breakpoints on the server-side that
way -- that complicates the server-side work to support forks on
software single-step targets (ARM, etc.), by a whole lot.  Seems desirable
to support those too, without too many requirements.

-- 
Pedro Alves


  reply	other threads:[~2013-08-06 12:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 19:47 Luis Machado
2013-07-24 15:45 ` Pedro Alves
2013-08-05 18:46   ` Luis Machado
2013-08-06 12:30     ` Pedro Alves [this message]
2013-08-06 12:52       ` Luis Machado

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=5200BD6A.2070404@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=lgustavo@codesourcery.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