| 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 |
//go:build gccgo |
| 6 |
// +build gccgo |
| 7 |
|
| 8 |
package main |
| 9 |
|
| 10 |
// This program will crash. |
| 11 |
// We want the stack trace to include the C functions. |
| 12 |
|
| 13 |
/* |
| 14 |
#cgo CFLAGS: -g -O0 |
| 15 |
|
| 16 |
#include <stdint.h> |
| 17 |
|
| 18 |
char *p; |
| 19 |
|
| 20 |
static int CFunction3(void) { |
| 21 |
*p = 0; |
| 22 |
return 0; |
| 23 |
} |
| 24 |
|
| 25 |
static int CFunction2(void) { |
| 26 |
return CFunction3(); |
| 27 |
} |
| 28 |
|
| 29 |
static int CFunction1(void) { |
| 30 |
return CFunction2(); |
| 31 |
} |
| 32 |
*/ |
| 33 |
import "C" |
| 34 |
|
| 35 |
func init() { |
| 36 |
register("CrashTracebackGccgo", CrashTracebackGccgo) |
| 37 |
} |
| 38 |
|
| 39 |
func CrashTracebackGccgo() { |
| 40 |
C.CFunction1() |
| 41 |
} |