diff options
author | Greg Clayton <gclayton@apple.com> | 2016-05-16 20:07:38 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2016-05-16 20:07:38 +0000 |
commit | 58b794ae505b254a35a84456a3ef072bcbad0eb5 (patch) | |
tree | 63507d9efd4db01542c48257e29be4334ce91e8e /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | |
parent | 1cb56a1850afa3eb615b55d7f1e7fd308edee530 (diff) | |
download | bcm5719-llvm-58b794ae505b254a35a84456a3ef072bcbad0eb5.tar.gz bcm5719-llvm-58b794ae505b254a35a84456a3ef072bcbad0eb5.zip |
Don't crash when OS plug-in returns None from any of the functions we might call.
<rdar://problem/24489419>
llvm-svn: 269686
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index ff811e1f5de..78816737059 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -1551,10 +1551,12 @@ ScriptInterpreterPython::OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugi PyErr_Print(); PyErr_Clear(); } - assert(PythonDictionary::Check(py_return.get()) && "get_register_info returned unknown object type!"); - - PythonDictionary result_dict(PyRefType::Borrowed, py_return.get()); - return result_dict.CreateStructuredDictionary(); + if (py_return.get()) + { + PythonDictionary result_dict(PyRefType::Borrowed, py_return.get()); + return result_dict.CreateStructuredDictionary(); + } + return StructuredData::DictionarySP(); } StructuredData::ArraySP @@ -1607,10 +1609,12 @@ ScriptInterpreterPython::OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin PyErr_Clear(); } - assert(PythonList::Check(py_return.get()) && "get_thread_info returned unknown object type!"); - - PythonList result_list(PyRefType::Borrowed, py_return.get()); - return result_list.CreateStructuredArray(); + if (py_return.get()) + { + PythonList result_list(PyRefType::Borrowed, py_return.get()); + return result_list.CreateStructuredArray(); + } + return StructuredData::ArraySP(); } // GetPythonValueFormatString provides a system independent type safe way to @@ -1688,10 +1692,12 @@ ScriptInterpreterPython::OSPlugin_RegisterContextData(StructuredData::ObjectSP o PyErr_Clear(); } - assert(PythonBytes::Check(py_return.get()) && "get_register_data returned unknown object type!"); - - PythonBytes result(PyRefType::Borrowed, py_return.get()); - return result.CreateStructuredString(); + if (py_return.get()) + { + PythonBytes result(PyRefType::Borrowed, py_return.get()); + return result.CreateStructuredString(); + } + return StructuredData::StringSP(); } StructuredData::DictionarySP @@ -1746,10 +1752,12 @@ ScriptInterpreterPython::OSPlugin_CreateThread(StructuredData::ObjectSP os_plugi PyErr_Clear(); } - assert(PythonDictionary::Check(py_return.get()) && "create_thread returned unknown object type!"); - - PythonDictionary result_dict(PyRefType::Borrowed, py_return.get()); - return result_dict.CreateStructuredDictionary(); + if (py_return.get()) + { + PythonDictionary result_dict(PyRefType::Borrowed, py_return.get()); + return result_dict.CreateStructuredDictionary(); + } + return StructuredData::DictionarySP(); } StructuredData::ObjectSP |