Skip to content

Commit 5b8cdcc

Browse files
committed
Use symbol name not function name
1 parent 9ab1d97 commit 5b8cdcc

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

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

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -240,23 +240,33 @@ class SwiftExceptionBreakpointFrameRecognizer : public StackFrameRecognizer {
240240
if (!thread_sp)
241241
return {};
242242

243-
StackFrameSP frame_sp;
244-
StringRef name = m_frame_sp->GetFunctionName();
245-
if (name == "swift_willThrow")
246-
frame_sp = thread_sp->GetStackFrameAtIndex(1);
247-
else if (name == "swift_willThrowTypedImpl")
248-
frame_sp = thread_sp->GetStackFrameAtIndex(2);
243+
StringRef symbol_name;
244+
{
245+
SymbolContext sc = m_frame_sp->GetSymbolContext(eSymbolContextSymbol);
246+
if (!sc.symbol)
247+
return {};
248+
symbol_name = sc.symbol->GetName();
249+
}
250+
251+
StackFrameSP relevant_frame_sp;
252+
if (symbol_name == "swift_willThrow")
253+
relevant_frame_sp = thread_sp->GetStackFrameAtIndex(1);
254+
else if (symbol_name == "swift_willThrowTypedImpl")
255+
relevant_frame_sp = thread_sp->GetStackFrameAtIndex(2);
249256
else {
250257
assert(false && "unexpected frame name");
251258
return {};
252259
}
253260

254-
// Check if source is available for the identified frame.
255-
SymbolContext sc = frame_sp->GetSymbolContext(eSymbolContextCompUnit);
256-
if (!sc.comp_unit)
257-
return {};
261+
{
262+
// Check if source is available for the identified frame.
263+
SymbolContext sc =
264+
relevant_frame_sp->GetSymbolContext(eSymbolContextSymbol);
265+
if (!sc.comp_unit)
266+
return {};
267+
}
258268

259-
return frame_sp;
269+
return relevant_frame_sp;
260270
}
261271

262272
private:

0 commit comments

Comments
 (0)