Created attachment 58018 [details] cpu_loop source code Version: 3.6.0 OS: Linux Valgrind dies on Android for dynamically linked programs, works fine with dynamically linked programs With statically linked binaries, valgrind works fine, With Dynamically linked Binaries, it fails at loading the binary on to RAM due to some linker/mapping issue. Created standalone Cross compiler ToolChain for Android ndk-n5b, got the dynamically linked apps working fine on Android. Compiled valgrind for android with custom built Android ndk-n5b standalone CC toolchain and got it running on Target Platform. Being tracked by Valgrind developers at http://bugs.kde.org/show_bug.cgi?id=138424 Reproducible: Didn't try Steps to Reproduce: -Build android standalone toolchain with ndk-n5b -changed armv7 to arm in configure file -got latest config.sub and config.guess files from libtools ./configure --prefix=/data/valcheck --host=arm-linux-androideabi CC=arm-linux-androideabi-gcc make && make install && adb push /data/valcheck /data/valcheck compiled a small program let say a hello world program, actually another cpu_busy loop that has NO static arrays. valgrind --tool=memcheck cpu_loop_dyn Actual Results: Dies with valgrind: mmap(0x0, 2952865436) failed in UME with error 22 (Invalid argument). valgrind: this can be caused by executables with very large text, data or bss segments. Expected Results: It should run and yield memleak statistics
Created attachment 58019 [details] log of cpu_loop dynamically linked program run thorugh valgrind
Created attachment 58020 [details] strace log of cpu_loop dynamically linked program run through valgrind
Created attachment 58021 [details] statically linked program run on valgrind works fine
Android isn't really a supported platform yet, so you're probably better off addressing this with the people that are working on porting valgrind to android than report it here as none of us have any experience of valgrind on android.
(In reply to comment #4) > Android isn't really a supported platform yet, so you're probably better off > addressing this with the people that are working on porting valgrind to android > than report it here as none of us have any experience of valgrind on android. From the strace log and valgrind log data, I come to a stand that it is breaking in loading the exe file onto memory. Can you please give some more info on why this can happen, So, that I can try fixing it.
As I said, valgrind is not currently supported on android and nobody here is going to be able to help you. There are people working on android port and I suggest you talk to them. There is bug tracking the progress they have made so far which you can see here: https://bugs.kde.org/show_bug.cgi?id=266035 The problem you are seeing is most likely caused by incompatibilities between the address space layout on android and how valgrind likes to arrange memory, such that something can't be loaded at the required address. It will need careful debugging by somebody with good knowledge of both valgrind and the kernel being used and access to an appropriate system on which to debug it.