<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">That is the reason I asked for the patch to verify "l" was the only thing received before it goes and makes up a fake thread ID...<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 18, 2017, at 4:44 AM, Tamas Berghammer via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Vadim,<div class=""><br class=""></div><div class="">This change broke remote debugging on Linux and Android as for some reason LLDB sends a qfThreadInfo on those platforms before starting a process (not sure why, will investigate when I have a bit more time) and lldb-server sends an OK response to it. After your change it will generate a valid thread ID what will cause LLDB to get confused and fail to lunch a process. I submitted a fix as r313525 what should work both for OpenOCD and for Linux/Android but can you verify the OpenOCD part?</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Tamas</div><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Sat, Sep 16, 2017 at 4:54 AM Vadim Chugunov via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank" class="">lldb-commits@lists.llvm.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: vadimcn<br class="">
Date: Fri Sep 15 20:53:13 2017<br class="">
New Revision: 313442<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=313442&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=313442&view=rev</a><br class="">
Log:<br class="">
Fix compatibility with OpenOCD debug stub.<br class="">
<br class="">
OpenOCD sends register classes as two separate <feature> nodes, fixed parser to process both of them.<br class="">
<br class="">
OpenOCD returns "l" in response to "qfThreadInfo", so IsUnsupportedResponse() was false and we were ending up without any threads in the process. I think it's reasonable to assume that there's always at least one thread.<br class="">
<br class="">
Modified:<br class="">
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp<br class="">
    lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp<br class="">
<br class="">
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=313442&r1=313441&r2=313442&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp?rev=313442&r1=313441&r2=313442&view=diff</a><br class="">
==============================================================================<br class="">
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp (original)<br class="">
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp Fri Sep 15 20:53:13 2017<br class="">
@@ -2624,8 +2624,7 @@ size_t GDBRemoteCommunicationClient::Get<br class="">
      * tid.<br class="">
      * Assume pid=tid=1 in such cases.<br class="">
     */<br class="">
-    if (response.IsUnsupportedResponse() && thread_ids.size() == 0 &&<br class="">
-        IsConnected()) {<br class="">
+    if (thread_ids.size() == 0 && IsConnected()) {<br class="">
       thread_ids.push_back(1);<br class="">
     }<br class="">
   } else {<br class="">
<br class="">
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=313442&r1=313441&r2=313442&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=313442&r1=313441&r2=313442&view=diff</a><br class="">
==============================================================================<br class="">
--- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original)<br class="">
+++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Fri Sep 15 20:53:13 2017<br class="">
@@ -4168,7 +4168,6 @@ struct GdbServerTargetInfo {<br class="">
   std::string osabi;<br class="">
   stringVec includes;<br class="">
   RegisterSetMap reg_set_map;<br class="">
-  XMLNode feature_node;<br class="">
 };<br class="">
<br class="">
 bool ParseRegisters(XMLNode feature_node, GdbServerTargetInfo &target_info,<br class="">
@@ -4374,8 +4373,8 @@ bool ProcessGDBRemote::GetGDBServerRegis<br class="">
<br class="">
     XMLNode target_node = xml_document.GetRootElement("target");<br class="">
     if (target_node) {<br class="">
-      XMLNode feature_node;<br class="">
-      target_node.ForEachChildElement([&target_info, &feature_node](<br class="">
+      std::vector<XMLNode> feature_nodes;<br class="">
+      target_node.ForEachChildElement([&target_info, &feature_nodes](<br class="">
                                           const XMLNode &node) -> bool {<br class="">
         llvm::StringRef name = node.GetName();<br class="">
         if (name == "architecture") {<br class="">
@@ -4387,7 +4386,7 @@ bool ProcessGDBRemote::GetGDBServerRegis<br class="">
           if (!href.empty())<br class="">
             target_info.includes.push_back(href.str());<br class="">
         } else if (name == "feature") {<br class="">
-          feature_node = node;<br class="">
+          feature_nodes.push_back(node);<br class="">
         } else if (name == "groups") {<br class="">
           node.ForEachChildElementWithName(<br class="">
               "group", [&target_info](const XMLNode &node) -> bool {<br class="">
@@ -4423,7 +4422,7 @@ bool ProcessGDBRemote::GetGDBServerRegis<br class="">
       // set the Target's architecture yet, so the ABI is also potentially<br class="">
       // incorrect.<br class="">
       ABISP abi_to_use_sp = ABI::FindPlugin(shared_from_this(), arch_to_use);<br class="">
-      if (feature_node) {<br class="">
+      for (auto &feature_node : feature_nodes) {<br class="">
         ParseRegisters(feature_node, target_info, this->m_register_info,<br class="">
                        abi_to_use_sp, cur_reg_num, reg_offset);<br class="">
       }<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
lldb-commits mailing list<br class="">
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank" class="">lldb-commits@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br class="">
</blockquote></div></div>
_______________________________________________<br class="">lldb-commits mailing list<br class=""><a href="mailto:lldb-commits@lists.llvm.org" class="">lldb-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits<br class=""></div></blockquote></div><br class=""></div></body></html>