Skip to content
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

[SR-6791] [Debugger] po prints the wrong value for class field #4379

Closed
dcci mannequin opened this issue Jan 18, 2018 · 3 comments
Closed

[SR-6791] [Debugger] po prints the wrong value for class field #4379

dcci mannequin opened this issue Jan 18, 2018 · 3 comments
Assignees
Labels
bug Something isn't working LLDB for Swift

Comments

@dcci
Copy link
Mannequin

dcci mannequin commented Jan 18, 2018

Previous ID SR-6791
Radar None
Original Reporter @dcci
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s LLDB for Swift
Labels Bug
Assignee @dcci
Priority Medium

md5: 721ac3afd996bd9578a6ba1a2aa4cdc0

Issue Description:

This one is interesting:

struct B {
    let gpsWeek: UInt16
    let timeOfWeekMillis: UInt32
}

struct A {
    let telegramId: UInt16
    let timeTag: B
    let remainingPathPts: UInt16
}

class Patatino {
    static func showMe() {
        let a = A(
            telegramId: 1,
            timeTag: B(gpsWeek: 2, timeOfWeekMillis: 3),
            remainingPathPts: 4)

        print("a = \(a)")
    }
}

Patatino.showMe()

Build with `swiftc blah.swift -g`
set a breakpoint on the print() statement

(lldb) po aA
  - telegramId : 1timeTag : B
    - gpsWeek : 3
    - timeOfWeekMillis : 4022272004
  - remainingPathPts : 32766

Expected result:

a = A(telegramId: 1, timeTag: ex.B(gpsWeek: 2, timeOfWeekMillis: 3), remainingPathPts: 4)

cc: @vedantk/@adrian-prantl

@dcci
Copy link
Mannequin Author

dcci mannequin commented Jan 19, 2018

Adrian suggested I should've tried also `frame var a`, so I did, and the result is still wrong.

(lldb) r
Process 11672 launched: '/Users/davide/work/swift-lldb/llvm-build/Ninja-DebugAssert/swift-macosx-x86_64/bin/ex2' (x86_64)
Process 11672 stopped
* thread #​1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #​0: 0x0000000100001100 ex2`static Bugger.showMe(self=ex2.Bugger) at ex2.swift:19
   16               timeTag: B(gpsWeek: 2, timeOfWeekMillis: 3),
   17               remainingPathPts: 4)
   18
-> 19           print("a = \(a)")
   20       }
   21   }
   22
Target 0: (ex2) stopped.
(lldb) frame var a
(ex2.A) a = {
  telegramId = 1
  timeTag = (gpsWeek = 3, timeOfWeekMillis = 4022272004)
  remainingPathPts = 32766
}

@dcci
Copy link
Mannequin Author

dcci mannequin commented Jan 19, 2018

This is a bug in the compiler. I'll follow up with details soon.

@dcci
Copy link
Mannequin Author

dcci mannequin commented Jan 25, 2018

apple/swift#14130

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LLDB for Swift
Projects
None yet
Development

No branches or pull requests

0 participants