github.com/searKing/golang/go@v1.2.117/runtime/cgosymbolizer/testdata/crash.go (about)

     1  package main
     2  
     3  /*
     4  void crash_now(int a, char *b);
     5  */
     6  import "C"
     7  
     8  import (
     9  	"fmt"
    10  
    11  	//_ "github.com/ianlancetaylor/cgosymbolizer"
    12  	_ "github.com/searKing/golang/go/runtime/cgosymbolizer"
    13  )
    14  
    15  // https://groups.google.com/g/golang-nuts/c/NNOJ2iiuPnY
    16  func crash() {
    17  	C.crash_now(1, C.CString("some string"))
    18  }
    19  
    20  func main() {
    21  	fmt.Println("Pre-crash")
    22  	crash()
    23  	fmt.Println("Post-crash")
    24  }