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

    <tr>
        <th>Summary</th>
        <td>
            LLDB crash with python OS plugin
        </td>
    </tr>

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

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

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

<pre>
    It appears that the current python os plugin implementation does not sufficiently validate function returns.  My plugin implementation currently has a stub implementation of `get_register_data` which returns `None`. This causes a crash when performing a back trace

```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/devin/LLVM-15.0.1-Linux/bin/lldb
1.      HandleCommand(command = "thread list")
 #0 0x00007f88aa4740a4 PrintStackTraceSignalHandler(void*) Signals.cpp:0:0
 #1 0x00007f88aa471904 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f88ab6c5420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007f88a512742a PyBytes_AsStringAndSize (/usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0+0x2a742a)
 #4 0x00007f88aafa3128 lldb_private::python::PythonBytes::CreateStructuredString() const (/home/devin/LLVM-15.0.1-Linux/bin/../lib/liblldb.so.15+0xa8d128)
 #5 0x00007f88aafb0c30 lldb_private::ScriptInterpreterPythonImpl::OSPlugin_RegisterContextData(std::shared_ptr<lldb_private::StructuredData::Object>, unsigned long) (/home/devin/LLVM-15.0.1-Linux/bin/../lib/liblldb.so.15+0xa9ac30)
 #6 0x00007f88aaed2617 OperatingSystemPython::CreateRegisterContextForThread(lldb_private::Thread*, unsigned long) (/home/devin/LLVM-15.0.1-Linux/bin/../lib/liblldb.so.15+0x9bc617) #7 0x00007f88ab1e2886 lldb_private::RegisterContextThreadMemory::UpdateRegisterContext() (/home/devin/LLVM-15.0.1-Linux/bin/../lib/liblldb.so.15+0xccc886)
 ....
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1VV2PozYU_TXkxQqyDSHwwEPmY9WRMp2omfY1MrYBt4CRbaaT_vpem2Rmktlqq9UuSsD4mnPPObavKy2O5YNDbBwlMxa5ljm4ScQnY-Tg0Hh0rR6QtmjspkYNSPVjJ3sIMacgILS0aNAO2amuFVcQ6I7ohXVKMCdRPQ08jDPSTWawMUKPx_-AOqWEz1tmEUPWTdX1GF2jKMONdAcjG2WdNAfIw6AP_d0q3p7z-FG_6kHCI0bPrbKIs8lKD8sNsy2MlgMapam16dXQQH_F-F_IGcZlhO8ivDndM3z6hdfd9n6zvwexVa-c_2hqIOWoDbimUevcaKNkE9Ev8GuUa6cq5rqHl657OT-Wo9F_Su7gVVk7SQsNxAaB1MC7ScjZ_8DScwqU4jn93nmSYupHnyV0gb5w7YxuDOsRM83k_fI8ECC3upfwEPJFDfDcbv94XJJVjGOy3KpheoW-KkS6TlQzJDlB_gKkOnmr-x4aEc353EJRcgfI1LVGMoE6mAZ4i2gxfw2hBCP8iuFa13nOWLpOMUuBoRpcUPDsJe1VM7BuzmEA_UUrSALeFWgO2ZiPXicO_zdscoVNCpyiazDI9E0g-hGoyvgqpRgdYGFZp408wJQCkDdGVXB_zbNDli4779myGaY5MM4mxFbHOKI3-JWkgHLhRfIxzYrQdUoZ2h1vjk7aw8buHdjSbAaxV__IU8bJmm_lDdsyiXOfmZxyU-axL5KnF2bVLCE0R36mD6NRL7BD_TpKNjPc3N6FdqA3d9yCQieB58Rhb0kxMw5MC8T1YM9G_e-lFsdv8uDu6QQZq6CC5YIE7HcVq0sVFeawwj6r2HOjRvcwQFUYoQ5IM0t5gBIyD3ja70LlOfx2Kh63Gga_ujtfQmhunZjH2ZaBzsPoTJTcfiXPmxXhwxm6Cls6uY_oLZoGCwtPwt7Q3qjix_pTMJB_4U924Y8UNCNr9ATVDYrm0OyPILXffZjieUavTPiizXNYzED2s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