Fix GDB build failure when $development is false
[deliverable/binutils-gdb.git] / gdb / remote.c
index fe2771316cbc63c23302c71d96c01ebb65b95ce5..81c772a5451cf62e0ea7d61fb79ad445fd9d3c56 100644 (file)
@@ -1,6 +1,6 @@
 /* Remote target communications for serial-line targets in custom GDB protocol
 
-   Copyright (C) 1988-2017 Free Software Foundation, Inc.
+   Copyright (C) 1988-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -2268,7 +2268,10 @@ static const char *
 remote_thread_name (struct target_ops *ops, struct thread_info *info)
 {
   if (info->priv != NULL)
-    return get_remote_thread_info (info)->name.c_str ();
+    {
+      const std::string &name = get_remote_thread_info (info)->name;
+      return !name.empty () ? name.c_str () : NULL;
+    }
 
   return NULL;
 }
@@ -3074,13 +3077,14 @@ remote_get_threads_with_ql (struct target_ops *ops,
 static void
 start_thread (struct gdb_xml_parser *parser,
              const struct gdb_xml_element *element,
-             void *user_data, VEC(gdb_xml_value_s) *attributes)
+             void *user_data,
+             std::vector<gdb_xml_value> &attributes)
 {
   struct threads_listing_context *data
     = (struct threads_listing_context *) user_data;
   struct gdb_xml_value *attr;
 
-  char *id = (char *) xml_find_attribute (attributes, "id")->value;
+  char *id = (char *) xml_find_attribute (attributes, "id")->value.get ();
   ptid_t ptid = read_ptid (id, NULL);
 
   data->items.emplace_back (ptid);
@@ -3088,15 +3092,15 @@ start_thread (struct gdb_xml_parser *parser,
 
   attr = xml_find_attribute (attributes, "core");
   if (attr != NULL)
-    item.core = *(ULONGEST *) attr->value;
+    item.core = *(ULONGEST *) attr->value.get ();
 
   attr = xml_find_attribute (attributes, "name");
   if (attr != NULL)
-    item.name = (const char *) attr->value;
+    item.name = (const char *) attr->value.get ();
 
   attr = xml_find_attribute (attributes, "handle");
   if (attr != NULL)
-    item.thread_handle = hex2bin ((const char *) attr->value);
+    item.thread_handle = hex2bin ((const char *) attr->value.get ());
 }
 
 static void
@@ -3319,7 +3323,10 @@ remote_threads_extra_info (struct target_ops *self, struct thread_info *tp)
       struct thread_info *info = find_thread_ptid (tp->ptid);
 
       if (info != NULL && info->priv != NULL)
-       return get_remote_thread_info (info)->extra.c_str ();
+       {
+         const std::string &extra = get_remote_thread_info (info)->extra;
+         return !extra.empty () ? extra.c_str () : NULL;
+       }
       else
        return NULL;
     }
This page took 0.027917 seconds and 4 git commands to generate.