Source file src/runtime/testdata/testprogcgo/sigpanic.go

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  // This program will crash.
     8  // We want to test unwinding from sigpanic into C code (without a C symbolizer).
     9  
    10  /*
    11  #cgo CFLAGS: -O0
    12  
    13  char *pnil;
    14  
    15  static int f1(void) {
    16  	*pnil = 0;
    17  	return 0;
    18  }
    19  */
    20  import "C"
    21  
    22  func init() {
    23  	register("TracebackSigpanic", TracebackSigpanic)
    24  }
    25  
    26  func TracebackSigpanic() {
    27  	C.f1()
    28  }
    29  

View as plain text