* remote.c (remote_get_thread_local_address): Throw a more
authorKevin Buettner <kevinb@redhat.com>
Fri, 15 Apr 2005 20:55:56 +0000 (20:55 +0000)
committerKevin Buettner <kevinb@redhat.com>
Fri, 15 Apr 2005 20:55:56 +0000 (20:55 +0000)
meaningful exception when remote target doesn't have support
for the qGetTLSAddr packet.

gdb/ChangeLog
gdb/remote.c

index 98aedfca504600d1852a113d3405cac72135d017..60fd1938d29970d7dcbfc9ccb03c9ff7c81d6722 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-15  Kevin Buettner  <kevinb@redhat.com>
+
+       * remote.c (remote_get_thread_local_address): Throw a more
+       meaningful exception when remote target doesn't have support
+       for the qGetTLSAddr packet.
+
 2005-04-15  Kevin Buettner  <kevinb@redhat.com>
 
        * remote.c (remote_protocol_qGetTLSAddr): New static global variable.
index 99b6421da39f515bae8989713526f8c32165d84e..91166178dbb6e449bf145260e80398808750f93a 100644 (file)
@@ -5344,6 +5344,7 @@ remote_get_thread_local_address (ptid_t ptid, CORE_ADDR lm, CORE_ADDR offset)
       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 ptid, CORE_ADDR lm, CORE_ADDR offset)
 
       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