Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Re: [RFC] remote.c: Add remote TLS support
Date: Fri, 15 Apr 2005 21:02:00 -0000	[thread overview]
Message-ID: <20050415140222.0e173d06@ironwood.lan> (raw)
In-Reply-To: <20050415201200.GA10217@nevyn.them.org>

On Fri, 15 Apr 2005 16:12:00 -0400
Daniel Jacobowitz <drow@false.org> wrote:

> > +      if (packet_ok (buf, &remote_protocol_qGetTLSAddr) == PACKET_OK)
> > +	{
> > +	  ULONGEST result;
> > +
> > +	  unpack_varlen_hex (buf, &result);
> > +	  return result;
> > +	}
> > +      else
> > +	{
> > +	  struct exception e
> > +	    = { RETURN_ERROR, TLS_GENERIC_ERROR,
> > +		"Remote target failed to process qGetTLSAddr request" };
> > +	  throw_exception (e);
> > +
> > +	}
> > +    }
> > +  else
> > +    {
> > +      struct exception e
> > +	= { RETURN_ERROR, TLS_GENERIC_ERROR,
> > +	    "TLS not supported or disabled on this target" };
> > +      throw_exception (e);
> > +    }
> > +  /* Not reached.  */
> > +  return 0;
> > +}
> > +
> >  static void
> >  init_remote_ops (void)
> >  {
> 
> You're still throwing the wrong exception if the packet is autodetected
> as unavailable, as far as I can tell.  You'll throw the "failed to
> process" message.

I apologize for missing this in your earlier review.  I've checked the
following change in to handle this case.

	* remote.c (remote_get_thread_local_address): Throw a more
	meaningful exception when remote target doesn't have support
	for the qGetTLSAddr packet.

Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.182
diff -u -p -r1.182 remote.c
--- remote.c	15 Apr 2005 19:58:59 -0000	1.182
+++ remote.c	15 Apr 2005 20:45:26 -0000
@@ -5344,6 +5344,7 @@ remote_get_thread_local_address (ptid_t 
       struct remote_state *rs = get_remote_state ();
       char *buf = alloca (rs->remote_packet_size);
       char *p = buf;
+      enum packet_result result;
 
       strcpy (p, "qGetTLSAddr:");
       p += strlen (p);
@@ -5356,13 +5357,21 @@ remote_get_thread_local_address (ptid_t 
 
       putpkt (buf);
       getpkt (buf, rs->remote_packet_size, 0);
-      if (packet_ok (buf, &remote_protocol_qGetTLSAddr) == PACKET_OK)
+      result = packet_ok (buf, &remote_protocol_qGetTLSAddr);
+      if (result == PACKET_OK)
 	{
 	  ULONGEST result;
 
 	  unpack_varlen_hex (buf, &result);
 	  return result;
 	}
+      else if (result == PACKET_UNKNOWN)
+	{
+	  struct exception e
+	    = { RETURN_ERROR, TLS_GENERIC_ERROR,
+		"Remote target doesn't support qGetTLSAddr packet" };
+	  throw_exception (e);
+	}
       else
 	{
 	  struct exception e


  parent reply	other threads:[~2005-04-15 21:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-31 23:20 Kevin Buettner
2005-03-31 23:43 ` Daniel Jacobowitz
2005-04-15 20:09 ` Kevin Buettner
2005-04-15 20:12   ` Daniel Jacobowitz
2005-04-15 20:30     ` Kevin Buettner
2005-04-15 21:02     ` Kevin Buettner [this message]
2005-04-16  9:14   ` Eli Zaretskii
2005-04-22 13:14   ` Eli Zaretskii
2005-04-26 23:39     ` Kevin Buettner

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=20050415140222.0e173d06@ironwood.lan \
    --to=kevinb@redhat.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