Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
lldb crystal
/t/test> cat a.cr
def go
a = 0
10.times do
a += 1
end
p a
end
go
/t/test> lldb a
(lldb) target create "a"
Current executable set to 'a' (x86_64).
(lldb) breakpoint set -n go
Breakpoint 1: where = a`go + 4 at a.cr:2:3, address = 0x00000001000110a4
(lldb) run
Process 28302 launched: '/tmp/test/a' (x86_64)
a was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 28302 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00000001000110a4 a`go at a.cr:2:3 [opt]
1 def go
-> 2 a = 0
3 10.times do
4 a += 1
5 end
6
7 p a
Target 0: (a) stopped.
(lldb) s
Process 28302 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x00000001000110ac a`go at int.cr:508:5 [opt]
505 end
506
507 def times(&block : self ->) : Nil
-> 508 i = self ^ self
509 while i < self
510 yield i
511 i += 1
Target 0: (a) stopped.
(lldb) s
Process 28302 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x00000001000110b4 a`go at int.cr:509:11 [opt]
506
507 def times(&block : self ->) : Nil
508 i = self ^ self
-> 509 while i < self
510 yield i
511 i += 1
512 end
Target 0: (a) stopped.
(lldb) s
Process 28302 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = step in
frame #0: 0x00000001000110e6 a`go at a.cr:4:5 [opt]
1 def go
2 a = 0
3 10.times do
-> 4 a += 1
5 end
6
7 p a
Target 0: (a) stopped.
(lldb) c
Process 28302 resuming
10
Process 28302 exited with status = 0 (0x00000000)
(lldb) q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment