[Lldb-commits] [lldb] 11b3b38 - [lldb] Make ScriptedInterface::CreateObjectPlugin less strict

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 27 11:59:10 PDT 2023


Author: Med Ismail Bennani
Date: 2023-10-27T11:58:59-07:00
New Revision: 11b3b3834cfdd9183eff903ef8ac34a733af2068

URL: https://github.com/llvm/llvm-project/commit/11b3b3834cfdd9183eff903ef8ac34a733af2068
DIFF: https://github.com/llvm/llvm-project/commit/11b3b3834cfdd9183eff903ef8ac34a733af2068.diff

LOG: [lldb] Make ScriptedInterface::CreateObjectPlugin less strict

This patches changes the implementation of `CreateObjectPlugin` in the
various base ScriptedInterface classes, to return an `UnimplementedError`
instead of triggering an assertion.

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>

Added: 
    

Modified: 
    lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h
    lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h
    lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h
    lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadInterface.h

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h
index 2406f0f1f9aee27..e4816352daa5db6 100644
--- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h
+++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedInterface.h
@@ -13,6 +13,7 @@
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
+#include "lldb/Utility/UnimplementedError.h"
 #include "lldb/lldb-private.h"
 
 #include "llvm/Support/Compiler.h"

diff  --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h
index dc3630fc75d9e1a..2dcbb47ffa6de85 100644
--- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h
+++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedPlatformInterface.h
@@ -23,8 +23,7 @@ class ScriptedPlatformInterface : virtual public ScriptedInterface {
   CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
                      StructuredData::DictionarySP args_sp,
                      StructuredData::Generic *script_obj = nullptr) {
-    llvm_unreachable(
-        "Cannot create an instance of the ScriptedPlatformInterface!");
+    return {llvm::make_error<UnimplementedError>()};
   }
 
   virtual StructuredData::DictionarySP ListProcesses() { return {}; }

diff  --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h
index bedeaf25ae0cb9c..a429cacd862f121 100644
--- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h
+++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedProcessInterface.h
@@ -12,7 +12,6 @@
 #include "ScriptedInterface.h"
 #include "lldb/Core/StructuredDataImpl.h"
 #include "lldb/Target/MemoryRegionInfo.h"
-#include "lldb/Utility/UnimplementedError.h"
 
 #include "lldb/lldb-private.h"
 

diff  --git a/lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadInterface.h b/lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadInterface.h
index 65ec2b0387df07b..107e593b5561ef7 100644
--- a/lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadInterface.h
+++ b/lldb/include/lldb/Interpreter/Interfaces/ScriptedThreadInterface.h
@@ -24,8 +24,7 @@ class ScriptedThreadInterface : virtual public ScriptedInterface {
   CreatePluginObject(llvm::StringRef class_name, ExecutionContext &exe_ctx,
                      StructuredData::DictionarySP args_sp,
                      StructuredData::Generic *script_obj = nullptr) {
-    llvm_unreachable(
-        "Cannot create an instance of the ScriptedThreadInterface!");
+    return {llvm::make_error<UnimplementedError>()};
   }
 
   virtual lldb::tid_t GetThreadID() { return LLDB_INVALID_THREAD_ID; }


        


More information about the lldb-commits mailing list