Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: Re: [commit] remote: make the whole connection setup exception safe
Date: Fri, 10 Oct 2008 14:54:00 -0000	[thread overview]
Message-ID: <200810101553.57601.pedro@codesourcery.com> (raw)
In-Reply-To: <200810090429.45346.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

Sorry, this broke `target extended-remote' if the stub reports that
it isn't controlling any process yet (gdbserver --multi).  I missed
that there's a return statement in the middle of remote_start_remote,
which makes us not send '!' in that case.

remote_start_remote:
  if (rs->buf[0] == 'W' || rs->buf[0] == 'X')
    {
      if (args->extended_p)
	{
	  /* We're connected, but not running.  Drop out before we
	     call start_remote.  */
	  target_mark_exited (args->target);
	  return;
	}

Fixed by just sending '!' earlier, like below.  Checked in.

We should have a test for extended/persistent connections.  Let me
cook something up.

-- 
Pedro Alves

[-- Attachment #2: extended.diff --]
[-- Type: text/x-diff, Size: 1325 bytes --]

2008-10-10  Pedro Alves  <pedro@codesourcery.com>

	gdb/
	* remote.c (remote_start_remote): Always tell the stub if we're in
	extended-remote.

---
 gdb/remote.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Index: src/gdb/remote.c
===================================================================
--- src.orig/gdb/remote.c	2008-10-09 15:57:48.000000000 +0100
+++ src/gdb/remote.c	2008-10-10 14:58:30.000000000 +0100
@@ -2419,6 +2419,13 @@ remote_start_remote (struct ui_out *uiou
 	rs->noack_mode = 1;
     }
 
+  if (args->extended_p)
+    {
+      /* Tell the remote that we are using the extended protocol.  */
+      putpkt ("!");
+      getpkt (&rs->buf, &rs->buf_size, 0);
+    }
+
   /* Next, if the target can specify a description, read it.  We do
      this before anything involving memory or registers.  */
   target_find_description ();
@@ -2482,13 +2489,6 @@ remote_start_remote (struct ui_out *uiou
   immediate_quit--;
   start_remote (args->from_tty); /* Initialize gdb process mechanisms.  */
 
-  if (args->extended_p)
-    {
-      /* Tell the remote that we are using the extended protocol.  */
-      putpkt ("!");
-      getpkt (&rs->buf, &rs->buf_size, 0);
-    }
-
   /* If we connected to a live target, do some additional setup.  */
   if (target_has_execution)
     {

      reply	other threads:[~2008-10-10 14:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-09  3:30 Pedro Alves
2008-10-10 14:54 ` 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=200810101553.57601.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /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