Skip to content

Instantly share code, notes, and snippets.

@dmishe
Created September 14, 2016 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmishe/9cf5e08b2e194453e85ff998bc9cc9f9 to your computer and use it in GitHub Desktop.
Save dmishe/9cf5e08b2e194453e85ff998bc9cc9f9 to your computer and use it in GitHub Desktop.
$ sh build.sh
(lldb) target create "out/main"
Current executable set to 'out/main' (x86_64).
(lldb) command source -s 0 'lldb_commands'
Executing commands in '/Users/dmishe/work/swift_sample/lldb_commands'.
(lldb) b foo.swift:5
Breakpoint 1: where = main`Foo.Foo.foo () -> Swift.Int + 13 at foo.swift:5, address = 0x00000001000018ed
(lldb) b bar.swift:5
Breakpoint 2: where = main`Bar.Bar.bar () -> Swift.Int + 13 at bar.swift:5, address = 0x0000000100001b1d
(lldb) r
2016-09-14 12:19:46.441 main[6372:64833226] Hello, World!
Process 6372 stopped
* thread #1: tid = 0x3dd46ca, 0x00000001000018ed main`Foo.foo(self=0x0000000100d00070) -> Int + 13 at foo.swift:5, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00000001000018ed main`Foo.foo(self=0x0000000100d00070) -> Int + 13 at foo.swift:5
2
3 @objc public class Foo: NSObject {
4 public func foo() -> Int {
-> 5 return 4
6 }
7 }
Process 6372 launched: '/Users/dmishe/work/swift_sample/out/main' (x86_64)
(lldb) frame variable self
(Foo.Foo) self = 0x0000000100d00070 {
ObjectiveC.NSObject = {
isa = Foo.Foo
}
}
(lldb) c
2016-09-14 12:19:46.544 main[6372:64833226] Foo = 4
Process 6372 resuming
Process 6372 stopped
* thread #1: tid = 0x3dd46ca, 0x0000000100001b1d main`Bar.bar(self=<unavailable>) -> Int + 13 at bar.swift:5, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
frame #0: 0x0000000100001b1d main`Bar.bar(self=<unavailable>) -> Int + 13 at bar.swift:5
2
3 @objc public class Bar: NSObject {
4 public func bar() -> Int {
-> 5 return 8
6 }
7 }
(lldb) frame variable self
self = <could not resolve type>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment