This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Treat remote macOS debugging like any other remote darwin platform
ClosedPublic

Authored by JDevlieghere on Dec 1 2020, 8:13 PM.

Details

Summary

Extract remote debugging logic from PlatformMacOSX and move it into PlatformRemoteMacOSX so it can benefit from all the logic necessary for remote debugging. Until now, remote macOS debugging was treated almost identical to local macOS debugging. By moving in into its own class, we can have it inherit from PlatformRemoteDarwinDevice and all the functionality it provides, such as looking at the correct DeviceSupport directory.

rdar://68167374

Diff Detail

Event Timeline

JDevlieghere created this revision.Dec 1 2020, 8:13 PM
JDevlieghere requested review of this revision.Dec 1 2020, 8:13 PM

Looks good overall, nice test.

lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
153

wouldn't these be a remote-ios platform? Is this to handle iOS apps running on an Apple Silicon macOS system?

JDevlieghere marked an inline comment as done.Dec 1 2020, 8:43 PM
JDevlieghere added inline comments.
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
153

Yep, I moved this from PlatformMacOSX.cpp where Davide added that for AS.

aprantl added inline comments.Dec 2 2020, 3:19 PM
lldb/source/Plugins/Platform/MacOSX/PlatformRemoteMacOSX.cpp
130

Given that this is the *remote* platform — does this #if even make sense?

lldb/test/API/commands/platform/sdk/TestPlatformSDK.py
21

What happens if two tests run at the same time?

27

2 seconds timeout is definitely not enough for an asan bot. Can this be closer to 20s? Perhaps the result of reading target.process.utility-expression-timeout?

91

I guess there is no way of implementing this without sleeping? Maybe a loop with 10 smaller sleeps?

JDevlieghere marked an inline comment as done.

Address @aprantl's feedback

JDevlieghere marked 4 inline comments as done.Dec 2 2020, 3:59 PM
JDevlieghere added inline comments.
lldb/test/API/commands/platform/sdk/TestPlatformSDK.py
21

The test will be XFAILED because of @expectedFailureIfFn(port_not_available).

aprantl accepted this revision.Dec 2 2020, 4:05 PM
This revision is now accepted and ready to land.Dec 2 2020, 4:05 PM
clayborg added inline comments.Dec 2 2020, 4:17 PM
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
98–99

Where again do we create the host platform then?

lldb/test/API/commands/platform/sdk/main.c
5–7

You can call pause() which will stop and wait for a signal to be delivered to the program if you don't want to call sleep. When the debugger attaches, this will cause the pause() to exit when you continue the process.

JDevlieghere marked 2 inline comments as done.Dec 2 2020, 4:31 PM
JDevlieghere added inline comments.
lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
98–99

On line 58 in PlatformMacOSX::Initialize

lldb/test/API/commands/platform/sdk/main.c
5–7

Oh cool, learned something new today!

jasonmolenda added inline comments.Dec 3 2020, 1:25 AM
lldb/test/API/commands/platform/sdk/main.c
5–7

I didn't know about pause(3), pretty cool. But I thought Jonas might have been using sleep() so that if lldb fails to ever attach, the process isn't left behind. sleep() has the same behavior - the debugger attaches and interrupts the syscall, so this could as easily be sleep(600) and either lldb attaches within ten minutes, or the test binary exits.