darling
darling copied to clipboard
Get a recent version of LLDB working
As of 6faf8526934565a8dcce3fbeb8a67f01dab28b9e, recent LLDB versions can successfully connect to their debugservers (tested with Xcode 11). However, trying to run a process still hangs. According to the following debugserver log, it appears as though the process is never resumed:
113 +0.000021 sec [0057/0307]: HandleReceivedPacket ("vAttach;56");
114 +0.000166 sec [0057/0307]: MachProcess::MachProcess()
115 +0.000013 sec [0057/0307]: (DebugNub) attaching to pid 86...
116 +0.000007 sec [0057/0307]: MachProcess::SetState(Unloaded) ignoring redundant state change...
117 +0.000014 sec [0057/0307]: MachProcess::SetState(Attaching) upating state (previous state was Unloaded), event_mask = 0x00000001
118 +0.000007 sec [0057/0307]: MachTask::StartExceptionThread ( )
119 +0.000018 sec [0057/0307]: ::task_for_pid ( target_tport = 0x0103, pid = 86, &task ) => err = 0x00000000 (success) err = 0x00000000
120 +0.000026 sec [0057/0307]: ::task_info ( target_task = 0x0a07, flavor = TASK_BASIC_INFO, task_info_out => 0x7fffffdfe208, task_info_outCnt => 10 ) err = 0x00000000
121 +0.000018 sec [0057/0307]: task_basic_info = { suspend_count = 1, virtual_size = 0x1002b5000, resident_size = 0x00001000, user_time = 0.000000, system_time = 0.000000 }
122 +0.000018 sec [0057/0307]: MachException::PortInfo::Save ( task = 0x0a07 )
123 +0.000020 sec [0057/0307]: ::task_get_exception_ports ( task = 0x0a07, mask = 0x1bfe, maskCnt => 1, ports, behaviors, flavors ) err = 0x00000000
124 +0.000019 sec [0057/0307]: ::task_set_exception_ports ( task = 0x0a07, exception_mask = 0x00001bfe, new_port = 0x0b03, behavior = 0x80000001, new_flavor = 0x0000000d ) err = 0x00000000
125 +0.000076 sec [0057/0c03]: MachTask::ExceptionThread ( arg = 0x7f937e008068 ) starting thread...
126 +0.000042 sec [0057/0c03]: ::mach_msg ( msg->{bits = 0, size = 0 remote_port = 0, local_port = 0, reserved = 0x0, id = 0x0}, option = 0x402, send_size = 0, rcv_size = 1024, rcv_name = 0xb03, timeout = 0, notify = 0)
127 +0.001024 sec [0057/0c03]: ::mach_msg ( msg->{bits = 0x80001112, size = 84 remote_port = 0xd03, local_port = 0xb03, reserved = 0x0, id = 0x965}, option = 0x402, send_size = 0, rcv_size = 1024, rcv_name = 0xb03, timeout = 0, notify = 0) err = 0x00000000
128 +0.000019 sec [0057/0c03]: ::catch_mach_exception_raise ( exc_port = 0x0b03, thd_port = 0x1303, tsk_port = 0x0a07, exc_type = 5 ( EXC_SOFTWARE ), exc_data[2] = { 0x10003, 0x11 })
129 +0.000028 sec [0057/0c03]: ::task_suspend ( target_task = 0x0a07 ) err = 0x00000000
130 +0.000008 sec [0057/0c03]: MachProcess::ExceptionMessageReceived ( )
131 +0.245797 sec [0057/0307]: successfully attached to pid 86
132 +0.000227 sec [0057/0307]: DNBProcessAttach DNBProcessWaitForEvent (0056, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged, true, INFINITE)...
133 +0.000016 sec [0057/0307]: DNBProcessAttach DNBProcessWaitForEvent (0056, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged, true, INFINITE) => 0x00000001
134 +0.000009 sec [0057/0307]: DNBProcessAttach process 0056 state changed (eEventProcessStateChanged): Attaching
135 +0.000019 sec [0057/0307]: DNBProcessAttach DNBProcessWaitForEvent (0056, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged, true, INFINITE)...
136 +30.426452 sec [0057/0307]: DNBProcessAttach DNBProcessWaitForEvent (0056, eEventProcessRunningStateChanged | eEventProcessStoppedStateChanged, true, INFINITE) => 0x00000000
137 +0.000060 sec [0057/0307]: 30674464 RNBRemote::SendPacket (E01) called
138 +0.000032 sec [0057/0307]: ::write ( socket = 9, buffer = 0x7fffffdfe591, length = 7) => 7 err = 0x00000000
139 +0.000009 sec [0057/0307]: putpkt: $E01#00
140 +0.000006 sec [0057/0307]: sent: $E01#00
error: Attach failed: "operation timed out".
error: attach failed.
141 +0.000016 sec [0057/0307]: 65 RNBRemote::StopReadRemoteDataThread called
142 +0.000135 sec [0057/0903]: ::read ( -1, 0x7ffff4a8ca30, 1024 ) => 0 err = 0x00000000
143 +0.000020 sec [0057/0903]: RNBSocket::GetCommData returned not connected...
144 +0.000019 sec [0057/0903]: RNBRemote::ThreadFunctionReadRemoteData (0x7f938dc77f48): thread exiting...
Exiting.
145 +0.000071 sec [0057/0307]: RNBRemote::~RNBRemote()
146 +0.000009 sec [0057/0307]: 254 RNBRemote::StopReadRemoteDataThread called
Sure enough, running ps aux | grep hello (hello is the name of the test binary I used) says that the process is suspended.
The version of LLDB included with Xcode 11 now works. The next thing is to try and get the newest Xcode-bundled LLDB working, the one from Xcode 13. That one's probably going to require some libraries/symbols from the newer macOS's.