delve
delve copied to clipboard
TestCgoStacktrace fails on arm64
Test ran on MacOS using the M1 arm64 chip.
=== RUN TestCgoStacktrace
proc_test.go:3337: iteration step 0
proc_test.go:3201: 0x102bdaf70 -0xa8 -0xb8 main.main at main.go:13
proc_test.go:3201: 0x102b746d4 -0x13888 -0x13898 runtime.main at proc.go:225
proc_test.go:3201: 0x102ba1b34 -0x14000045ff0 -0x14000046000 runtime.goexit at asm_arm64.s:1130
proc_test.go:3201: 0x0 0x0 0x0 ? at .:0
proc_test.go:3337: iteration step 1
proc_test.go:3201: 0x102bdb2dc 0x16d2bf400 0x16d2bf3f0 C.helloworld_pt2 at hello.c:15
proc_test.go:3201: 0x102bdb310 0x16d2bf420 0x16d2bf410 C.helloworld at hello.c:19
proc_test.go:3201: 0x102bdb28c 0x16d2bf440 0x16d2bf430 C._cgo_03f30c882f33_Cfunc_helloworld at cgo-gcc-prolog:50
proc_test.go:3201: 0x102ba195c -0x14000045ff0 -0x14000046000 runtime.asmcgocall at asm_arm64.s:935
proc_test.go:3201: 0x0 0x0 0x0 ? at .:0
proc_test.go:3256: couldn't find frame 2 [C.helloworld_pt2 C.helloworld main.main]
proc_test.go:3257: expected: [C.helloworld_pt2 C.helloworld main.main]
proc_test.go:3382: see previous loglines
--- FAIL: TestCgoStacktrace (0.61s)
FAIL
We are not properly switching from the system stack back to the goroutine stack in order to follow the backtrace.
I was looking at this problem, but on linux/arm64, last week. The problem there, at least in part, that arm64FixFrameUnwindContext was copied from the amd64 version and doesn't work correctly on arm64. However it used to work when the tests were run on travis-ci so I suspect it also depends in part from what the C compiler does. Maybe the version of gcc that ran on travis-ci was emitting debug_frame entries, where the one I'm using doesn't.
The problem so far has been within arm64SwitchStack. I have a patch right now which fixes it up a bit. Still failing on one iteration right now but I'm hacking on it.