[lldb/Interpreter] Make `ScriptedInterface::ErrorWithMessage` static (NFC)

This patch changes the `ScriptedInterface::ErrorWithMessage` method to
make it `static` which makes it easier to call.

The patch also updates its various call sites to reflect this change.

Differential Revision: https://reviews.llvm.org/D117374

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani 2022-01-18 12:56:42 +01:00
parent 45148bfe8a
commit 91bb116190
2 changed files with 13 additions and 13 deletions

View File

@ -31,8 +31,8 @@ public:
StructuredData::Generic *script_obj = nullptr) = 0;
template <typename Ret>
Ret ErrorWithMessage(llvm::StringRef caller_name, llvm::StringRef error_msg,
Status &error,
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());

View File

@ -222,8 +222,8 @@ bool ScriptedProcess::IsAlive() {
size_t ScriptedProcess::DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
Status &error) {
if (!m_interpreter)
return GetInterface().ErrorWithMessage<size_t>(LLVM_PRETTY_FUNCTION,
"No interpreter.", error);
return ScriptedInterface::ErrorWithMessage<size_t>(
LLVM_PRETTY_FUNCTION, "No interpreter.", error);
lldb::DataExtractorSP data_extractor_sp =
GetInterface().ReadMemoryAtAddress(addr, size, error);
@ -235,7 +235,7 @@ size_t ScriptedProcess::DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
0, data_extractor_sp->GetByteSize(), buf, size, GetByteOrder());
if (!bytes_copied || bytes_copied == LLDB_INVALID_OFFSET)
return GetInterface().ErrorWithMessage<size_t>(
return ScriptedInterface::ErrorWithMessage<size_t>(
LLVM_PRETTY_FUNCTION, "Failed to copy read memory to buffer.", error);
return size;
@ -293,7 +293,7 @@ bool ScriptedProcess::DoUpdateThreadList(ThreadList &old_thread_list,
ScriptLanguage language = m_interpreter->GetLanguage();
if (language != eScriptLanguagePython)
return GetInterface().ErrorWithMessage<bool>(
return ScriptedInterface::ErrorWithMessage<bool>(
LLVM_PRETTY_FUNCTION,
llvm::Twine("ScriptInterpreter language (" +
llvm::Twine(m_interpreter->LanguageToString(language)) +
@ -304,7 +304,7 @@ bool ScriptedProcess::DoUpdateThreadList(ThreadList &old_thread_list,
StructuredData::DictionarySP thread_info_sp = GetInterface().GetThreadsInfo();
if (!thread_info_sp)
return GetInterface().ErrorWithMessage<bool>(
return ScriptedInterface::ErrorWithMessage<bool>(
LLVM_PRETTY_FUNCTION,
"Couldn't fetch thread list from Scripted Process.", error);
@ -312,13 +312,13 @@ bool ScriptedProcess::DoUpdateThreadList(ThreadList &old_thread_list,
[this, &old_thread_list, &error,
&new_thread_list](ConstString key, StructuredData::Object *val) -> bool {
if (!val)
return GetInterface().ErrorWithMessage<bool>(
return ScriptedInterface::ErrorWithMessage<bool>(
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<bool>(LLVM_PRETTY_FUNCTION,
"Invalid thread id", error);
return ScriptedInterface::ErrorWithMessage<bool>(
LLVM_PRETTY_FUNCTION, "Invalid thread id", error);
if (ThreadSP thread_sp =
old_thread_list.FindThreadByID(tid, false /*=can_update*/)) {
@ -331,7 +331,7 @@ bool ScriptedProcess::DoUpdateThreadList(ThreadList &old_thread_list,
auto thread_or_error = ScriptedThread::Create(*this, val->GetAsGeneric());
if (!thread_or_error)
return GetInterface().ErrorWithMessage<bool>(
return ScriptedInterface::ErrorWithMessage<bool>(
LLVM_PRETTY_FUNCTION, toString(thread_or_error.takeError()), error);
ThreadSP thread_sp = thread_or_error.get();
@ -339,7 +339,7 @@ bool ScriptedProcess::DoUpdateThreadList(ThreadList &old_thread_list,
RegisterContextSP reg_ctx_sp = thread_sp->GetRegisterContext();
if (!reg_ctx_sp)
return GetInterface().ErrorWithMessage<bool>(
return ScriptedInterface::ErrorWithMessage<bool>(
LLVM_PRETTY_FUNCTION,
llvm::Twine("Invalid Register Context for thread " +
llvm::Twine(key.AsCString()))