jasonmolenda updated this revision to Diff 470652.
jasonmolenda added a comment.

Update patch to also update the loop in HandlePacket_qProcessInfo() which 
iterates over the binaries, looking for a binary that declares its platform.  
The first binary in the list is dyld, and this binary does not have a platform, 
but the loop would get back an empty string and terminate its search.  Update 
this to recognize an empty platform name and continue searching, to preserve 
its original intended behavior for `qProcessInfo`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136719/new/

https://reviews.llvm.org/D136719

Files:
  lldb/tools/debugserver/source/MacOSX/MachProcess.mm
  lldb/tools/debugserver/source/RNBRemote.cpp


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===================================================================
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -6261,7 +6261,7 @@
         auto *platform =
             DNBGetDeploymentInfo(pid, is_executable, lc, load_command_addr,
                                  major_version, minor_version, patch_version);
-        if (platform) {
+        if (platform && *platform != '\0') {
           os_handled = true;
           rep << "ostype:" << platform << ";";
           break;
Index: lldb/tools/debugserver/source/MacOSX/MachProcess.mm
===================================================================
--- lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -742,8 +742,12 @@
     return "bridgeos";
   case PLATFORM_DRIVERKIT:
     return "driverkit";
+  default:
+    DNBLogError(
+        "Unknown platform %u found for one binary, returning empty string",
+        platform);
+    return "";
   }
-  return nullptr;
 }
 
 static bool mach_header_validity_test(uint32_t magic, uint32_t cputype) {


Index: lldb/tools/debugserver/source/RNBRemote.cpp
===================================================================
--- lldb/tools/debugserver/source/RNBRemote.cpp
+++ lldb/tools/debugserver/source/RNBRemote.cpp
@@ -6261,7 +6261,7 @@
         auto *platform =
             DNBGetDeploymentInfo(pid, is_executable, lc, load_command_addr,
                                  major_version, minor_version, patch_version);
-        if (platform) {
+        if (platform && *platform != '\0') {
           os_handled = true;
           rep << "ostype:" << platform << ";";
           break;
Index: lldb/tools/debugserver/source/MacOSX/MachProcess.mm
===================================================================
--- lldb/tools/debugserver/source/MacOSX/MachProcess.mm
+++ lldb/tools/debugserver/source/MacOSX/MachProcess.mm
@@ -742,8 +742,12 @@
     return "bridgeos";
   case PLATFORM_DRIVERKIT:
     return "driverkit";
+  default:
+    DNBLogError(
+        "Unknown platform %u found for one binary, returning empty string",
+        platform);
+    return "";
   }
-  return nullptr;
 }
 
 static bool mach_header_validity_test(uint32_t magic, uint32_t cputype) {
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to