>     What is the output from:
>       $ ldd ./hello-arm-bionic   ### print the shared libs needed by the app
>     and what is the status of __libc_freeres with respect to each of the
>     libraries named by ldd?
> 
> 
> Surprisingly, ldd says my program is not a dynamic executable 

See /usr/bin/ldd, which is a shell script.  It means that ldd has not been
integrated into your environment (what is ldd.RTLDLIST ?) or that the PT_INTERP
/system/bin/linker does not observe all the conventions regarding:
   ${rtld} --verify "$file"
This means that ldd does not work.  [What facility does your environment provide
for listing the actual {libname ==> file} resolution and the transitive closure
of DT_NEEDED shared libraries for an app?]

> but readelf -a hello-arm-bionic shows the need of libc.so shared library. 
> (Full output of readelf here -> http://pastebin.com/b8cnfyrK). FYI, I use 
> agcc from http://plausible.org/andy/agcc to compile hello-arm-bionic. The 
> command line to
> compile is a long one as we can see here http://pastebin.com/7hwc98Y4.
> 
> There is no __lib_freeres in Android's libc.so as objdump -tTx libc.so gives 
> nothing.
> 
> I tried to skip the __libc_freeres call but now then it complains about 
> "cannot locate getpagesize"   (output here -> http://pastebin.com/d3TNmSSn). 
> Also, I tried to substitute __libc_freeres with _vgnU_freeres but it gave me 
> the same error on "cannot locate getpagesize". So I look up getpagesize in
> the .so and it's in there:
> 
> x0152532@unx0152532:~/remote-x0152532$ objdump -tT 
> valgrind/lib/valgrind/vgpreload_memcheck-arm-linux.so | grep getpagesize
> 00000000         *UND*00000000 getpagesize
> 00000000      D  *UND*00000000 getpagesize
> 
> p/s: I copy the same valgrind binary and test it on ARM Ubuntu machine and it 
> works like a charm. So this is either the Android's linker or Android's libc, 
> =)

Yes, the environment is different enough to cause problems.  All of the
GLOBAL *UND* [undefined] symbols from vgpreload_memcheck-arm-linux.so
must be resolvable.

For the specific case of getpagesize, in the valgrind source I see:
   ./config.h.in~:/* Define to 1 if you have the `getpagesize' function. */
So there is a disagreement about the configuration: the build environment
has decided that the runtime environment _will_ have it, but the run-time
environment does not supply it.  So either add getpagesize to the run-time
environment, or convince the build environment that getpagesize is not present.
Similarly for the other GLOBAL *UND* symbols in vgpreload_memcheck-arm-linux.so.

[Haven't other Android developers run into these problems before?]

>     At the time that memcheck fails, which files are mapped?
>       $ cat /proc/<pid>/maps
> 
> 
> Sorry but how to do cat /proc/<pid>/maps if the valgrind is already failed?

Run valgrind under gdb and plant some breakpoints (or convince valgrind to 
invoke
gdb upon detecting such an error; perhaps "--db-attach=yes" is enough), then use
another terminal.  Or, in gdb:
   (gdb) info proc   ### note the PID
   (gdb) shell cat /proc/<pid>/maps

-- 

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to