-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix unwinding on Android #4894
Fix unwinding on Android #4894
Conversation
Android isn't able to unwind the CHIP native stack, which interferes with debugging. Turn on unwind tables to fix this. Unclear if we want this in optimized builds, but Android OS seems to be able to unwind all of its frameworks and native libraries, so for now assume we do. There's only a space cost, and we can revisit that later. This is the difference between this: backtrace: 02-16 20:49:34.628 3872 3872 F DEBUG : backtrace: 02-16 20:49:34.628 3872 3872 F DEBUG : #00 pc 000000000008246c /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456) 02-16 20:49:34.628 3872 3872 F DEBUG : #1 pc 00000000000a836c /data/app/com.google.chip.chiptool-rPVLWEFRvE413khV9YptWg==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96) and this: 02-16 20:56:04.323 5040 5040 F DEBUG : backtrace: 02-16 20:56:04.323 5040 5040 F DEBUG : #00 pc 000000000008246c /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 5812256023147338b8a9538321d4c456) 02-16 20:56:04.323 5040 5040 F DEBUG : #1 pc 00000000000a839c /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::NetworkProvisioning::SendNetworkCredentials(char const*, char const*)+96) 02-16 20:56:04.323 5040 5040 F DEBUG : #2 pc 000000000009bb58 /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44) 02-16 20:56:04.323 5040 5040 F DEBUG : #3 pc 000000000009bb94 /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (non-virtual thunk to chip::RendezvousSession::SendNetworkCredentials(char const*, char const*)+44) 02-16 20:56:04.323 5040 5040 F DEBUG : #4 pc 0000000000051488 /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (AndroidDeviceControllerWrapper::SendNetworkCredentials(char const*, char const*)+128) 02-16 20:56:04.323 5040 5040 F DEBUG : #5 pc 0000000000054188 /data/app/com.google.chip.chiptool-dz3iwqwmItgQDBBaEcevJw==/base.apk (offset 0x97a000) (Java_chip_devicecontroller_ChipDeviceController_sendWiFiCredentials+188) 02-16 20:56:04.323 5040 5040 F DEBUG : #6 pc 000000000013f350 /apex/com.android.runtime/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: ccd73e8ae9b59d5596b3b8aeef234d43) <snip> 02-16 20:56:04.327 5040 5040 F DEBUG : #75 pc 00000000000be560 /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad) 02-16 20:56:04.327 5040 5040 F DEBUG : #76 pc 00000000000c13d0 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vector<android::String8> const&, bool)+776) (BuildId: e5b25f8fb9f6bb45ccbeca8c07061dad) 02-16 20:56:04.327 5040 5040 F DEBUG : #77 pc 00000000000034e0 /system/bin/app_process64 (main+1168) (BuildId: ade4367f7cc82a88f668180d34ce79fe) 02-16 20:56:04.327 5040 5040 F DEBUG : #78 pc 000000000007dc24 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108) (BuildId: 5812256023147338b8a9538321d4c456)
fdee110
to
1d8832d
Compare
@@ -31,4 +31,7 @@ declare_args() { | |||
|
|||
# Enable position independent executables (-pie). | |||
enable_pie = current_os == "linux" | |||
|
|||
# Remove unwind tables from the binary to save space. | |||
exclude_unwind_tables = current_os != "android" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should we use enable_unwind_tables
as a flag instead, to not have negations? All other flags seem to be positive like enable_*
, optimize_*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My guilty admission is that I copied the arguments from chromium with the aim of keeping some consistency across projects that use GN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defer to @andy31415 on the best practices for GN configs in the project. But functionally, looks good (and useful).
Android isn't able to unwind the CHIP native stack, which interferes
with debugging. Turn on unwind tables to fix this. Unclear if we want
this in optimized builds, but Android OS seems to be able to unwind all
of its frameworks and OS libraries, so for now assume we do. There's only
a space cost, and we can revisit that later.
This is the difference between this:
and this: