-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/link: DWARF CFI rejected when function does not allocate stack space on ARM64 #35100
Comments
I've been able to get the stacktraces for both It seems the CFI of functions which does not allocate stack space are rejected. Problem seems to come around here: go/src/cmd/link/internal/ld/dwarf.go Lines 1492 to 1503 in b17fd8e
Depending on
When the function does not allocate stack space,the initial rule for We're digging to understand why |
cc @thanm |
I made a work around patch for Go 1.13.1 which adds a linker flag Using this flag, Breakpad is able to use the CFI and unwind the stacktrace properly for both We don't expect this patch to be merged, but if anybody has a similar issue to ours, it might be something to try. Finally, from our current understanding, we believe Breakpad does not handle properly |
cc @eliasnaur you might be interested in this, @gawen is working with us |
For the record, Breakpad is what Crashlytics uses (and probably others). |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
On a Android phone, with the following Go code compiled for the target
android/arm64
with-ldflags="-compressdwarf=false"
.We made a small Android app which lets the user call
CrashNilPointer
andCrashDelayed
.We're using Crashlytics which uses Google Breakpad to generate minidumps when a native crash happens.
Using Breakpad's
minidump_stackwalk
, we are able to unwind the stack of the minidumps.The
minidump_stackwalk
output for the crashing thread whenCrashDelayed
is called is:The
minidump_stackwalk
output for the crashing thread whenCrashNilPointer
is called is:The stacktrace when
CrashDelayed
is called is correct, as it unwinds until the user's code, yet does not unwind untilCrashDelayed
which spawns the goroutine callingCrashNilPointer
. Note all stack frames are discovered with the "call frame information" (DWARF's CFI).However, the stack when
CrashNilPointer
is called is not correct, as it stops atruntime.crash
. Note also that the stack frame ofruntime.crash
is discovered by "stack scanning".The way Breakpad gets a stack frame from an ARM64 minidump is to first check if a CFI exists and is correct, and if not, falls back on extracting the stack frame from the frame pointer, or (if fails again) scanning the stack trace (see
breakpad/src/process/stackwalker_arm64.cc:251
).The stacktrace from
CrashDelayed
is unwinded thanks to DWARF CFIs, in particular forruntime.crash
(stack level 2). But theCrashNilPointer
's stacktrace unwinds toruntime.crash
(stack level 1) with stack scanning and then fails, which means Breakpad didn't find any CFI for it. Plus,runtime.dieFromSignal
, which is called byruntime.crash
, is not detected by the stack scanner.Note that Android Studio's LLDB is able to unwind a proper stacktrace for both
CrashDelayed
andCrashNilPointer
when the segmentation fault happens.What did you expect to see?
We expected to see the full stacktrace for a segmentation fault not happening in a goroutine (
CrashNilPointer
), whereruntime.dieFromSignal
is properly unwinded with DWARF's CFI.What did you see instead?
The stacktrace for
CrashNilPointer
is truncated and incorrect.The text was updated successfully, but these errors were encountered: