android – ndk-stack not working-ThrowExceptions

Exception or error:

I am invoking ndk-stack as follows:

cat file_temp | ~/workspace/android-ndk-r6b/ndk-stack -sym /home/xyz/trunk/apk/obj/local/armeabi/

It finds the crash fingerprint but fails to show me the stack analysis. The error printed is:

ndk-stack: elff/ static ElfFile* ElfFile::Create(const char*): Assertion `read_bytes != -1 && read_bytes == sizeof(header)' failed. Stack frame #00  pc 43121300  Aborted

Any ideas?


How to solve:

This is the ndk-stack program being unable to read the unstripped version of your shared libraries.

The specific crash occurs because a file exists matching the module name, but it’s not large enough to contain an ELF header.

Things to do:

  1. Check that the files contained in the directory supplied via -sym are correct (and not truncated).

  2. Remove truncated files or files smaller than a few hundred bytes.

If you’re curious, the source code for ndk-stack is in the android source tree under ndk/sources/host-tools/ndk-stack

Leave a Reply

Your email address will not be published. Required fields are marked *