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

    <tr>
        <th>Summary</th>
        <td>
            SBProcess::Kill can crash the debugger
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            lldb
      </td>
    </tr>

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

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

<pre>
    `SBProcess::Kill` calls `ThreadPlanStack::DiscardAllPlans`. If someone calls this while the process is in getting ready to stop (for example, because it has just completed a thread plan), then the internal state thread will hit the assert in `ThreadPlanStack::PopPlan` because there is nothing to pop.

This happened in TestGlobalModuleCache.test_OneTargetTwoDebuggers due to a bad test, but it can happen in real uses as well.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0UsFu4zoM_Br5QtSQlcSxDz6kDfLw8PCwBZr7grYYS13FMkS62f79Qk6KvexebIAcDmdGRGY_TkSd2j2r3bHARVxMXcAexRV9tJ-dqvXb82uKAzGrzUFtDv_5EFStYcAQGFStzy4R2teA05vg8OOOOnoeMNlDCLnBqtYl_HsBjleKEz2GxXmGm_OBQBzBfF8DnsFPMJKIn0bI5J8gEVjiDMo0l5iAfuJ1DqTMC_Q04MIEXsAhw_vCAkPMXSELCLLKgzngpEybJ8TRtC70k1CaMAALCn0hbz4EcF5WCDJTkqznb05f45wrOZIvKeIoUbYxRXHZg0SY41wqfVT6cP-es3eH80wT2cx_JpZ_Quwx_B_tEugFB0elEMv3bxOdMY0k51s8Ur-MIyUGu1AmRujRQsataSySkxhwepBn6kQYYGFiQIYbhVAWttvYdtNiQV21N3q729a7tnBdbVo7NDVhZVp72W_27aUyuw0NuWgbW_jOaLPVe91Utd5WbbmtTHXptekbpKpvBrXVdEUfyhA-rmVMY-GZF-raRm-aImBPgdeDMyYE2ytj8umlLsOf-mVktdXBs_BvAvESqPvDHa4-h4Ts1seyj2yKJYXOicwr1JyUOY1e3NKXQ7wqc8rEj9_TnOI7DaLMaZXJypzuSj868ysAAP__JTALQg">