Skip to content

Commit 2985a4d

Browse files
authored
Merge pull request #8828 from felipepiovezan/felipe/fix_async_bt_location_6
[lldb][swift] Fix zeroth frame detection in async functions
2 parents 0872cb5 + 4411f58 commit 2985a4d

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

lldb/source/Plugins/LanguageRuntime/Swift/SwiftLanguageRuntime.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2771,7 +2771,6 @@ SwiftLanguageRuntime::GetRuntimeUnwindPlan(ProcessSP process_sp,
27712771
plan->SetSourcedFromCompiler(eLazyBoolNo);
27722772
plan->SetUnwindPlanValidAtAllInstructions(eLazyBoolYes);
27732773
plan->SetUnwindPlanForSignalTrap(eLazyBoolYes);
2774-
behaves_like_zeroth_frame = true;
27752774
return plan;
27762775
}
27772776

lldb/test/API/lang/swift/async/unwind/sayhello/TestSwiftAsyncUnwind.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,22 @@ def test(self):
3232
# to see that this is really the async unwinder.
3333
self.assertIn(thread.GetFrameAtIndex(1).GetRegisters().GetSize(), [2,3,4])
3434
self.assertIn(thread.GetFrameAtIndex(2).GetRegisters().GetSize(), [2,3,4])
35+
36+
# Delete the old breakpoint, otherwise it would be reached again.
37+
target.BreakpointDelete(bkpt.GetID())
38+
lldbutil.continue_to_source_breakpoint(
39+
self, process, "break synchronous hello", src
40+
)
41+
42+
self.assertTrue(
43+
"synchronousSayHelo" in thread.GetFrameAtIndex(0).GetFunctionName(),
44+
)
45+
frame1 = thread.GetFrameAtIndex(1)
46+
self.assertTrue(
47+
"callSyncHello" in frame1.GetFunctionName(),
48+
)
49+
location = frame1.GetLineEntry()
50+
# Check that the callsite location is on the correct line.
51+
self.assertEqual(
52+
location.GetLine(), lldbtest.line_number("main.swift", "frame 1 line")
53+
)

lldb/test/API/lang/swift/async/unwind/sayhello/main.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@ func sayGeneric<T>(_ msg: T) async {
2020
print("\(str) after calls - arg \(msg)")
2121
}
2222

23+
func synchronousSayHelo() {
24+
print("synchronously saying hello") // break synchronous hello
25+
}
26+
27+
func callSyncHello() async {
28+
synchronousSayHelo() // frame 1 line
29+
}
30+
2331
@main struct Main {
2432
static func main() async {
2533
await sayGeneric("world")
2634
await sayHello()
35+
await callSyncHello()
2736
}
2837
}

0 commit comments

Comments
 (0)