[Lldb-commits] [lldb] 2494243 - [lldb] Move QThreadSuffixSupported and QListThreadsInStopReply into llgs

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 14 12:09:09 PDT 2021


Author: Pavel Labath
Date: 2021-04-14T21:08:55+02:00
New Revision: 2494243ed3f2ec2d7aba6e879fff47ff0ed71683

URL: https://github.com/llvm/llvm-project/commit/2494243ed3f2ec2d7aba6e879fff47ff0ed71683
DIFF: https://github.com/llvm/llvm-project/commit/2494243ed3f2ec2d7aba6e879fff47ff0ed71683.diff

LOG: [lldb] Move QThreadSuffixSupported and QListThreadsInStopReply into llgs

These were in the shared llgs+platform code, but they only make sense
for llgs (as they deal with how the server reports information about
debugged processes).

Added: 
    

Modified: 
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
    lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
index a0d88b3ab9883..78ee77f787324 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
@@ -60,8 +60,7 @@ GDBRemoteCommunicationServerCommon::GDBRemoteCommunicationServerCommon(
     const char *comm_name, const char *listener_name)
     : GDBRemoteCommunicationServer(comm_name, listener_name),
       m_process_launch_info(), m_process_launch_error(), m_proc_infos(),
-      m_proc_infos_index(0), m_thread_suffix_supported(false),
-      m_list_threads_in_stop_reply(false) {
+      m_proc_infos_index(0) {
   RegisterMemberFunctionHandler(StringExtractorGDBRemote::eServerPacketType_A,
                                 &GDBRemoteCommunicationServerCommon::Handle_A);
   RegisterMemberFunctionHandler(
@@ -85,9 +84,6 @@ GDBRemoteCommunicationServerCommon::GDBRemoteCommunicationServerCommon(
   RegisterMemberFunctionHandler(
       StringExtractorGDBRemote::eServerPacketType_qLaunchSuccess,
       &GDBRemoteCommunicationServerCommon::Handle_qLaunchSuccess);
-  RegisterMemberFunctionHandler(
-      StringExtractorGDBRemote::eServerPacketType_QListThreadsInStopReply,
-      &GDBRemoteCommunicationServerCommon::Handle_QListThreadsInStopReply);
   RegisterMemberFunctionHandler(
       StringExtractorGDBRemote::eServerPacketType_qEcho,
       &GDBRemoteCommunicationServerCommon::Handle_qEcho);
@@ -133,9 +129,6 @@ GDBRemoteCommunicationServerCommon::GDBRemoteCommunicationServerCommon(
   RegisterMemberFunctionHandler(
       StringExtractorGDBRemote::eServerPacketType_qSupported,
       &GDBRemoteCommunicationServerCommon::Handle_qSupported);
-  RegisterMemberFunctionHandler(
-      StringExtractorGDBRemote::eServerPacketType_QThreadSuffixSupported,
-      &GDBRemoteCommunicationServerCommon::Handle_QThreadSuffixSupported);
   RegisterMemberFunctionHandler(
       StringExtractorGDBRemote::eServerPacketType_qUserName,
       &GDBRemoteCommunicationServerCommon::Handle_qUserName);
@@ -837,20 +830,6 @@ GDBRemoteCommunicationServerCommon::Handle_qSupported(
   return SendPacketNoLock(llvm::join(HandleFeatures(client_features), ";"));
 }
 
-GDBRemoteCommunication::PacketResult
-GDBRemoteCommunicationServerCommon::Handle_QThreadSuffixSupported(
-    StringExtractorGDBRemote &packet) {
-  m_thread_suffix_supported = true;
-  return SendOKResponse();
-}
-
-GDBRemoteCommunication::PacketResult
-GDBRemoteCommunicationServerCommon::Handle_QListThreadsInStopReply(
-    StringExtractorGDBRemote &packet) {
-  m_list_threads_in_stop_reply = true;
-  return SendOKResponse();
-}
-
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerCommon::Handle_QSetDetachOnError(
     StringExtractorGDBRemote &packet) {
@@ -1306,8 +1285,6 @@ std::vector<std::string> GDBRemoteCommunicationServerCommon::HandleFeatures(
   return {
       llvm::formatv("PacketSize={0}", max_packet_size),
       "QStartNoAckMode+",
-      "QThreadSuffixSupported+",
-      "QListThreadsInStopReply+",
       "qEcho+",
   };
 }

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
index 51d9fdd68037c..ecd80923fcf0f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.h
@@ -36,8 +36,6 @@ class GDBRemoteCommunicationServerCommon : public GDBRemoteCommunicationServer {
   Status m_process_launch_error;
   ProcessInstanceInfoList m_proc_infos;
   uint32_t m_proc_infos_index;
-  bool m_thread_suffix_supported;
-  bool m_list_threads_in_stop_reply;
 
   PacketResult Handle_A(StringExtractorGDBRemote &packet);
 
@@ -91,10 +89,6 @@ class GDBRemoteCommunicationServerCommon : public GDBRemoteCommunicationServer {
 
   PacketResult Handle_qSupported(StringExtractorGDBRemote &packet);
 
-  PacketResult Handle_QThreadSuffixSupported(StringExtractorGDBRemote &packet);
-
-  PacketResult Handle_QListThreadsInStopReply(StringExtractorGDBRemote &packet);
-
   PacketResult Handle_QSetDetachOnError(StringExtractorGDBRemote &packet);
 
   PacketResult Handle_QStartNoAckMode(StringExtractorGDBRemote &packet);

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index eba5deccc2d41..c73e1458ee62a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -113,6 +113,12 @@ void GDBRemoteCommunicationServerLLGS::RegisterPacketHandlers() {
   RegisterMemberFunctionHandler(
       StringExtractorGDBRemote::eServerPacketType_qGetWorkingDir,
       &GDBRemoteCommunicationServerLLGS::Handle_qGetWorkingDir);
+  RegisterMemberFunctionHandler(
+      StringExtractorGDBRemote::eServerPacketType_QThreadSuffixSupported,
+      &GDBRemoteCommunicationServerLLGS::Handle_QThreadSuffixSupported);
+  RegisterMemberFunctionHandler(
+      StringExtractorGDBRemote::eServerPacketType_QListThreadsInStopReply,
+      &GDBRemoteCommunicationServerLLGS::Handle_QListThreadsInStopReply);
   RegisterMemberFunctionHandler(
       StringExtractorGDBRemote::eServerPacketType_qMemoryRegionInfo,
       &GDBRemoteCommunicationServerLLGS::Handle_qMemoryRegionInfo);
@@ -1365,6 +1371,20 @@ GDBRemoteCommunicationServerLLGS::Handle_qGetWorkingDir(
   return SendErrorResponse(14);
 }
 
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunicationServerLLGS::Handle_QThreadSuffixSupported(
+    StringExtractorGDBRemote &packet) {
+  m_thread_suffix_supported = true;
+  return SendOKResponse();
+}
+
+GDBRemoteCommunication::PacketResult
+GDBRemoteCommunicationServerLLGS::Handle_QListThreadsInStopReply(
+    StringExtractorGDBRemote &packet) {
+  m_list_threads_in_stop_reply = true;
+  return SendOKResponse();
+}
+
 GDBRemoteCommunication::PacketResult
 GDBRemoteCommunicationServerLLGS::Handle_C(StringExtractorGDBRemote &packet) {
   Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_THREAD));
@@ -3540,7 +3560,8 @@ std::vector<std::string> GDBRemoteCommunicationServerLLGS::HandleFeatures(
   auto ret =
       GDBRemoteCommunicationServerCommon::HandleFeatures(client_features);
   ret.insert(ret.end(), {
-    "qXfer:features:read+", "multiprocess+",
+    "QThreadSuffixSupported+", "QListThreadsInStopReply+",
+        "qXfer:features:read+", "multiprocess+",
 #if defined(__linux__) || defined(__NetBSD__) || defined(__FreeBSD__)
         "QPassSignals+", "qXfer:auxv:read+", "qXfer:libraries-svr4:read+",
 #endif

diff  --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
index f58d72e32905b..3b890b8680a42 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h
@@ -100,6 +100,8 @@ class GDBRemoteCommunicationServerLLGS
   std::unordered_map<uint32_t, lldb::DataBufferSP> m_saved_registers_map;
   uint32_t m_next_saved_registers_id = 1;
   bool m_handshake_completed = false;
+  bool m_thread_suffix_supported = false;
+  bool m_list_threads_in_stop_reply = false;
 
   PacketResult SendONotification(const char *buffer, uint32_t len);
 
@@ -121,6 +123,10 @@ class GDBRemoteCommunicationServerLLGS
 
   PacketResult Handle_qGetWorkingDir(StringExtractorGDBRemote &packet);
 
+  PacketResult Handle_QThreadSuffixSupported(StringExtractorGDBRemote &packet);
+
+  PacketResult Handle_QListThreadsInStopReply(StringExtractorGDBRemote &packet);
+
   PacketResult Handle_C(StringExtractorGDBRemote &packet);
 
   PacketResult Handle_c(StringExtractorGDBRemote &packet);


        


More information about the lldb-commits mailing list