Skip to content

Commit 0b21e70

Browse files
committed
fixup! check source file/line to determine if we want to hide a frame
1 parent d9596f1 commit 0b21e70

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

lldb/source/Plugins/Language/Swift/SwiftFrameRecognizers.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,27 @@ class SwiftHiddenFrameRecognizer : public StackFrameRecognizer {
188188
RecognizeFrame(lldb::StackFrameSP frame_sp) override {
189189
if (!frame_sp)
190190
return {};
191+
192+
// Hide compiler-generated frames.
193+
if (frame_sp->IsArtificial())
194+
return m_hidden_frame;
195+
191196
const auto &sc = frame_sp->GetSymbolContext(lldb::eSymbolContextFunction);
192197
if (!sc.function)
193198
return {};
194199

200+
FileSpec source_file;
201+
uint32_t line_no;
202+
sc.function->GetStartLineSourceInfo(source_file, line_no);
203+
// FIXME: these <compiler-generated> frames should be marked artificial
204+
// by the Swift compiler.
205+
if (source_file.GetFilename() == "<compiler-generated>"
206+
&& line_no == 0)
207+
return m_hidden_frame;
208+
195209
auto symbol_name =
196210
sc.function->GetMangled().GetMangledName().GetStringRef();
211+
197212
using namespace swift::Demangle;
198213
using namespace swift_demangle;
199214
Context demangle_ctx;

lldb/source/Target/VerboseTrapFrameRecognizer.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,7 @@ static StackFrameSP FindMostRelevantFrame(Thread &selected_thread) {
4545
// frame. But that could still be in the `std` namespace, so
4646
// check the namespace prefix too.
4747
if (!frame_name.GetStringRef().starts_with("std::") &&
48-
!most_relevant_frame_sp->IsHidden()
49-
#ifdef LLDB_ENABLE_SWIFT
50-
// In Swift-C++ interop, we generate frames with a "std."
51-
// prefix for functions from libc++. We don't want to
52-
// stop in those frames either.
53-
&& !frame_name.GetStringRef().starts_with("__C.std.") &&
54-
!frame_name.GetStringRef().starts_with("std.")
55-
#endif
56-
)
48+
!most_relevant_frame_sp->IsHidden())
5749
return most_relevant_frame_sp;
5850

5951
++stack_idx;

0 commit comments

Comments
 (0)