<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/63405>63405</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
lldb client fails to attach to lldb-sever on macosx-macosx due to missing port number
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mokhaled2992
</td>
</tr>
</table>
<pre>
On a local macosx I have the following scenario:
- start lldb-server
```
/usr/local/opt/llvm@16/bin/lldb-server p --listen '127.0.0.1:1234'
Connection established.
```
- start lldb client
- select platform
```
(lldb) platform select remote-macosx
Platform: remote-macosx
Connected: no
SDK Path: error: unable to locate SDK
```
- connect successfully
```
(lldb) platform connect connect://127.0.0.1:1234
Platform: remote-macosx
Triple: x86_64h-apple-macosx
OS Version: 13.4 (22F66)
Hostname: C02DW6SAMD6T
Connected: yes
WorkingDir: /Users/I572922/workspace
Kernel: Darwin Kernel Version 22.5.0: Mon Apr 24 20:51:50 PDT 2023; root:xnu-8796.121.2~5/RELEASE_X86_64
SDK Path: error: unable to locate SDK
```
- attach to remote process fails
**lldb logs**
```
tail -F /tmp/lldb
history[7] tid=0x0103 < 468> read packet: $triple:7838365f3634682d6170706c652d6d61636f7378;ptrsize:8;vendor:apple;cputype:16777223;cpusubtype:8;ostype:macosx;watchpoint_exceptions_received:after;endian:little;os_version:13.4;maccatalyst_version:16.5;os_build:3232463636;os_kernel:44617277696e204b65726e656c2056657273696f6e2032322e352e303a204d6f6e204170722032342032303a35313a35302050445420323032333b20726f6f743a786e752d383739362e3132312e327e352f52454c454153455f5838365f3634;hostname:43303244573653414d443654;#05
history[8] tid=0x0103 < 18> send packet: $qGetWorkingDir#91
history[9] tid=0x0103 < 52> read packet: $2f55736572732f493537323932322f776f726b7370616365#cb
history[10] tid=0x0103 < 19> send packet: $qQueryGDBServer#cb
history[11] tid=0x0103 < 7> read packet: $E04#a9
< 39> send packet: $qLaunchGDBServer;host:C02DW6SAMD6T;#a3
Read(buffer, sizeof(buffer), timeout = 10000000 us, status = success, error = ) => bytes_read = 7
GDBRemoteCommunication::CheckForPacket adding 7 bytes: $E09#ae
< 7> read packet: $E09#ae
ProcessGDBRemote::ConnectToDebugserver Connecting to connect://[127.0.0.1]
```
My **guess** from the error message is that somehow fetching the `connect_url` during attaching has a problem finding the port number used to connect.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVktv4zjy_zTMhbBBVfEhHXyI23H_BzONyb_Tu7O3gJIoSxtJ1JJUHnvYz74gJafdPQ4whzUMSawXq35VZJX2vjuNxuyI2BNxuNFzaK3bDfap1b2poSjgprT12-73kWra20r3dNCV9a_0F9rqZ0NDa2hj-96-dOOJ-sqM2nWW4C1hB8LW54b6oF2gfV-XG2_cs3ErW7L1vyzhOHtH4Jh2InC0U4ir_nkgnGWSwLHsxkR5N0QnSjebvvPBjJSAykBt2ZZtM4K3GSAnoBbjn-w4mip0dqTGB132nW9Nvb3qyKXDtOo7M4Z3hulNFejU69BYN3wQRx41CRTvcmc9ZwYbzGYBcZGm9P5sDG-vCqyumzoKjPas9nD4ld7r0Eaqcc66-DGPuuwNDTalK5go9UGM1WKW-rmqjPfN3Pdvfzmes_L6jhmHI4Hjn_D_izF-c93Um8h9zeWj5O1GT1P_o9DvD_TvxvnOjlEuwy2nBHKAo5QEivNO_2d9GPWQbH1icPhDPtx-Ochv18B8M34h_2HdUzeeDl0CkcDxb944T-D4i1BQABA4vlj35CddmdXQr8aNpo_iB-1eunElnF2kAFuxZZH_xY70dnIUOIVIEBEcwej94RsFBkhwT521EcTXcd7kqpDbDLIt_EcQOH69--3u9uHu8R8Jl_9V8nUIumqj6JINOjkbq4A2uuv95eklEP_pKPT25JflDwI_2g666-nmGEEMw7Se1oXVdj5Y90bEXhFxoKGrCR7YK8sYUoKfKJc5wTvqjK7ppKsnE5Zs8HCuDpVjjlI0KJHLHGqZKaaYrKSAWtYykygbh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