diff options
Diffstat (limited to 'libgo/go/runtime/testdata/testprogcgo/traceback_gccgo.go')
-rw-r--r-- | libgo/go/runtime/testdata/testprogcgo/traceback_gccgo.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libgo/go/runtime/testdata/testprogcgo/traceback_gccgo.go b/libgo/go/runtime/testdata/testprogcgo/traceback_gccgo.go new file mode 100644 index 00000000000..83357fdd5d9 --- /dev/null +++ b/libgo/go/runtime/testdata/testprogcgo/traceback_gccgo.go @@ -0,0 +1,40 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build gccgo + +package main + +// This program will crash. +// We want the stack trace to include the C functions. + +/* +#cgo CFLAGS: -g -O0 + +#include <stdint.h> + +char *p; + +static int CFunction3(void) { + *p = 0; + return 0; +} + +static int CFunction2(void) { + return CFunction3(); +} + +static int CFunction1(void) { + return CFunction2(); +} +*/ +import "C" + +func init() { + register("CrashTracebackGccgo", CrashTracebackGccgo) +} + +func CrashTracebackGccgo() { + C.CFunction1() +} |