<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/140610>140610</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[lldb] MachProcess::GetPlatform fails to detect platform in macOS 15.4
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
talkeren
</td>
</tr>
</table>
<pre>
Hey, there is an issue to debug some binaries since the latest mac version, so I investigated it and found part of the root cause.
It should be reproducible with Chromium's test binaries.
```
gn gen out/Default
ninja -C out/Default unit_tests
```
And than this will fail
```
(lldb) target create out/Default/unit_tests
Current executable set to '/Users/tkeren/chromium/src/out/Default/unit_tests' (arm64).
(lldb) process launch
error: process resume at entry point failed: Resume timed out.
Process 54485 exited with status = -1 (0xffffffff) lost connection
```
The actual failure happens because `qProcessInfo` fails due to a timeout. This MachO binary has 500+ load commands, for each one `MachProcess::GetMachOInformationFromMemory` calls `MachProcess::GetDeploymentInfo` which calls `MachProcess::GetPlatform`.
`MachProcess::GetPlatform` cache the result in m_platform, but it just check if the value is not zero, if `MachProcess::GetProcessPlatformViaDYLDSPI` fails to return a valid value, it will call it every time, which is what happens now. This function is slow - it takes about ~60ms for each call. so 60ms * 500 * 2 - we are talking about a minute to handle that command, which causes timeout.
I didn't investigate why `m_dyld_process_info_get_platform` returns 0 (which probably start to happen in macOS 15.4 because this is when the issue started), but I do have a fix for this issue which is just caching the result wether it is valid or not.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyEVV-PWrcT_TTmZbTIGC4sDzyQRfx-KzVK1KSV-rSaaw9cJ742tcew9KGfvbLvZTebKulqJQSeP8fnnBljSvboiTaieSea3QQzdyFuGN1XiuQnbTDXzf_pKtQDcEeRwCZADzalTMABDLX5CCn0BK31GC0lSNZrKuHgkCkx9KjhTDHZ4EuhFOARrD9TYntEJgOWAb2BQ8jewAkjQzjUAjE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