[SR-2989] Multi-line function chains evaluated before breakpoint hits Created: 19 Oct 2016 Updated: 17 Apr 2018 Resolved: 17 Apr 2018
|Component/s:||LLDB for Swift|
|Reporter:||Ross LeBeau||Assignee:||Vedant Kumar|
In certain cases, if you have a multi-line function chain, placing a breakpoint on the first line will actually result in the function chain being evaluated before the breakpoint hits.
Place a breakpoint on the `ages = message` line, and you will see that "marker" has been printed at the time of breaking. The `ages` variable is still equal to `[1, 2, 3]`, however, so it hasn't been set yet.
This also occurs if you use a computed property instead of a function.
This does not happen if:
|Comment by Jordan Rose [ 20 Oct 2016 ]|
|Comment by Adrian Prantl [ 20 Oct 2016 ]|
From the description this definitely sounds like a compiler bug.
|Comment by Vedant Kumar [ 17 Apr 2018 ]|
I looked into this recently and found that there isn't a good way to address this problem.
Any fix that enables stepping on the line "ages = message" prior to a call to map would result in inconsistent stepping behavior between Swift and C-based languages. Further, it might result in spurious extra stepping onto lines which just contain a reference to a decl.