Issue 140610
Summary [lldb] MachProcess::GetPlatform fails to detect platform in macOS 15.4
Labels new issue
Assignees
Reporter talkeren
    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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to