Open
Description
Having line numbers would be handy, but they don't seem to be present. (And showing source code would be even nicer.)
$ cat bad.go
package main
func bad(a []int) {
println(a[0])
}
func main() {
bad([]int{})
}
$ tinygo build -opt 0 -o foo
$ lldb ./foo
(lldb) target create "./foo"
Current executable set to '/Users/dkegel/gr/foo' (x86_64).
(lldb) run
Process 14639 launched: '/Users/dkegel/gr/foo' (x86_64)
panic: runtime error: index out of range
Process 14639 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00007fff6d30633a libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff6d30633a <+10>: jae 0x7fff6d306344 ; <+20>
0x7fff6d30633c <+12>: movq %rax, %rdi
0x7fff6d30633f <+15>: jmp 0x7fff6d300629 ; cerror_nocancel
0x7fff6d306344 <+20>: retq
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
* frame #0: 0x00007fff6d30633a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff6d3c2e60 libsystem_pthread.dylib`pthread_kill + 430
frame #2: 0x00007fff6d28d808 libsystem_c.dylib`abort + 120
frame #3: 0x00000001000022a4 foo`runtime.runtimePanic + 52
frame #4: 0x0000000100003032 foo`runtime.lookupPanic + 18
frame #5: 0x0000000100003470 foo`main.bad + 32
frame #6: 0x0000000100003496 foo`main.main + 22
frame #7: 0x0000000100003210 foo`runtime.run$1 + 16
frame #8: 0x00000001000031eb foo`runtime.run + 11
frame #9: 0x00000001000031d6 foo`runtime.runMain + 6
frame #10: 0x00000001000031b7 foo`main + 23
frame #11: 0x00007fff6d1becc9 libdyld.dylib`start + 1
frame #12: 0x00007fff6d1becc9 libdyld.dylib`start + 1
(lldb) f 5
frame #5: 0x0000000100003470 foo`main.bad + 32
foo`main.bad:
-> 0x100003470 <+32>: ud2
0x100003472 <+34>: nopw %cs:(%rax,%rax)
0x10000347c <+44>: nopl (%rax)
foo`main.main:
0x100003480 <+0>: pushq %rax
(lldb) quit
This is with tinygo 0.17-ish on mac.