-
Notifications
You must be signed in to change notification settings - Fork 341
[lldb][swift] Filter await-resume funclets when setting breakpoints #8319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -360,3 +360,9 @@ let Definition = "thread" in { | |
DefaultUnsignedValue<600000>, | ||
Desc<"Maximum number of frames to backtrace.">; | ||
} | ||
|
||
let Definition = "language" in { | ||
def EnableFilterForLineBreakpoints: Property<"enable-filter-for-line-breakpoints", "Boolean">, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a naming convention around boolean properties? Should this be prefixed with enable-, or not? It seems possibly redundant to me. Maybe the name should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Current practice has all "enable"-like properties using boolean values, and most of them mentioning "enable" in the actual setting flag, though there are exceptions to this second point |
||
DefaultTrue, | ||
Desc<"If true, allow Language plugins to filter locations when setting breakpoints by line number or regex.">; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
SWIFT_SOURCES := main.swift | ||
|
||
include Makefile.rules |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import lldb | ||
from lldbsuite.test.decorators import * | ||
import lldbsuite.test.lldbtest as lldbtest | ||
import lldbsuite.test.lldbutil as lldbutil | ||
|
||
|
||
class TestSwiftAsyncBreakpoints(lldbtest.TestBase): | ||
@swiftTest | ||
@skipIfWindows | ||
@skipIfLinux | ||
@skipIf(archs=no_match(["arm64", "arm64e", "x86_64"])) | ||
def test(self): | ||
"""Test async breakpoints""" | ||
self.build() | ||
filespec = lldb.SBFileSpec("main.swift") | ||
target, process, thread, breakpoint1 = lldbutil.run_to_source_breakpoint( | ||
self, "Breakpoint1", filespec | ||
) | ||
breakpoint2 = target.BreakpointCreateBySourceRegex("Breakpoint2", filespec) | ||
breakpoint3 = target.BreakpointCreateBySourceRegex("Breakpoint3", filespec) | ||
self.assertEquals(breakpoint1.GetNumLocations(), 2) | ||
self.assertEquals(breakpoint2.GetNumLocations(), 1) | ||
self.assertEquals(breakpoint3.GetNumLocations(), 2) | ||
|
||
location11 = breakpoint1.GetLocationAtIndex(0) | ||
location12 = breakpoint1.GetLocationAtIndex(1) | ||
self.assertEquals(location11.GetHitCount(), 1) | ||
self.assertEquals(location12.GetHitCount(), 0) | ||
|
||
self.assertEquals(thread.GetStopDescription(128), "breakpoint 1.1") | ||
process.Continue() | ||
self.assertEquals(thread.GetStopDescription(128), "breakpoint 1.2") | ||
|
||
thread.StepOver() | ||
self.assertEquals(thread.GetStopDescription(128), "breakpoint 2.1") | ||
self.expect("expr timestamp1", substrs=["42"]) | ||
|
||
thread.StepOver() | ||
self.assertIn("breakpoint 3.1", thread.GetStopDescription(128)) | ||
self.expect("expr timestamp1", substrs=["42"]) | ||
|
||
process.Continue() | ||
self.assertIn("breakpoint 3.2", thread.GetStopDescription(128)) | ||
self.expect("expr timestamp1", substrs=["42"]) | ||
|
||
thread.StepOver() | ||
self.expect("expr timestamp1", substrs=["42"]) | ||
self.expect("expr timestamp2", substrs=["43"]) | ||
|
||
self.runCmd("settings set language.enable-filter-for-line-breakpoints false") | ||
breakpoint1_no_filter = target.BreakpointCreateBySourceRegex( | ||
"Breakpoint1", filespec | ||
) | ||
self.assertEquals(breakpoint1_no_filter.GetNumLocations(), 3) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
func getTimestamp(i:Int) async -> Int { | ||
return i | ||
} | ||
|
||
func work() {} | ||
|
||
func foo() async { | ||
work() | ||
let timestamp1 = await getTimestamp(i:42) // Breakpoint1 | ||
work() // Breakpoint2 | ||
let timestamp2 = await getTimestamp(i:43) // Breakpoint3 | ||
work() | ||
} | ||
|
||
await foo() |
Uh oh!
There was an error while loading. Please reload this page.