[Lldb-commits] [lldb] [lldb] Updated lldb-server to spawn the child process and share socket on Windows (PR #101283)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 31 01:46:17 PDT 2024


================
@@ -159,6 +159,40 @@ GDBRemoteCommunicationServerPlatform::GDBRemoteCommunicationServerPlatform(
 GDBRemoteCommunicationServerPlatform::~GDBRemoteCommunicationServerPlatform() =
     default;
 
+void GDBRemoteCommunicationServerPlatform::Proc(
+    const lldb_private::Args &args) {
+  if (!IsConnected())
+    return;
+
+  if (args.GetArgumentCount() > 0) {
+    lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
+    std::optional<uint16_t> port;
+    std::string socket_name;
+    Status error = LaunchGDBServer(args,
+                                   "", // hostname
+                                   pid, port, socket_name);
+    if (error.Success())
+      SetPendingGdbServer(pid, *port, socket_name);
+  }
+
+  bool interrupt = false;
+  bool done = false;
+  Status error;
+  while (!interrupt && !done) {
+    if (GetPacketAndSendResponse(std::nullopt, error, interrupt, done) !=
+        GDBRemoteCommunication::PacketResult::Success)
+      break;
+  }
+
+  if (error.Fail()) {
+    Log *log = GetLog(LLDBLog::Platform);
+    LLDB_LOGF(log,
+              "GDBRemoteCommunicationServerPlatform::%s() "
+              "GetPacketAndSendResponse: %s",
+              __FUNCTION__, error.AsCString());
----------------
DavidSpickett wrote:

I would've thought that `__FUNCTION__` gave you the function name here but maybe not. Can you just try making it `if (true)` and confirm what it prints?

https://github.com/llvm/llvm-project/pull/101283


More information about the lldb-commits mailing list