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

    <tr>
        <th>Summary</th>
        <td>
            [lldb] Supporting interrupting a scripted command (e.g. python)
        </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>
    While looking into how we can support interrupting a command in lldb-dap I noticed that I **think** we cannot interrupt a script command from the SB API.

Looking at the `ScriptInterpreterPythonImpl::Interrupt()` function that tries to interrupt running python

https://github.com/llvm/llvm-project/blob/9ed772cecc23f5f5b060720399b010275bbb7457/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h#L37

This is only ever triggered from 

https://github.com/llvm/llvm-project/blob/9ed772cecc23f5f5b060720399b010275bbb7457/lldb/source/Interpreter/CommandInterpreter.cpp#L3327

Which is only triggered ever called from the IOHandlerEditline or IOHandlerCursesGUI.

As far as I can tell, if you try `SBDebugger::RequestInterrupt()` or `SBCommandInterpreter::InterruptCommand()` it never tries to interrupt a running python script (e.g. if you have a script do `script import time; time.sleep(10);`).
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVMGSozYQ_Rpx6VpKtMCYAwd7Jk5ctVWZyiS1ZwFtUFZIRBKz5b9PCfDYmd1LTntCakmv-zWvn_Re9YaoZsWRFc-JnMNgXS390AeVNLa71l8GpQm0tV-V6UGZYGGw3-AbQSsN-HmarAsxTs7NU4iXJLR2HKXpQBnQums-dXKCMxgbVEsdhEEGOAPDA8NDGJT5ui43UGMf8ECCb52awjvmxdkRwkDweoTDyzll_MD44fNWoAzLGdvx1-XZOQJNjgK5l2sYrDmPk2biwMThfMvBcM-wYjsOl9m0QVmzlhicIg_BPlTjZmNimmnBWlMPIUw-QuKJ4alXYZibtLUjw5PWb7fPp8nZv6kNDE-Ntg3DU0VdWWJLbYviUlyKhu94iVxUVcMzjmXRNE2ZF-UC0MUX3s6uJYanFz33yniGp-9YxtO1uB8c3luQDgzFZ1GuFP4clAflwRp9BXojF7n3PTna-v3TmP6X2dOqgYdg2k7TwkTgxuXLoNrhncydx0KrlVrTg4bOv_8mTafJ_dKpoJUhsO4efJqdJ__rXzeRHTxcpAPp4byoP5DWDJ9AXeBqZwjuugjv-EzNHLOuOvuD_pnJhx_Izbr1_ve0Pih0u3B_qQKY23_6qFH5QaW3AWK4p7RPb9UO8o3u09XZWMq2UeMy1EGNxMRx-aZeE00M9xmPJYgj28VFmnS16CpRyYTqrMxR5IXAPBlqXlX7ouCXbt8J3nRZW-Z8L8syzyqkXSYSVSPHgous4jzf5yJFKURVlJxkUYiyaFnOaZRKp1FUqXV9oryfqc5EVuV5omVD2i_OhbjKBhk-bZtoOTFQPCeuXlTZzL1nOdfKB3-HDCroxf4WhOIZXldH28zu0dTW5lD37kS3hm5mgFUyO13_7yFZWMVZ3oi91fhvAAAA___oF9eI">