Description
Previous ID | SR-3420 |
Radar | None |
Original Reporter | rolivieri (JIRA User) |
Type | Bug |
Status | Closed |
Resolution | Invalid |
Attachment: Download
Environment
As mentioned above, this issue is reproducible on both platforms, Linux (Ubuntu 14.04 LTS) and macOS (El Capitan - 10.11.6 (15G1212)).
Swift version is 3.0.2 (release)
Additional Detail from JIRA
Votes | 4 |
Component/s | LLDB for Swift |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 47c07a7e6380c4d56a8b10b2b8832cd8
Issue Description:
Linux flavor: Ubuntu 14.04 LTS
macOS: El Capitan (10.11.6 (15G1212))
Swift flavor: Swift Release v3.0.2
Using lldb and executing “frame variable” when a breakpoint is hit does not return the list of variables that are available. Now, if “frame variable” is executed targeting a specific variable and then after that “frame variable” is executed again, then the expected list of variables is returned. To reproduce this issue, the following steps can be followed:
1) Unzip the sample project and build it on an Ubuntu 14.04 system (swift build) or a macOS (El Capitan) system.
2) Launch the lldb program and execute these commands:
$ lldb
(lldb) platform select host
Platform: host
Triple: x86_64h-apple-macosx
OS Version: 10.11.6 (15G1212)
Kernel: Darwin Kernel Version 15.6.0: Wed Nov 2 20:30:56 PDT 2016; root:xnu-3248.60.11.1.2~2/RELEASE_X86_64
Hostname: 127.0.0.1
WorkingDir: /Users/olivieri/git/swift-tst
(lldb) target create .build/debug/swift-tst
Current executable set to '.build/debug/swift-tst' (x86_64).
(lldb) b main.swift:15
Breakpoint 1: where = swift-tst`main + 106 at main.swift:15, address = 0x0000000100001c8a
(lldb) run
Process 3142 launched: '/Users/olivieri/git/swift-tst/.build/debug/swift-tst' (x86_64)
In initializer()...
Process 3142 stopped
-
thread [DON'T MERGE] Test pull request #1: tid = 0x27f97, 0x0000000100001c8a swift-tst`main + 106 at main.swift:15, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100001c8a swift-tst`main + 106 at main.swift:15
12 var counter = 0
13 let myObj = MyClass()
14 while (true) {
-> 15 counter += 1
16 print("Hello, world!")
17 myObj.xyz()
18 print("counter: (counter)")
(lldb) frame variable
(lldb) frame variable
(lldb) frame variable counter
(Int) counter = 0
(lldb) frame variable
(Int) counter = 0
(swift_tst.MyClass) myObj = 0x0000000101400270 (myStr = "a string")
lldb) c
Process 3227 resuming
Hello, world!
In xyz()... a string
counter: 2
Process 3227 stopped -
thread [DON'T MERGE] Test pull request #1: tid = 0x2a23d, 0x0000000100001c8a swift-tst`main + 106 at main.swift:15, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100001c8a swift-tst`main + 106 at main.swift:15
12 var counter = 0
13 let myObj = MyClass()
14 while (true) {
-> 15 counter += 1
16 print("Hello, world!")
17 myObj.xyz()
18 print("counter: (counter)")
(lldb) frame variable
(lldb) frame variable
(lldb) frame variable counter
(Int) counter = 2
(lldb) frame variable
(Int) counter = 2
(swift_tst.MyClass) myObj = 0x0000000101106a00 (myStr = "a string")
(lldb)
As shown above, the when we hit the breakpoint (line 15) and run "frame variable", nothing is returned. However, after running “frame variable counter” and then “frame variable”, we get the expected list of variables.
As mentioned above, this issue is reproducible on both platforms, Linux (Ubuntu 14.04 LTS) and macOS (El Capitan).
Here’s the execution on Linux:
$ lldb
(lldb) platform select host
Platform: host
Triple: x86_64-*-linux-gnu
OS Version: 4.2.0
Hostname: 127.0.0.1
WorkingDir: /home/ricardo/tmp/swift-tst
Kernel: Linux
Release: 4.2.0-42-generic
Version: #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC 2016
(lldb) target create .build/debug/swift-tst
Current executable set to '.build/debug/swift-tst' (x86_64).
(lldb) b main.swift:15
Breakpoint 1: where = swift-tst`main + 96 at main.swift:15, address = 0x0000000000401140
(lldb) run
Process 4571 launched: '/home/ricardo/tmp/swift-tst/.build/debug/swift-tst' (x86_64)
In initializer()...
Process 4571 stopped
-
thread [DON'T MERGE] Test pull request #1: tid = 4571, 0x0000000000401140 swift-tst`main + 96 at main.swift:15, name = 'swift-tst', stop reason = breakpoint 1.1
frame #0: 0x0000000000401140 swift-tst`main + 96 at main.swift:15
12 var counter = 0
13 let myObj = MyClass()
14 while (true) {
-> 15 counter += 1
16 print("Hello, world!")
17 myObj.xyz()
18 print("counter: (counter)")
(lldb) frame variable
(lldb) frame variable counter
(Int) counter = 0
(lldb) frame variable
(Int) counter = 0
(swift_tst.MyClass) myObj = 0x0000000000404030 (myStr = "a string")
(lldb) c
Process 4571 resuming
Hello, world!
In xyz()... a string
counter: 1
Process 4571 stopped -
thread [DON'T MERGE] Test pull request #1: tid = 4571, 0x0000000000401140 swift-tst`main + 96 at main.swift:15, name = 'swift-tst', stop reason = breakpoint 1.1
frame #0: 0x0000000000401140 swift-tst`main + 96 at main.swift:15
12 var counter = 0
13 let myObj = MyClass()
14 while (true) {
-> 15 counter += 1
16 print("Hello, world!")
17 myObj.xyz()
18 print("counter: (counter)")
(lldb) frame variable
(lldb) frame variable counter
(Int) counter = 1
(lldb) frame variable
(Int) counter = 1
(swift_tst.MyClass) myObj = 0x0000000000404030 (myStr = "a string")
(lldb)