Barry Song <21cn...@gmail.com> wrote.
> 2012/2/3 Ulrich Weigand <ulrich.weig...@de.ibm.com>:
> > However, from looking at the gdbserver sources provided with Android,
> > it seems there are some differences; in particular, there's this patch:
> >
> > +/* Android doesn't have libthread_db.so.1, just libthread_db.so.  */
> > +#ifdef __ANDROID__
> > +#define LIBTHREAD_DB_SO "libthread_db.so"
> > +#endif
> > +
> >
> > If libthread_db is named differently, this would explain why GDB is
> > unable to find and use it.
>
> there are two ways to handle this issue:
> 1. ln -s /system/lib/libthread_db.so /system/lib/libthread_db.so.1

That would seem a good thing in any case.  (Is there any reason for
Android to use nonstandard shared library naming conventions?)

> this "fixed" Assertion `_rtld_global_ro._dl_pagesize != 0' , but it
> still can't find multi-threads for android processes:
> (gdb) info threads
>   Id   Target Id         Frame
> * 1    process 645 "system_server" __ioctl ()
>     at bionic/libc/arch-arm/syscalls/__ioctl.S:15
>
> (gdb) info threads
>   Id   Target Id         Frame
> * 1    process 938 "mediaserver" __ioctl ()
>     at bionic/libc/arch-arm/syscalls/__ioctl.S:15

I had a quick look at the AOSP sources, and found that there actually
is an implementation of libthread_db that is supposed to work with
bionic.  Well, there seem to be multiple versions:

./bionic/libthread_db
./ndk/sources/android/libthread_db/gdb-6.6
./ndk/sources/android/libthread_db/gdb-7.1.x

I'm not sure why there needs to be a different version for each
GDB(server) release ...   Maybe there's something in there that
also needs changing when it's being used by GDB directly instead
of by gdbserver.

I'll probably not be able to help you very much here; I'd suggest
you 1) make sure your GDB actually uses the correct version of
libthread_db (in particular, not one from glibc, but this one that
handles bionic) and 2) if it still doesn't work, you'll have to
debug what's going wrong.

Note that from a quick look at the above libthread_db sources,
those actually do not look into bionic data structures at all,
but rather just traverse /proc to get a thread list.  While this
is somewhat odd (if you want to do that, you could just do it in
gdb/server itself -- the only reason why libthread_db is a separate
project is its close integration with the thread library), it ought
to make it easier to understand what's going on / wrong.


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand | Phone: +49-7031/16-3727
  STSM, GNU compiler and toolchain for Linux on System z and Cell/B.E.
  IBM Deutschland Research & Development GmbH
  Vorsitzende des Aufsichtsrats: Martina Koederitz | Geschäftsführung: Dirk
Wittkopp
  Sitz der Gesellschaft: Böblingen | Registergericht: Amtsgericht
Stuttgart, HRB 243294


_______________________________________________
linaro-dev mailing list
linaro-dev@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/linaro-dev

Reply via email to