20

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/elf_file.cc:102: static ElfFile* ElfFile::Create(const char*): Assertion `read_bytes != -1 && read_bytes == sizeof(header)' failed. Stack frame #00  pc 43121300  Aborted

Any ideas?

Thanks.

user1058600
  • 291
  • 4
  • 5
  • Too little information provided. What OS are you on? What terminal client are you using? What does mean "The error printed is"? Why don't you use `-dump` flag of `ndk-stack` script? – artyom.stv Feb 04 '12 at 10:07
  • the error suggests to me that it cant read the binary file. perhaps you should tell it to read from stdin by appending a hyphen (-) to the argument list? – Ярослав Рахматуллин Feb 12 '12 at 05:54
  • Have a look at [my answer](http://stackoverflow.com/questions/4359720/how-to-use-ndk-in-android-project/10136832#10136832). Easy way to start working with NDK – Ashish Dwivedi Apr 24 '12 at 09:20
  • have a Look [this http://stackoverflow.com/questions/4359720/how-to-use-ndk-in-android-project/10136832#10136832](http://stackoverflow.com/questions/4359720/how-to-use-ndk-in-android-project/10136832#10136832) this is a easy way to start NDK with JNI. – Ashish Dwivedi Apr 24 '12 at 09:24

1 Answers1

1

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

Michael O
  • 3,335
  • 1
  • 16
  • 9