Skip to content

Commit 02d69d9

Browse files
committed
fixup! simplify regex, replace error prefix with human-readable message
1 parent d7c77e6 commit 02d69d9

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

lldb/source/Target/VerboseTrapFrameRecognizer.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "lldb/Utility/LLDBLog.h"
1010
#include "lldb/Utility/Log.h"
11+
#include <filesystem>
1112

1213
using namespace llvm;
1314
using namespace lldb;
@@ -55,13 +56,17 @@ VerboseTrapFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame_sp) {
5556
if (!inline_info)
5657
return {};
5758

58-
auto runtime_error = inline_info->GetName().GetString();
59-
60-
if (runtime_error.empty())
59+
auto error_message = inline_info->GetName().GetString();
60+
if (error_message.empty())
6161
return {};
6262

63+
// Replaces "__llvm_verbose_trap :" with "Runtime Error: "
64+
auto space_position = error_message.find(" ");
65+
assert(space_position != std::string::npos);
66+
error_message.replace(0, space_position, "Runtime Error:");
67+
6368
return lldb::RecognizedStackFrameSP(new VerboseTrapRecognizedStackFrame(
64-
most_relevant_frame_sp, std::move(runtime_error)));
69+
most_relevant_frame_sp, std::move(error_message)));
6570
}
6671

6772
lldb::StackFrameSP VerboseTrapRecognizedStackFrame::GetMostRelevantFrame() {
@@ -73,7 +78,7 @@ namespace lldb_private {
7378
void RegisterVerboseTrapFrameRecognizer(Process &process) {
7479
RegularExpressionSP module_regex_sp = nullptr;
7580
RegularExpressionSP symbol_regex_sp(
76-
new RegularExpression("(__llvm_verbose_trap)"));
81+
new RegularExpression("^__llvm_verbose_trap: "));
7782

7883
StackFrameRecognizerSP srf_recognizer_sp =
7984
std::make_shared<VerboseTrapFrameRecognizer>();

lldb/test/Shell/Recognizer/verbose_trap.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# RUN: %clang_host -g -O0 %S/Inputs/verbose_trap.cpp -o %t.out
22
# RUN: %lldb -b -s %s %t.out | FileCheck %s
33
run
4-
# CHECK: thread #{{.*}}stop reason = __llvm_verbose_trap: Function is not implemented
4+
# CHECK: thread #{{.*}}stop reason = Runtime Error: Function is not implemented
55
frame info
66
# CHECK: frame #{{.*}}`Dummy::func(this={{.*}}) at verbose_trap.cpp
77
frame recognizer info 0

0 commit comments

Comments
 (0)