diff --git a/lldb/include/lldb/Interpreter/ScriptedInterface.h b/lldb/include/lldb/Interpreter/ScriptedInterface.h --- a/lldb/include/lldb/Interpreter/ScriptedInterface.h +++ b/lldb/include/lldb/Interpreter/ScriptedInterface.h @@ -31,9 +31,9 @@ StructuredData::Generic *script_obj = nullptr) = 0; template - Ret ErrorWithMessage(llvm::StringRef caller_name, llvm::StringRef error_msg, - Status &error, - uint32_t log_caterogy = LIBLLDB_LOG_PROCESS) { + static Ret ErrorWithMessage(llvm::StringRef caller_name, + llvm::StringRef error_msg, Status &error, + uint32_t log_caterogy = LIBLLDB_LOG_PROCESS) { LLDB_LOGF(GetLogIfAllCategoriesSet(log_caterogy), "%s ERROR = %s", caller_name.data(), error_msg.data()); error.SetErrorString(llvm::Twine(caller_name + llvm::Twine(" ERROR = ") + diff --git a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp --- a/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp @@ -222,8 +222,8 @@ size_t ScriptedProcess::DoReadMemory(lldb::addr_t addr, void *buf, size_t size, Status &error) { if (!m_interpreter) - return GetInterface().ErrorWithMessage(LLVM_PRETTY_FUNCTION, - "No interpreter.", error); + return ScriptedInterface::ErrorWithMessage( + LLVM_PRETTY_FUNCTION, "No interpreter.", error); lldb::DataExtractorSP data_extractor_sp = GetInterface().ReadMemoryAtAddress(addr, size, error); @@ -235,7 +235,7 @@ 0, data_extractor_sp->GetByteSize(), buf, size, GetByteOrder()); if (!bytes_copied || bytes_copied == LLDB_INVALID_OFFSET) - return GetInterface().ErrorWithMessage( + return ScriptedInterface::ErrorWithMessage( LLVM_PRETTY_FUNCTION, "Failed to copy read memory to buffer.", error); return size; @@ -293,7 +293,7 @@ ScriptLanguage language = m_interpreter->GetLanguage(); if (language != eScriptLanguagePython) - return GetInterface().ErrorWithMessage( + return ScriptedInterface::ErrorWithMessage( LLVM_PRETTY_FUNCTION, llvm::Twine("ScriptInterpreter language (" + llvm::Twine(m_interpreter->LanguageToString(language)) + @@ -304,7 +304,7 @@ StructuredData::DictionarySP thread_info_sp = GetInterface().GetThreadsInfo(); if (!thread_info_sp) - return GetInterface().ErrorWithMessage( + return ScriptedInterface::ErrorWithMessage( LLVM_PRETTY_FUNCTION, "Couldn't fetch thread list from Scripted Process.", error); @@ -312,13 +312,13 @@ [this, &old_thread_list, &error, &new_thread_list](ConstString key, StructuredData::Object *val) -> bool { if (!val) - return GetInterface().ErrorWithMessage( + return ScriptedInterface::ErrorWithMessage( LLVM_PRETTY_FUNCTION, "Invalid thread info object", error); lldb::tid_t tid = LLDB_INVALID_THREAD_ID; if (!llvm::to_integer(key.AsCString(), tid)) - return GetInterface().ErrorWithMessage(LLVM_PRETTY_FUNCTION, - "Invalid thread id", error); + return ScriptedInterface::ErrorWithMessage( + LLVM_PRETTY_FUNCTION, "Invalid thread id", error); if (ThreadSP thread_sp = old_thread_list.FindThreadByID(tid, false /*=can_update*/)) { @@ -332,12 +332,12 @@ ScriptedThread::Create(*this, error, val->GetAsGeneric()); if (!thread_sp || error.Fail()) - return GetInterface().ErrorWithMessage(LLVM_PRETTY_FUNCTION, - error.AsCString(), error); + return ScriptedInterface::ErrorWithMessage( + LLVM_PRETTY_FUNCTION, error.AsCString(), error); RegisterContextSP reg_ctx_sp = thread_sp->GetRegisterContext(); if (!reg_ctx_sp) - return GetInterface().ErrorWithMessage( + return ScriptedInterface::ErrorWithMessage( LLVM_PRETTY_FUNCTION, llvm::Twine("Invalid Register Context for thread " + llvm::Twine(key.AsCString())) diff --git a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp --- a/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp +++ b/lldb/source/Plugins/Process/scripted/ScriptedThread.cpp @@ -41,18 +41,16 @@ auto scripted_thread_interface = process.GetInterface().CreateScriptedThreadInterface(); if (!scripted_thread_interface) - return process.GetInterface() - .ErrorWithMessage>( - LLVM_PRETTY_FUNCTION, "Failed to create scripted thread interface.", - error); + return ScriptedInterface::ErrorWithMessage>( + LLVM_PRETTY_FUNCTION, "Failed to create scripted thread interface.", + error); llvm::Optional class_name = process.GetInterface().GetScriptedThreadPluginName(); if (!class_name || class_name->empty()) - return process.GetInterface() - .ErrorWithMessage>( - LLVM_PRETTY_FUNCTION, "Failed to get scripted thread class name.", - error); + return ScriptedInterface::ErrorWithMessage>( + LLVM_PRETTY_FUNCTION, "Failed to get scripted thread class name.", + error); ExecutionContext exe_ctx(process); StructuredData::GenericSP owned_script_object_sp = @@ -61,13 +59,11 @@ process.m_scripted_process_info.GetArgsSP(), script_object); if (!owned_script_object_sp) - return process.GetInterface() - .ErrorWithMessage>( - LLVM_PRETTY_FUNCTION, "Failed to create script object", error); + return ScriptedInterface::ErrorWithMessage>( + LLVM_PRETTY_FUNCTION, "Failed to create script object", error); if (!owned_script_object_sp->IsValid()) - return process.GetInterface() - .ErrorWithMessage>( - LLVM_PRETTY_FUNCTION, "Created script object is invalid", error); + return ScriptedInterface::ErrorWithMessage>( + LLVM_PRETTY_FUNCTION, "Created script object is invalid", error); lldb::tid_t tid = scripted_thread_interface->GetThreadID();