-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Milestone
Description
I use cgo. I don't get a core dump when something goes wrong in the C code. I just get a crash. This happens even when I run with expected environment parameters and ulimit set. This makes debugging challenging. == Sample code: crash-cgo.go == package main // void my_c_crash() { int* i = 0; *i = 2; } // NULL dereference will crash import "C" func main() { C.my_c_crash() } == Command line == ulimit -c unlimited; GOTRACEBACK=crash go run crash-cgo.go I just get a stacktrace, as below: SIGSEGV: segmentation violation PC=0x400f67 signal arrived during cgo execution runtime.cgocall(0x400f80, 0x7fc172103f40) /opt/go-tip/src/pkg/runtime/cgocall.c:149 +0x11b fp=0x7fc172103f28 main._Cfunc_my_c_crash(0x410e9f) /home/all/tmp/go-build893282196/command-line-arguments/_obj/_cgo_defun.c:51 +0x31 fp=0x7fc172103f40 main.main() /home/ugorji/depot/repo/src/cmd/scratch/test-cgo-crash.go:9 +0x1a fp=0x7fc172103f48 runtime.main() /opt/go-tip/src/pkg/runtime/proc.c:220 +0x11f fp=0x7fc172103fa0 runtime.goexit() /opt/go-tip/src/pkg/runtime/proc.c:1394 fp=0x7fc172103fa8 goroutine 2 [syscall]: runtime.notetsleepg(0x7fc172121f60, 0xdf8475800) /opt/go-tip/src/pkg/runtime/lock_futex.c:190 +0x46 runtime.MHeap_Scavenger() /opt/go-tip/src/pkg/runtime/mheap.c:463 +0xa3 runtime.goexit() /opt/go-tip/src/pkg/runtime/proc.c:1394 created by runtime.main /opt/go-tip/src/pkg/runtime/proc.c:179 goroutine 3 [syscall]: runtime.goexit() /opt/go-tip/src/pkg/runtime/proc.c:1394 rax 0xc rbx 0x7fc172103f40 rcx 0xffffffffffffffff rdx 0x7fc171ea19f0 rdi 0x420910 rsi 0x7fc1722d1000 rbp 0x6750e0 rsp 0x7fff7b07dcb0 r8 0xffffffff r9 0x0 r10 0x22 r11 0x0 r12 0x400e60 r13 0x7fff7b07de10 r14 0x0 r15 0x0 rip 0x400f67 rflags 0x10246 cs 0x33 fs 0x0 gs 0x0 exit status 2 Which compiler are you using (5g, 6g, 8g, gccgo)? 6g Which operating system are you using? Linux 3.11.0-14-generic #21-Ubuntu SMP Tue Nov 12 17:04:55 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Which version are you using? (run 'go version') go version devel +04f0931c9808 Mon Dec 16 12:48:35 2013 -0800 linux/amd64 Please provide any additional information below.