Skip to content

Commit 795ce2e

Browse files
committed
s/LogBeforeReturnCSI/LogFailedCSI/
1 parent dddf06d commit 795ce2e

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

lldb/source/Plugins/InstrumentationRuntime/BoundsSafety/InstrumentationRuntimeBoundsSafety.cpp

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ template <typename T, typename... ArgTys>
126126
}
127127

128128
template <typename... ArgTys>
129-
[[nodiscard]] ComputedStopInfo LogBeforeReturnCSI(ArgTys &&...Args) {
129+
[[nodiscard]] ComputedStopInfo LogFailedCSI(ArgTys &&...Args) {
130130
return LogBeforeReturn<ComputedStopInfo>(Args...);
131131
}
132132

@@ -135,15 +135,14 @@ InstrumentationBoundsSafetyStopInfo::ComputeStopReasonAndSuggestedStackFrame(
135135
bool &warning_emitted_for_failure) {
136136
ThreadSP thread_sp = GetThread();
137137
if (!thread_sp)
138-
return LogBeforeReturnCSI("failed to get thread while stopped");
138+
return LogFailedCSI("failed to get thread while stopped");
139139

140140
lldb::user_id_t debugger_id =
141141
thread_sp->GetProcess()->GetTarget().GetDebugger().GetID();
142142

143143
StackFrameSP parent_sf = thread_sp->GetStackFrameAtIndex(1);
144144
if (!parent_sf)
145-
return LogBeforeReturnCSI(
146-
"got nullptr when fetching stackframe at index 1");
145+
return LogFailedCSI("got nullptr when fetching stackframe at index 1");
147146

148147
if (parent_sf->HasDebugInformation())
149148
return ComputeStopReasonAndSuggestedStackFrameWithDebugInfo(
@@ -173,7 +172,7 @@ ComputedStopInfo InstrumentationBoundsSafetyStopInfo::
173172
auto MaybeTrapReason =
174173
clang::CodeGen::DemangleTrapReasonInDebugInfo(TrapReasonFuncName);
175174
if (!MaybeTrapReason.has_value())
176-
return LogBeforeReturnCSI(
175+
return LogFailedCSI(
177176
"clang::CodeGen::DemangleTrapReasonInDebugInfo(\"{0}\") call failed",
178177
TrapReasonFuncName);
179178

@@ -210,8 +209,7 @@ ComputedStopInfo InstrumentationBoundsSafetyStopInfo::
210209

211210
StackFrameSP softtrap_sf = thread_sp->GetStackFrameAtIndex(0);
212211
if (!softtrap_sf)
213-
return LogBeforeReturnCSI(
214-
"got nullptr when fetching stackframe at index 0");
212+
return LogFailedCSI("got nullptr when fetching stackframe at index 0");
215213
llvm::StringRef trap_reason_func_name = softtrap_sf->GetFunctionName();
216214

217215
if (trap_reason_func_name == BoundsSafetySoftTrapMinimal) {
@@ -245,14 +243,14 @@ ComputedStopInfo InstrumentationBoundsSafetyStopInfo::
245243
// describing the trap or a nullptr.
246244
if (trap_reason_func_name != BoundsSafetySoftTrapStr) {
247245
assert(0 && "hit breakpoint for unexpected function name");
248-
return LogBeforeReturnCSI(
246+
return LogFailedCSI(
249247
"unexpected function name. Expected \"{0}\" but got \"{1}\"",
250248
BoundsSafetySoftTrapStr.data(), trap_reason_func_name.data());
251249
}
252250

253251
RegisterContextSP rc = thread_sp->GetRegisterContext();
254252
if (!rc)
255-
return LogBeforeReturnCSI("failed to get register context");
253+
return LogFailedCSI("failed to get register context");
256254

257255
// FIXME: LLDB should have an API that tells us for the current target if
258256
// `LLDB_REGNUM_GENERIC_ARG1` can be used.
@@ -261,7 +259,7 @@ ComputedStopInfo InstrumentationBoundsSafetyStopInfo::
261259
// work.
262260
ProcessSP process = thread_sp->GetProcess();
263261
if (!process)
264-
return LogBeforeReturnCSI("failed to get process");
262+
return LogFailedCSI("failed to get process");
265263

266264
switch (process->GetTarget().GetArchitecture().GetCore()) {
267265
case ArchSpec::eCore_x86_32_i386:
@@ -287,15 +285,15 @@ ComputedStopInfo InstrumentationBoundsSafetyStopInfo::
287285
const RegisterInfo *arg0_info = rc->GetRegisterInfo(
288286
lldb::RegisterKind::eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG1);
289287
if (!arg0_info)
290-
return LogBeforeReturnCSI(
288+
return LogFailedCSI(
291289
"failed to get register info for LLDB_REGNUM_GENERIC_ARG1");
292290
RegisterValue reg_value;
293291
if (!rc->ReadRegister(arg0_info, reg_value))
294-
return LogBeforeReturnCSI("failed to read register {0}", arg0_info->name);
292+
return LogFailedCSI("failed to read register {0}", arg0_info->name);
295293
uint64_t reg_value_as_int = reg_value.GetAsUInt64(UINT64_MAX);
296294
if (reg_value_as_int == UINT64_MAX)
297-
return LogBeforeReturnCSI("failed to read register {0} as a UInt64",
298-
arg0_info->name);
295+
return LogFailedCSI("failed to read register {0} as a UInt64",
296+
arg0_info->name);
299297

300298
if (reg_value_as_int == 0) {
301299
// nullptr arg. The compiler will pass that if no trap reason string was
@@ -315,8 +313,8 @@ ComputedStopInfo InstrumentationBoundsSafetyStopInfo::
315313
thread_sp->GetProcess()->ReadCStringFromMemory(reg_value_as_int, out_string,
316314
error_status);
317315
if (error_status.Fail())
318-
return LogBeforeReturnCSI("failed to read C string from address {0}",
319-
(void *)reg_value_as_int);
316+
return LogFailedCSI("failed to read C string from address {0}",
317+
(void *)reg_value_as_int);
320318

321319
LLDB_LOG(GetLog(LLDBLog::InstrumentationRuntime),
322320
"read C string from {0} found in register {1}: \"{2}\"",

0 commit comments

Comments
 (0)