Skip to content

Commit 2abf997

Browse files
committed
[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 <[email protected]>
1 parent a3e5c94 commit 2abf997

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ ScriptedProcess::ScriptedProcess(lldb::TargetSP target_sp,
113113
m_scripted_metadata.GetArgsSP());
114114

115115
if (!obj_or_err) {
116+
llvm::consumeError(obj_or_err.takeError());
116117
error.SetErrorString("Failed to create script object.");
117118
return;
118119
}

lldb/source/Plugins/Process/scripted/ScriptedThread.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ ScriptedThread::Create(ScriptedProcess &process,
6060
thread_class_name, exe_ctx, process.m_scripted_metadata.GetArgsSP(),
6161
script_object);
6262

63-
if (!obj_or_err)
63+
if (!obj_or_err) {
64+
llvm::consumeError(obj_or_err.takeError());
6465
return llvm::createStringError(llvm::inconvertibleErrorCode(),
6566
"Failed to create script object.");
67+
}
6668

6769
StructuredData::GenericSP owned_script_object_sp = *obj_or_err;
6870

0 commit comments

Comments
 (0)