[Lldb-commits] [PATCH] D136719: change debugserver to return an empty platform name for unknown platforms, instead of crashing
Jason Molenda via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 25 17:15:13 PDT 2022
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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136719.470652.patch
Type: text/x-patch
Size: 1171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221026/427a8cfd/attachment.bin>
More information about the lldb-commits
mailing list