Skip to content

Commit 6eddd98

Browse files
committed
[lldb/Plugin] Use static ScriptedInterface::ErrorWithMessage function (NFC)
This patch replaces the calls to ErrorWithMessage using the GetInterface message by a call to the static method directly. Signed-off-by: Med Ismail Bennani <[email protected]>
1 parent 2a29c3f commit 6eddd98

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,23 @@ ScriptedThread::CreateRegisterContextForFrame(StackFrame *frame) {
121121

122122
llvm::Optional<std::string> reg_data = GetInterface()->GetRegisterContext();
123123
if (!reg_data)
124-
return GetInterface()->ErrorWithMessage<lldb::RegisterContextSP>(
124+
return ScriptedInterface::ErrorWithMessage<lldb::RegisterContextSP>(
125125
LLVM_PRETTY_FUNCTION, "Failed to get scripted thread registers data.",
126126
error, LLDBLog::Thread);
127127

128128
DataBufferSP data_sp(
129129
std::make_shared<DataBufferHeap>(reg_data->c_str(), reg_data->size()));
130130

131131
if (!data_sp->GetByteSize())
132-
return GetInterface()->ErrorWithMessage<lldb::RegisterContextSP>(
132+
return ScriptedInterface::ErrorWithMessage<lldb::RegisterContextSP>(
133133
LLVM_PRETTY_FUNCTION, "Failed to copy raw registers data.", error,
134134
LLDBLog::Thread);
135135

136136
std::shared_ptr<RegisterContextMemory> reg_ctx_memory =
137137
std::make_shared<RegisterContextMemory>(
138138
*this, 0, *GetDynamicRegisterInfo(), LLDB_INVALID_ADDRESS);
139139
if (!reg_ctx_memory)
140-
return GetInterface()->ErrorWithMessage<lldb::RegisterContextSP>(
140+
return ScriptedInterface::ErrorWithMessage<lldb::RegisterContextSP>(
141141
LLVM_PRETTY_FUNCTION, "Failed to create a register context.", error,
142142
LLDBLog::Thread);
143143

@@ -152,13 +152,13 @@ bool ScriptedThread::LoadArtificialStackFrames() {
152152

153153
Status error;
154154
if (!arr_sp)
155-
return GetInterface()->ErrorWithMessage<bool>(
155+
return ScriptedInterface::ErrorWithMessage<bool>(
156156
LLVM_PRETTY_FUNCTION, "Failed to get scripted thread stackframes.",
157157
error, LLDBLog::Thread);
158158

159159
size_t arr_size = arr_sp->GetSize();
160160
if (arr_size > std::numeric_limits<uint32_t>::max())
161-
return GetInterface()->ErrorWithMessage<bool>(
161+
return ScriptedInterface::ErrorWithMessage<bool>(
162162
LLVM_PRETTY_FUNCTION,
163163
llvm::Twine(
164164
"StackFrame array size (" + llvm::Twine(arr_size) +
@@ -174,7 +174,7 @@ bool ScriptedThread::LoadArtificialStackFrames() {
174174
StructuredData::Dictionary *dict;
175175

176176
if (!arr_sp->GetItemAtIndexAsDictionary(idx, dict) || !dict)
177-
return GetInterface()->ErrorWithMessage<bool>(
177+
return ScriptedInterface::ErrorWithMessage<bool>(
178178
LLVM_PRETTY_FUNCTION,
179179
llvm::Twine(
180180
"Couldn't get artificial stackframe dictionary at index (" +
@@ -203,7 +203,7 @@ bool ScriptedThread::LoadArtificialStackFrames() {
203203
StackFrame::Kind::Artificial, behaves_like_zeroth_frame, &sc);
204204

205205
if (!frames->SetFrameAtIndex(static_cast<uint32_t>(idx), synth_frame_sp))
206-
return GetInterface()->ErrorWithMessage<bool>(
206+
return ScriptedInterface::ErrorWithMessage<bool>(
207207
LLVM_PRETTY_FUNCTION,
208208
llvm::Twine("Couldn't add frame (" + llvm::Twine(idx) +
209209
llvm::Twine(") to ScriptedThread StackFrameList."))
@@ -219,22 +219,22 @@ bool ScriptedThread::CalculateStopInfo() {
219219

220220
Status error;
221221
if (!dict_sp)
222-
return GetInterface()->ErrorWithMessage<bool>(
222+
return ScriptedInterface::ErrorWithMessage<bool>(
223223
LLVM_PRETTY_FUNCTION, "Failed to get scripted thread stop info.", error,
224224
LLDBLog::Thread);
225225

226226
lldb::StopInfoSP stop_info_sp;
227227
lldb::StopReason stop_reason_type;
228228

229229
if (!dict_sp->GetValueForKeyAsInteger("type", stop_reason_type))
230-
return GetInterface()->ErrorWithMessage<bool>(
230+
return ScriptedInterface::ErrorWithMessage<bool>(
231231
LLVM_PRETTY_FUNCTION,
232232
"Couldn't find value for key 'type' in stop reason dictionary.", error,
233233
LLDBLog::Thread);
234234

235235
StructuredData::Dictionary *data_dict;
236236
if (!dict_sp->GetValueForKeyAsDictionary("data", data_dict))
237-
return GetInterface()->ErrorWithMessage<bool>(
237+
return ScriptedInterface::ErrorWithMessage<bool>(
238238
LLVM_PRETTY_FUNCTION,
239239
"Couldn't find value for key 'data' in stop reason dictionary.", error,
240240
LLDBLog::Thread);
@@ -266,7 +266,7 @@ bool ScriptedThread::CalculateStopInfo() {
266266
StopInfo::CreateStopReasonWithException(*this, description.data());
267267
} break;
268268
default:
269-
return GetInterface()->ErrorWithMessage<bool>(
269+
return ScriptedInterface::ErrorWithMessage<bool>(
270270
LLVM_PRETTY_FUNCTION,
271271
llvm::Twine("Unsupported stop reason type (" +
272272
llvm::Twine(stop_reason_type) + llvm::Twine(")."))

0 commit comments

Comments
 (0)