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
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
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits