swiftlang / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. This fork is used to manage Swift’s stable releases of Clang as well as support the Swift project.
https://llvm.org
Other
1.12k stars 331 forks source link

[SR-6784] LLDB shows that a dictionary variable has 4,912,930,248 values in Xcode Variable View when using Swift 4.1 Development Snapshot toolchain #4380

Closed pitiphong-p closed 6 years ago

pitiphong-p commented 6 years ago
Previous ID SR-6784
Radar rdar://36619561
Original Reporter @pitiphong-p
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment Xcode 9.2 Swift 4.1 Development Snapshot 2018-01-12 and 2018-01-15
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | LLDB for Swift | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 5fc995aa0b4565da6ac91acfc4446121

Issue Description:

I have an open source project https://github.com/omise/omise-swift/tree/swift-4.1 on GitHub and I tried to test it with Swift 4.1 Development Snapshot and found that LLDB shows some weird Dictionary variable value in some case. (You can see in the screenshot attached with this bug)

Before stepping over the declaring variable expression, lldb shows that it has 0 values. After stepping over it, it shows that that dictionary has 4,912,930,248 values in it.

I tried to create a small sample project for filing this bug after I found it. However lldb has a difference behavior but it's also an incorrect one. This time it first shows that that dictionary has over 4 billions values in it but after stepping over it, it shows that it has 0 values.

I believe that both cases are bugs since I compare them with Swift 4.0 and it worked OK.

Please have a look at this bug and feel free to ask me if you want more information.

PS. If you want to test with my open-sourced repository, you can pull that repo, check out branch `swift-4.1`, put a breakpoint at Tool.swift:242 in decodeJSONDictionary() method and run `testUpdateCharge()` test case in ChargesOperationFixtureTests file.

pitiphong-p commented 6 years ago

It works correctly in Swift 4.2 that comes with Xcode 10 beta 1