Re: [PATCH] Ignore the first entry returned by svr4_current_sos_via_xfer_libraries for dynamically linked programs

Jan Kratochvil
2013-06-04T18:07:31Z

Hi Ben,

On Tue, 28 May 2013 20:31:31 +0200, Ben Cheng wrote:
> The first entry in the xml list returned by
> svr4_current_sos_via_xfer_libraries() is the executable itself.
[...]
http://sourceware.org/bugzilla/show_bug.cgi?id=15507
> Currently Android is using gdbserver from 7.1 and gdb from 7.3.
[...]
> <library-list-svr4 version="1.0"><library name="<test_program>"
> lm="0xb6fed108" l_addr="0x0" l_ld="0x0"/><library name="/system/bin/linker"

in fact this GDB patch should be dropped.

Bug is in the Android gdbsever implementation. FSF gdbserver 7.1 did not
support <library-list-svr4/> at all, this feature is in gdbserver 7.4+ only.

Main executable should not have an entry, it has only "main-lm" attribute:
info '(gdb)Library List Format for SVR4 Targets'
Additionally the single `main-lm' attribute specifies address of
`struct link_map' used for the main executable.

GNU/Linux FSF gdbserver-HEAD list looks like:

Sending packet: $qXfer:libraries-svr4:read::0,fff#91...Packet received: l<library-list-svr4 version="1.0" main-lm="0x7ffff7ffe208"><library name="/home/jkratoch/redhat/gdb-clean/gdb/testsuite/gdb.base/gcore-relro-lib.so" lm="0x7ffff7ff97f0" l_addr="0x7ffff7bda000" l_ld="0x7ffff7ddadf8"/><library name="/lib64/libm.so.6" lm="0x7ffff7fe8000" l_addr="0x7ffff78d8000" l_ld="0x7ffff7bd8da8"/><library name="/lib64/libc.so.6" lm="0x7ffff7fe84c8" l_addr="0x7ffff7518000" l_ld="0x7ffff78d0b80"/><library name="/lib64/ld-linux-x86-64.so.2" lm="0x7ffff7ffd998" l_addr="0x7ffff7ddc000" l_ld="0x7ffff7ffcdf0"/></library-list-svr4>^M

Regards,
Jan