Last active
October 11, 2016 18:51
-
-
Save luislavena/b323cbd50600171f355cad4c31e1e0f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ bin/crystal build --debug foo.cr | |
Using compiled compiler at .build/crystal | |
$ ./foo | |
BOOM (Exception) | |
0x0000000000434c20: *baz:NoReturn at /home/luis/code/crystal-lang/crystal/foo.cr 10:3 | |
0x0000000000434c06: ??? at /home/luis/code/crystal-lang/crystal/foo.cr 6:3 | |
0x0000000000434bf6: ??? at /home/luis/code/crystal-lang/crystal/foo.cr 2:3 | |
0x00000000004306e1: ??? at /home/luis/code/crystal-lang/crystal/src/signal.cr 129:1 | |
0x0000000000434ad9: main at /home/luis/.cache/crystal/macro70478608.cr 12:15 | |
0x00007f87cf868ac0: __libc_start_main at ?? 0:0 | |
0x0000000000430069: _start at ?? 0:0 | |
0x0000000000000000: ??? at ?? 0:0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo | |
bar | |
end | |
def bar | |
baz | |
end | |
def baz | |
raise "BOOM" | |
end | |
foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ lldb foo | |
(lldb) target create "foo" | |
Current executable set to 'foo' (x86_64). | |
(lldb) b unwind | |
Breakpoint 1: where = foo`unwind + 9 at exception.cr:44, address = 0x000000000042a5d9 | |
(lldb) r | |
Process 4030 launching | |
Process 4030 launched: '/home/luis/code/crystal-lang/crystal/foo' (x86_64) | |
Process 4030 stopped | |
* thread #1: tid = 4030, 0x000000000042a5d9 foo`unwind + 9 at exception.cr:44, name = 'foo', stop reason = breakpoint 1.1 | |
frame #0: 0x000000000042a5d9 foo`unwind + 9 at exception.cr:44 | |
41 {% end %} | |
42 | |
43 protected def self.unwind | |
-> 44 callstack = [] of Void* | |
45 backtrace_fn = ->(context : LibUnwind::Context, data : Void*) do | |
46 bt = data.as(typeof(callstack)) | |
47 ip = Pointer(Void).new(LibUnwind.get_ip(context)) | |
(lldb) bt | |
* thread #1: tid = 4030, 0x000000000042a5d9 foo`unwind + 9 at exception.cr:44, name = 'foo', stop reason = breakpoint 1.1 | |
* frame #0: 0x000000000042a5d9 foo`unwind + 9 at exception.cr:44 | |
frame #1: 0x000000000042a5ba foo`initialize + 10 at exception.cr:16 | |
frame #2: 0x000000000042a58a foo`new + 42 at exception.cr:15 | |
frame #3: 0x0000000000425478 foo`raise + 24 at raise.cr:98 | |
frame #4: 0x000000000042545e foo`raise + 14 at raise.cr:108 | |
frame #5: 0x0000000000428450 foo`baz + 16 at foo.cr:10 | |
frame #6: 0x0000000000428436 foo`bar + 6 at foo.cr:6 | |
frame #7: 0x0000000000428426 foo`foo + 6 at foo.cr:2 | |
frame #8: 0x0000000000424e20 foo`__crystal_main + 1104 at foo.cr:13 | |
frame #9: 0x0000000000428309 foo`main + 41 at macro67162880.cr:12 | |
frame #10: 0x00007ffff71eeac0 libc.so.6`__libc_start_main + 240 | |
frame #11: 0x00000000004248f9 foo`_start + 41 | |
(lldb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./foo | |
BOOM (Exception) | |
[4367911] *CallStack::unwind:Array(Pointer(Void)) +87 | |
[4367802] *CallStack#initialize:Array(Pointer(Void)) +10 | |
[4367754] *CallStack::new:CallStack +42 | |
[4347000] *raise<Exception>:NoReturn +24 | |
[4346974] ??? | |
[4359248] *baz:NoReturn +16 | |
[4359222] ??? | |
[4359206] ??? | |
[4345376] ??? | |
[4358921] main +41 | |
[140041657961152] __libc_start_main +240 | |
[4344057] _start +41 | |
[0] ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment