Skip to content

Ensure breakpoints are in the intended scope by tying them to a print… #6827

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

Merged
merged 1 commit into from
May 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ func main() {
let someSlice = a[1...]
let arraySlice: ArraySlice<Int> = a[1...]
let arraySubSequence: Array<Int>.SubSequence = a[1...]
// break here
print("break here")
}

main()
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func exercise(_ string: String) {
let unicodeScalarIndices = allIndices(string.unicodeScalars)
let utf8Indices = allIndices(string.utf8)
let utf16Indices = allIndices(string.utf16)
// break here
print("break here")
}

func allIndices<T: Collection>(_ collection: T) -> [T.Index] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func exerciseString() {

func exercise(_ string: String) {
let substrings = allIndices(string).map { string[$0..<string.endIndex] }
// break here
print("break here")
}

func allIndices<T: Collection>(_ collection: T) -> [T.Index] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ def test(self):

source_file = lldb.SBFileSpec("main.swift")
target, process, _, _ = lldbutil.run_to_source_breakpoint(
self, "// break one", source_file)
self, "break one", source_file)

# At "break one", only the `a` variable should have a value.
frame = process.GetSelectedThread().frames[0]
a = frame.FindVariable("a")
self.assertTrue(a.IsValid())
self.assertGreater(a.unsigned, 0)
b = frame.FindVariable("b")
self.assertTrue(b.IsValid())
self.assertEqual(b.unsigned, 0)
self.assertFalse(b.IsValid())
d = frame.FindVariable("d")
lldbutil.check_variable(self, d, False, value='23')

Expand All @@ -34,7 +33,7 @@ def test(self):
target.DeleteAllBreakpoints()

# Setup, and run to, the next breakpoint.
target.BreakpointCreateBySourceRegex("// break two", source_file)
target.BreakpointCreateBySourceRegex("break two", source_file)
self.setAsync(False)
process.Continue()

Expand Down
6 changes: 4 additions & 2 deletions lldb/test/API/lang/swift/async/frame/variable/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ func inner<T>(_ t: T) async {
// is unknown.
let d = t
let a = await randInt(30)
let b = await randInt(a + 11) // break one
print("break one")
let b = await randInt(a + 11)
use(a, b)
use(d) // break two
use(d)
print("break two")
}

func use<T>(_ t: T...) {}
Expand Down
1 change: 1 addition & 0 deletions lldb/test/API/lang/swift/stepping/TestSwiftStepping.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ def do_test(self):
thread.StepOut()
self.hit_correct_line(thread, "Second case with a where statement")

thread.StepOver()
thread.StepOver()
self.hit_correct_line(
thread, "print in second case with where statement.")
Expand Down
10 changes: 7 additions & 3 deletions lldb/test/API/lang/swift/swift_reference_counting/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ func lambda(_ Arg : Patatino) -> Int {
}

func main() -> Int {
var LiveObj = Patatino(37) //%self.expect('language swift refcount Blah', substrs=['cannot find \'Blah\''], error=True)
var Ret : Int = lambda(LiveObj) //%self.expect('language swift refcount LiveObj', substrs=['(strong =', 'unowned =', 'weak ='])
var MyStruct = Tinky() //%self.expect('language swift refcount MyStruct', substrs=['refcount only available for class types'], error=True)
var LiveObj = Patatino(37)
var Ret : Int = lambda(LiveObj)
var MyStruct = Tinky()
print("break here")
//%self.expect('language swift refcount Blah', substrs=['cannot find \'Blah\''], error=True)
//%self.expect('language swift refcount LiveObj', substrs=['(strong =', 'unowned =', 'weak ='])
//%self.expect('language swift refcount MyStruct', substrs=['refcount only available for class types'], error=True)
return Ret
}

Expand Down