Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@ges.redhat.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFC: ``detach remote''
Date: Wed, 07 Aug 2002 15:31:00 -0000	[thread overview]
Message-ID: <3D519FB2.6090605@ges.redhat.com> (raw)
In-Reply-To: <20020807194959.GA1535@nevyn.them.org>


> I hate extended-remote (current implementation) :)  My reasons for
> hating it have to do with no separation between the local- and remote-
> commands; in other words, the fact that "kill" doesn't kill the debug
> agent, etc.

Ignoring the implementation, there are a strong architectural grounds 
for the extended-remote behavour.

> Do you know of stubs which use extended-remote?  If it's only gdbserver
> and similar process-level stubs (like maybe the libremote which people
> keep saying will be released soon?), we have some flexibility with its
> semantics.

The only one that is of concern here is gdb/gdbserver.  Given, to enable 
extended-remote, the user has to type:

	(gdb) remote extended-remote ....

I don't think many people use or know about it.

I also suspect that recent changes, such as daemon mode, may have had 
unexepcted consequences.  Unless you hang onto the process and/or add 
mechanisms for attaching to a new process, daemon mode is pretty 
useless.  The latter would be correct, sounds like the former is what 
happened :-(

>> In ``remote'' mode.  A detach command should: drop the tcp connection; 
>> set the process free.
>> 
>> In ``extended-remote'' mode.  A detach coommand should: set the process 
>> free.  (Lets also ignore that there is no attach mechanism :-).
>> 
>> That leaves the question of how to implement it using protocol 
>> mechanisms.  The ``D'' is messed up, GDB sends the D and then totally 
>> ignores the reply.
> 
> 
> Actually, it consumes the reply; if it's an Enn packet the detach is
> aborted.  It just doesn't care if the remote acknowledges ("OK") or
> ignores ("") the "D".

Ok.

>> As for remote debug agents, the ones I've used (pretty sure this applied 
>> to gdbserver when I last used it) quit as soon as the connection went 
>> down.  An explict daemon mode was required to make them hang around.
> 
> 
> Let's compare this idea with current reality, for reference: for both
> Linux (non-i386; i386's is really fancy, and actually resumes on
> detach, and has interesting process-level-debug hooks.  I'm talking
> about the simpler MIPS and PowerPC stubs) kgdb stubs and gdbserver,
> which are the only stubs I'm really familiar with, detach causes the
> connection to close but the process to remain stopped and the debug
> agent to wait for a reconnection.  This is independent of which
> extended-remote mode we're in.  I believe gdbserver's behaved this way
> for a couple of years at least.

There are two categories of remote target.

- remote board/stub
- remote process/server

A board is always there, power cycle it, kick it, disconnect it, 
reconnect to it, and it is still there.  GDB is talking to a very raw 
and very permenant target.  The lifetime of the debug agent and the 
corresponding board are the same (ignoring a few esoteric edge 
conditions which really fall into remote process).

A process is more tempoary.  Both the remote connection and the process 
have lifetimes and their lifetimes are independant.  Drop the connection 
and the process still runs.  Kill the process and the connection is 
still live.

Extended-remote was added (I believe) to handle the second case -- a 
remote process.

I think it is a failure to clearly differentiate between thses two cases 
(and recongnise that the connection and remote process can have 
different lifetimes) that has lead to the problems we have here.

 > I don't like the idea of changing ``detach'' to mean resume.  Detach,
 > it seems to me, should be the same as breaking the connection; and
 > resume should have to be explicit.

Er, detach should behave according to its specification vis:

  (gdb) help detach
  Detach a process or file previously attached.
  If a process, it is no longer traced, and it continues its
  execution.  If you were debugging a file, the file is closed and gdb
  no longer accesses it.

In the case of a remote process that should [I think clearly] apply to 
the process and not the connection.

If the intent is to drop the connection, then something like ``target 
none'' or ``target child''.

 > What do you think of this idea, regardless of remote vs extended-remote
 > (which I think should behave consistently in this regard):
 >
 > detach:
 >   Close the remote connection, stub waits
 > attach:
 >   N/A, this is a local attach
 >
 > new command "remote detach":
 >   Debug agent detaches/resumes the program being debugged
 >   The agent may or may not hang around (say, remote agents probably
 > don't, extended-remote agents probably do?)

The user enters ``detach'' to disconnect from the process.  Who cares if 
it is local or remote.

 > For extended-remote (only?), new command "remote attach"
 >   Debug agent attaches to a new program

The user enters ``attach PID''.  Again, who cares if it is local or remote.

--

I think, the easiest way of doing things is to have:

	target remote FOO

negotiate extended-remote.  If the target supports it then enable it. 
Otherwize fall back to primative remote that we see now.

enjoy,
Andrew



  reply	other threads:[~2002-08-07 22:31 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-06 14:00 Daniel Jacobowitz
2002-08-06 22:17 ` Eli Zaretskii
2002-08-07 12:31 ` Andrew Cagney
2002-08-07 12:49   ` Daniel Jacobowitz
2002-08-07 15:31     ` Andrew Cagney [this message]
2002-08-08  6:24       ` Daniel Jacobowitz
2002-08-09 10:48         ` Andrew Cagney
2002-08-10 20:01           ` Daniel Jacobowitz
2002-08-11  8:15             ` Andrew Cagney
2002-08-11  9:35               ` Daniel Jacobowitz
2002-08-11  9:42                 ` Andrew Cagney
2002-08-11  9:52                   ` Daniel Jacobowitz
2002-08-11 11:02                 ` Andrew Cagney
2002-08-11 11:34                   ` Daniel Jacobowitz
2002-08-11 13:52                     ` Daniel Jacobowitz
2002-08-12  7:36                       ` Andrew Cagney
2002-08-12  7:47                         ` Daniel Jacobowitz
2002-08-29 15:07                           ` Daniel Jacobowitz
2002-09-03 14:32                             ` Andrew Cagney
2002-09-03 14:41                               ` Daniel Jacobowitz
2002-09-03 22:04                                 ` Eli Zaretskii
2002-09-03 22:04                               ` Eli Zaretskii
2002-09-03 22:14                               ` Eli Zaretskii
2002-08-12 10:29                         ` Eli Zaretskii

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=3D519FB2.6090605@ges.redhat.com \
    --to=ac131313@ges.redhat.com \
    --cc=drow@mvista.com \
    --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