[Lldb-commits] [PATCH] D151861: Don't emit a bunch of spurious "Unknown platform 0" warnings from debugserver

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 31 17:40:08 PDT 2023


jingham created this revision.
jingham added a reviewer: jasonmolenda.
Herald added a project: All.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The code that was trying to get the platform string was passing the MachProcess::DeploymentInfo.platform to GetPlatformString w/o checking first whether that load command actually provided a platform number.  DeploymentInfo already had a bool operator that checked if the platform had been set, so just check that first before calling GetPlatformString.  NFC except a little less spam in the debugserver log output.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151861

Files:
  lldb/tools/debugserver/source/DNB.cpp


Index: lldb/tools/debugserver/source/DNB.cpp
===================================================================
--- lldb/tools/debugserver/source/DNB.cpp
+++ lldb/tools/debugserver/source/DNB.cpp
@@ -1456,9 +1456,13 @@
     major_version = info.major_version;
     minor_version = info.minor_version;
     patch_version = info.patch_version;
+    // MachProcess::DeploymentInfo has a bool operator to tell whether we have
+    // set the platform.  If that's not true, don't report out the platform:
+    if (!info)
+      return {};
     return procSP->GetPlatformString(info.platform);
   }
-  return nullptr;
+  return {};
 }
 
 // Get the current shared library information for a process. Only return


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151861.527247.patch
Type: text/x-patch
Size: 706 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230601/92fe65fd/attachment.bin>


More information about the lldb-commits mailing list