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-4433] lldb expression command can't handle structs with no elements #4391

Closed
ankitspd opened this issue Mar 30, 2017 · 4 comments
Closed
Labels
bug Something isn't working Compiler LLDB for Swift

Comments

@ankitspd
Copy link
Member

Previous ID SR-4433
Radar None
Original Reporter @aciidb0mb3r
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler, LLDB for Swift
Labels Bug
Assignee jingham@apple.com (JIRA)
Priority Medium

md5: 20d04d201ee93e9c742ae61392fe22c7

duplicates:

  • SR-4204 LLDB fails printing variables when self refers to an empty struct

Issue Description:

Unfortunately I am unable to use lldb even on a simple program 🙁

struct Bar {
    func bar(foos: [String]) {
        print(foos)
    }
}

Bar().bar(foos: [
    "xxx",
])
$ xcrun --find swift
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2017-03-26-a.xctoolchain/usr/bin/swift
$ swiftc -g main.swift && lldb main -o "b main.swift:3" -o r -o "po foos" -b
(lldb) target create "main"
Current executable set to 'main' (x86_64).
(lldb) b main.swift:3
Breakpoint 1: where = main`main.Bar.bar (foos : Swift.Array<Swift.String>) -> () + 12 at main.swift:3, address = 0x00000001000011bc
(lldb) r
Process 58344 stopped
* thread #&#8203;1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #&#8203;0: 0x00000001000011bc main`Bar.bar(foos=1 value, self=main.Bar @ scalar) -> () at main.swift:3
   1    struct Bar {
   2        func bar(foos: [String]) {
-> 3            print(foos)
   4        }
   5    }
   6
   7    Bar().bar(foos: [

Process 58344 launched: '/private/tmp/Sample/Sources/exe/main' (x86_64)
(lldb) po foos
error: Couldn't materialize: couldn't get the value of self: extracting data from value failed
error: errored out in DoExecute, couldn't PrepareToExecuteJITExpression
@belkadan
Copy link

Reproduced. frame variable works, but po does not. jingham@apple.com (JIRA User)?

@swift-ci
Copy link

Comment by Jim Ingham (JIRA)

This particular issue is a known bug where the expression parser doesn't figure out that it has to treat structs with no elements specially (it is trying to extract the value of the struct which isn't there.)

You can see this by just adding a var to Bar, and then po will work.

This is on my list of things to fix.

@swift-ci
Copy link

Comment by Jim Ingham (JIRA)

This is actually a dup of

https://bugs.swift.org/browse/SR-4204

@ankitspd
Copy link
Member Author

Hm, I was trying to reduce a big test case for the same error. Is it fine if I file debugger reports with entire project attached?

@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 Compiler LLDB for Swift
Projects
None yet
Development

No branches or pull requests

3 participants