android / android/ndk

[FR] create_minidebuginfo should be bundled in the NDK

Open
#1,949 10 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
2.3k
Forks
310
PR merge metrics
No merged PRs in 30d

Description

[`create_minidebuginfo`](https://cs.android.com/android/platform/superproject/main/+/main:art/tools/create_minidebuginfo/) is a tool that makes it possible to compress native `.so` debug information (in particular, unwind tables) so that they take less space on device disk.

Unfortunately, this tool is only available from within AOSP, despite the fact that it is generally useful to anyone building native code for Android, not just platform code.

Making this tool more widely available would provide more opportunities for developers to reduce the footprint of their binaries. The other approach, stripping the unwind tables entirely, is unpalatable because that means native crash reports do not contain usable stack traces.

As an example, here is the impact of compressed unwind tables on [Cronet](https://developer.android.com/guide/topics/connectivity/cronet) (a134cecb, arm64):

- Normal release build: 5902688 bytes (5.7 MiB)
- Unwind tables stripped: 4813520 bytes (4.6 MiB)
- Unwind tables compressed: 5029632 bytes (4.8 MiB)

Cronet already uses compressed unwind tables when it's bundled inside Google 1P apps; for more background on this, see this [internal doc](https://docs.google.com/document/d/1hX3ZdRDlb-0SxaTXwz1oMbQK5VEy897-BSSld--jhBA/edit). In order to be able to do this, we had to jump through hoops and [transplant](http://shortn/_Pa4Z9W0yqE) `create_minidebuginfo` to the internal build system. Having this tool inside the NDK would allow us to clean this up, and would also make it easier for third-party app developers to start using it and reap the benefits.

As far as I know, the only real downside to using compressed unwind tables is that debuggerd only understands them starting from Android P. This caveat should be documented.

Even better would be to get rid of `create_minidebuginfo` altogether and have the linker do it automatically, but I'm not sure how feasible that would be.

Contributor guide

Open the contributing guide

Research direction

Review AOSP's art/tools/create_minidebuginfo and the NDK's tool-bundling process to determine how the utility could be distributed. Check the debuggerd Android P compatibility caveat, and consider the issue complete when the tool is available in the NDK with that limitation documented.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.