LLDB 'thread return' command throws error in Swift function

I read the article "Dancing in the Debugger - Waltz with LLDB". And I'm trying to execute a thread return command using Swift 2.2 as well as Swift 3.0.

My code is pretty simple:

 class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let resust = test() print(resust) } func test() -> Bool { return true } } 

and I added a breakpoint at the beginning of the test() function with the thread return false action. However, after the + R command, my program stops at the breakpoint, as expected, but with the following error:

": error returned from frame 0 of stream 1: we only support setting simple integers and returned float types at present .."

Here's a screenshot:

codesnapshot1

Then I tried the same thing in Objective-C code; everything goes well.

+5
source share
1 answer

These are known errors. The types of values ​​in swift (Int, Bool, etc.) are all complex objects, and we did not teach lldb how to overwrite the return values ​​for them. Error handling will also make this difficult.

In general, forced returns are not safe - especially with ARC and even more so with Swift, since you will most likely be disequilibrium reference counts - not only on local objects, but also on transferred objects.

+4
source

All Articles