Hi Ian, > This patch to the Go frontend and libgo copies the signal code from > the Go 1.7 runtime. > > This adds a little shell script to auto-generate runtime.sigtable from > the known signal names. > > This forces the main package to always import the runtime package. > Otherwise some runtime package global variables may never be > initialized. > > This sets the syscallsp and syscallpc fields of g when entering a > syscall, so that the runtime package knows when a g is executing a > syscall. > > This fixes runtime.funcPC to avoid dead store elimination of the > interface value when the function is inlined. > > The signal code in C now has some target-specific code to return the > PC where the signal occurred and to dump the registers on a hard > crash. This is what the gc toolchain does as well. I wrote versions > of that code for x86 GNU/Linux. Other targets will fall back > reasonably and display less information. > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. > Bootstrapped and ran relevant tests on sparc-sun-solaris. Committed > to mainline.
this has caused a number of testsuite failures on Solaris 10/x86 only: Solaris 11 and 12/x86 are fine, still waiting for Solaris 10/SPARC results: * 32-bit Solaris 10/x86: +FAIL: os +FAIL: net/http +FAIL: os/exec * 64-bit Solaris 10/x86: +FAIL: os mkdir: Failed to make directory "_obj"; File exists mkdir: Failed to make directory "_test"; File exists --- FAIL: TestStatStdin (0.16s) os_test.go:1643: Failed to spawn child process: exit status 139 "Segment ation Fault\n" /vol/gcc/src/hg/trunk/local/libgo/testsuite/gotest[638]: 20371 Segmentation Faul t /vol/gcc/src/hg/trunk/local/libgo/testsuite/gotest[643]: 20373 Terminated FAIL: os +FAIL: log/syslog +FAIL: net/http +FAIL: os/exec +FAIL: os/signal All new failures are SEGVs, it seems, e.g. LD_LIBRARY_PATH=../../.libs:../../../libgcc ./a.out -test.v=true [...] --- SKIP: TestMkdirAllAtSlash (0.00s) path_test.go:223: could not create /_go_os_test/dir: mkdir /_go_os_test: permission denied === RUN TestEPIPE Segmentation Fault Thread 13 received signal SIGSEGV, Segmentation fault. runtime.getSiginfo (info=0x0, context=0xdfc03dfc) at /vol/gcc/src/hg/trunk/local/libgo/runtime/go-signal.c:190 190 ret.sigaddr = (uintptr)(info->si_addr); info is NULL here! (gdb) where #0 runtime.getSiginfo (info=0x0, context=0xdfc03dfc) at /vol/gcc/src/hg/trunk/local/libgo/runtime/go-signal.c:190 #1 0xfe7e9c8b in runtime.sighandler (gp=0xde570a00, ctxt=0xdfc03dfc, info=0x0, sig=13) at /vol/gcc/src/hg/trunk/local/libgo/go/runtime/signal_sighandler.go:37 #2 runtime.sigtrampgo (sig=13, info=0x0, ctx=0xdfc03dfc) at /vol/gcc/src/hg/trunk/local/libgo/go/runtime/signal_sigtramp.go:37 #3 0xfe457f90 in runtime.sigtramp (sig=13, info=0x0, context=0xdfc03dfc) at /vol/gcc/src/hg/trunk/local/libgo/runtime/go-signal.c:56 #4 0xfdd593df in __sighndlr () from /lib/libc.so.1 #5 0xfdd4f0a7 in call_user_handler () from /lib/libc.so.1 #6 <signal handler called> #7 0xfdd5cd85 in _write () from /lib/libc.so.1 #8 0xfdd4cc60 in write () from /lib/libc.so.1 #9 0xfe80ebf5 in syscall.write (param=..., fd=4) at libcalls.go:1572 #10 syscall.Write (fd=4, param=...) at /vol/gcc/src/hg/trunk/local/libgo/go/syscall/syscall_unix.go:232 #11 0x08067880 in os.write.pN7_os.File (f=0xdfbaec28, b=...) at file_unix.go:260 #12 0x08065e2f in os.Write.pN7_os.File (f=0xdfbaec28, b=...) at file.go:142 #13 0x0807f0bf in os_test.TestEPIPE (t=0xddb1cc00) at pipe_test.go:31 #14 0xfe819c0c in testing.tRunner (param=<optimized out>, fn=0x808e6f0 <os_test.TestEPIPE$descriptor>) libgo/go/testing/testing.go:609 #15 0xfe819c83 in testing.$thunk22 (__go_thunk_parameter=0xdfbaebf8) at /vol/gcc/src/hg/trunk/local/libgo/go/testing/testing.go:645 #16 0xfe463e27 in kickoff () at /vol/gcc/src/hg/trunk/local/libgo/runtime/proc.c:257 #17 0xfdcd5b92 in makecontext () from /lib/libc.so.1 Backtrace stopped: previous frame inner to this frame (corrupt stack?) The siginfo_t * argument being NULL suggests SA_SIGINFO not being set, although go/runtime/signal_gccgo.go (setsig) does AFAICS. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University