Skip to content

Commit 5bb5195

Browse files
committed
fixup! handle case where function name is in unexpected format
1 parent c09c6e6 commit 5bb5195

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lldb/source/Target/VerboseTrapFrameRecognizer.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,18 @@ VerboseTrapFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame_sp) {
5959
if (error_message.empty())
6060
return {};
6161

62-
// Replaces "__llvm_verbose_trap :" with "Runtime Error: "
62+
// Replaces "__llvm_verbose_trap: " with "Runtime Error: "
6363
auto space_position = error_message.find(" ");
64-
assert(space_position != std::string::npos);
64+
if (space_position == std::string::npos) {
65+
Log *log = GetLog(LLDBLog::Unwind);
66+
LLDB_LOGF(log,
67+
"Unexpected function name format. Expected '<trap prefix>: "
68+
"<trap message>' but got: '%s'.",
69+
error_message.c_str());
70+
71+
return {};
72+
}
73+
6574
error_message.replace(0, space_position, "Runtime Error:");
6675

6776
return lldb::RecognizedStackFrameSP(new VerboseTrapRecognizedStackFrame(

0 commit comments

Comments
 (0)