This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] remote.c: Add remote TLS support


Nice to see this checked in.

On Fri, Apr 15, 2005 at 01:09:13PM -0700, Kevin Buettner wrote:
> +static CORE_ADDR
> +remote_get_thread_local_address (ptid_t ptid, CORE_ADDR lm, CORE_ADDR offset)
> +{
> +  if (remote_protocol_qGetTLSAddr.support != PACKET_DISABLE)
> +    {
> +      struct remote_state *rs = get_remote_state ();
> +      char *buf = alloca (rs->remote_packet_size);
> +      char *p = buf;
> +
> +      strcpy (p, "qGetTLSAddr:");
> +      p += strlen (p);
> +      p += hexnumstr (p, PIDGET (ptid));
> +      *p++ = ',';
> +      p += hexnumstr (p, offset);
> +      *p++ = ',';
> +      p += hexnumstr (p, lm);
> +      *p++ = '\0';
> +
> +      putpkt (buf);
> +      getpkt (buf, rs->remote_packet_size, 0);
> +      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.

-- 
Daniel Jacobowitz
CodeSourcery, LLC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]