Skip to content

Commit 3c902c1

Browse files
[lldb][swift] Add test for disable-language-runtime-unwindplans
This can only be tested on downstream LLDB, as it requires a language with a custom unwind plan.
1 parent df8f29b commit 3c902c1

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SWIFT_SOURCES := main.swift
2+
SWIFTFLAGS_EXTRAS := -parse-as-library
3+
include Makefile.rules
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import lldb
2+
from lldbsuite.test.decorators import *
3+
import lldbsuite.test.lldbtest as lldbtest
4+
import lldbsuite.test.lldbutil as lldbutil
5+
6+
class TestDisableLanguageUnwinder(lldbtest.TestBase):
7+
8+
@swiftTest
9+
@skipIf(oslist=['windows', 'linux'])
10+
def test(self):
11+
"""Test async unwind"""
12+
self.build()
13+
src = lldb.SBFileSpec('main.swift')
14+
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
15+
self, 'break here', src)
16+
17+
self.assertIn("syncFunc", thread.GetFrameAtIndex(0).GetFunctionName())
18+
self.assertIn("callSyncFunc", thread.GetFrameAtIndex(1).GetFunctionName())
19+
self.assertIn("main", thread.GetFrameAtIndex(2).GetFunctionName())
20+
21+
self.runCmd("settings set target.process.disable-language-runtime-unwindplans true")
22+
23+
self.assertIn("syncFunc", thread.GetFrameAtIndex(0).GetFunctionName())
24+
self.assertIn("callSyncFunc", thread.GetFrameAtIndex(1).GetFunctionName())
25+
self.assertNotIn("main", thread.GetFrameAtIndex(2).GetFunctionName())
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
func syncFunc() {
2+
print("break here")
3+
}
4+
5+
func callSyncFunc() async {
6+
syncFunc()
7+
}
8+
9+
@main struct Main {
10+
static func main() async {
11+
await callSyncFunc()
12+
}
13+
}

0 commit comments

Comments
 (0)