<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/146576>146576</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [lldb] Update JSONTransport to use MainLoop
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lldb,
            lldb-dap
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          ashgti
      </td>
    </tr>
</table>

<pre>
    At the moment, JSONTransport is fairly abstract to how its reading/writing.

To support both pipes (e.g. stdin) and sockets, we should update https://github.com/llvm/llvm-project/blob/d79c284a2fef5f9cb6b803b3d0cb4c1f857ece03/lldb/include/lldb/Host/JSONTransport.h#L69 to perform reads using the RunLoop.

With that, we should also be able to read in larger chunks and use a buffer for tracking partial messages. At the moment, our `Read` logic ends up reading 1 char at a time to try to find delimiters. This should improve the performance of reading for JSONTransport.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUk0FvvDYQxT-NuYz-CMwCy4HDNtGqqtJWSlP1PLYHcGMw8gyJ8u0ryKbRqqeeLEbizczvvUFmPy5Evap_UvVjhptMMfXI0yg-M9F99BcBmQjmONMiSj_AL3_8_ttLwoXXmAQ8w4A-hQ9Aw5LQCkiEKb6DF4ZE6PwyKn19T178MuaquKji8hKBt_UQMFEmWP1KDEqfKR9zYHF-UboDXBxwtK8kvHd-J-ApbsHBtjoUgklkZVVdlL4qfR29TJvJbZyVvobw9vX8WFP8m6wofTUhGqWvru2sPp9QDzTUQ2dNY85FZSpXWHOy5XCuW7JUVIeA2__wiw2bo-_Cz5F3wTsY-aR09dR0O4GV0hDTfBBg2Ngv48HxeVueYlxvHP7yMoFMKPfrYeAIhgBNoF1sFwG_QMA0UgI7bcsrH3Q2JkAw2zBQgiEm2C143ZutmMRjgJmYcSTO4T9Oxi2BaopnQqeaAkIcvQVa9nnXL-ugBDthAhRAED8f80j62J_BLw4cBT97ocQ5vEyev3bw85riGx0tbzBwsQRx-Fd6n_ceYOb6ynVVhxn1ZVuXVVfWRZdNfdXaEzZFU6Gx5_bUDS1aXVbWti21rmwy3-tC10VblGVbnXWXd6V1raO6Q1fUFZ7VqaAZfcj3SOQxjZln3qgvT03dNllAQ4GPO9D602Ot9MPt44fDdS_Uj1nqj0yZbWR1KoJn4W9J8RKOYzoU6kf48zOo9zcj8fDtV_RHFrIthf5_R_mYnpW-3hZ46_U_AQAA__-I-kRO">