
When creating a stack trace we should switch between the goroutine stack and the system stack (where cgo code is executed) as appropriate to reconstruct the logical stacktrace. Goroutines that are currently executing on the system stack will have the SystemStack flag set, frames of the goroutine stack will have a negative FrameOffset (like always) and frames of the system stack will have a positive FrameOffset (which is actually just the CFA value for the frame). Updates #935
31 lines
386 B
Go
31 lines
386 B
Go
package main
|
|
|
|
// #include <hello.h>
|
|
import "C"
|
|
|
|
import (
|
|
"fmt"
|
|
"runtime"
|
|
)
|
|
|
|
func main() {
|
|
runtime.Breakpoint()
|
|
C.helloworld(2)
|
|
}
|
|
|
|
//export helloWorld
|
|
func helloWorld(x C.int) {
|
|
helloWorldS(x)
|
|
}
|
|
|
|
func helloWorldS(x C.int) {
|
|
runtime.Breakpoint()
|
|
C.helloworld_pt3(x - 1)
|
|
}
|
|
|
|
//export helloWorld2
|
|
func helloWorld2(x C.int) {
|
|
runtime.Breakpoint()
|
|
fmt.Printf("hello world %d\n", x)
|
|
}
|