Author: Med Ismail Bennani Date: 2023-10-25T17:31:02-07:00 New Revision: 2abf997f8272e88d1a17138da61448bac721b6c1
URL: https://github.com/llvm/llvm-project/commit/2abf997f8272e88d1a17138da61448bac721b6c1 DIFF: https://github.com/llvm/llvm-project/commit/2abf997f8272e88d1a17138da61448bac721b6c1.diff LOG: [lldb] Fix assertions caused by un-checked errors in ScriptedProcess This patch should fix some assertion that started getting hit after f22d82c. That commit changed the scripted object plugin creation to use `llvm::Expected<T>` as a return type to enforce error handling, however I forgot to handle the error which caused the assert. The interesting part about this, is that since that assert was triggered in the ScriptedProcess constructor (where the `llvm::Error` wasn't handled), that impacted every test that launched any kind of process, since the process plugin manager would eventually also iterate over the `ScriptedProcess::Create` factory method. This patch should fix the assertions by handling the errors. Signed-off-by: Med Ismail Bennani <ism...@bennani.ma> Added: Modified: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp lldb/source/Plugins/Process/scripted/ScriptedThread.cpp Removed: ################################################################################ diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp index e0e6693399dec3a..f2a647c1b0bea4c 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -113,6 +113,7 @@ ScriptedProcess::ScriptedProcess(lldb::TargetSP target_sp, m_scripted_metadata.GetArgsSP()); if (!obj_or_err) { + llvm::consumeError(obj_or_err.takeError()); error.SetErrorString("Failed to create script object."); return; } diff --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp index 5a955fa14009265..aa2796db15cd00a 100644 --- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp @@ -60,9 +60,11 @@ ScriptedThread::Create(ScriptedProcess &process, thread_class_name, exe_ctx, process.m_scripted_metadata.GetArgsSP(), script_object); - if (!obj_or_err) + if (!obj_or_err) { + llvm::consumeError(obj_or_err.takeError()); return llvm::createStringError(llvm::inconvertibleErrorCode(), "Failed to create script object."); + } StructuredData::GenericSP owned_script_object_sp = *obj_or_err; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits