Yes, this works for OpenOCD as well. Thanks! On Mon, Sep 18, 2017 at 4:44 AM, Tamas Berghammer <tbergham...@google.com> wrote:
> Hi Vadim, > > 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? > > Thanks, > Tamas > > On Sat, Sep 16, 2017 at 4:54 AM Vadim Chugunov via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > >> Author: vadimcn >> Date: Fri Sep 15 20:53:13 2017 >> New Revision: 313442 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=313442&view=rev >> Log: >> Fix compatibility with OpenOCD debug stub. >> >> OpenOCD sends register classes as two separate <feature> nodes, fixed >> parser to process both of them. >> >> 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. >> >> Modified: >> lldb/trunk/source/Plugins/Process/gdb-remote/ >> GDBRemoteCommunicationClient.cpp >> lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp >> >> Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ >> GDBRemoteCommunicationClient.cpp >> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/ >> Plugins/Process/gdb-remote/GDBRemoteCommunicationClient. >> cpp?rev=313442&r1=313441&r2=313442&view=diff >> ============================================================ >> ================== >> --- lldb/trunk/source/Plugins/Process/gdb-remote/ >> GDBRemoteCommunicationClient.cpp (original) >> +++ lldb/trunk/source/Plugins/Process/gdb-remote/ >> GDBRemoteCommunicationClient.cpp Fri Sep 15 20:53:13 2017 >> @@ -2624,8 +2624,7 @@ size_t GDBRemoteCommunicationClient::Get >> * tid. >> * Assume pid=tid=1 in such cases. >> */ >> - if (response.IsUnsupportedResponse() && thread_ids.size() == 0 && >> - IsConnected()) { >> + if (thread_ids.size() == 0 && IsConnected()) { >> thread_ids.push_back(1); >> } >> } else { >> >> Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ >> ProcessGDBRemote.cpp >> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/ >> Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev= >> 313442&r1=313441&r2=313442&view=diff >> ============================================================ >> ================== >> --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp >> (original) >> +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp >> Fri Sep 15 20:53:13 2017 >> @@ -4168,7 +4168,6 @@ struct GdbServerTargetInfo { >> std::string osabi; >> stringVec includes; >> RegisterSetMap reg_set_map; >> - XMLNode feature_node; >> }; >> >> bool ParseRegisters(XMLNode feature_node, GdbServerTargetInfo >> &target_info, >> @@ -4374,8 +4373,8 @@ bool ProcessGDBRemote::GetGDBServerRegis >> >> XMLNode target_node = xml_document.GetRootElement("target"); >> if (target_node) { >> - XMLNode feature_node; >> - target_node.ForEachChildElement([&target_info, &feature_node]( >> + std::vector<XMLNode> feature_nodes; >> + target_node.ForEachChildElement([&target_info, &feature_nodes]( >> const XMLNode &node) -> bool { >> llvm::StringRef name = node.GetName(); >> if (name == "architecture") { >> @@ -4387,7 +4386,7 @@ bool ProcessGDBRemote::GetGDBServerRegis >> if (!href.empty()) >> target_info.includes.push_back(href.str()); >> } else if (name == "feature") { >> - feature_node = node; >> + feature_nodes.push_back(node); >> } else if (name == "groups") { >> node.ForEachChildElementWithName( >> "group", [&target_info](const XMLNode &node) -> bool { >> @@ -4423,7 +4422,7 @@ bool ProcessGDBRemote::GetGDBServerRegis >> // set the Target's architecture yet, so the ABI is also >> potentially >> // incorrect. >> ABISP abi_to_use_sp = ABI::FindPlugin(shared_from_this(), >> arch_to_use); >> - if (feature_node) { >> + for (auto &feature_node : feature_nodes) { >> ParseRegisters(feature_node, target_info, this->m_register_info, >> abi_to_use_sp, cur_reg_num, reg_offset); >> } >> >> >> _______________________________________________ >> lldb-commits mailing list >> lldb-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits >> >
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits