Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Paul Pluzhnikov <ppluzhnikov@google.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Implement qXfer:libraries for Linux/gdbserver
Date: Sun, 14 Aug 2011 16:36:00 -0000	[thread overview]
Message-ID: <20110814163543.GA7641@host1.jankratochvil.net> (raw)
In-Reply-To: <CALoOobOXDSnZFHgZepKOVr3R-zJm=k0tbiTSRjJSn4pOeoqyZg@mail.gmail.com>

On Tue, 09 Aug 2011 18:56:15 +0200, Paul Pluzhnikov wrote:
> Side note: SO_NAME_MAX_PATH_SIZE == 512 in solist.h is wrong for Linux;
> I am surprised this hasn't bitten anyone yet. Why doesn't it use PATH_MAX ?

I agree, that static array is not nice anyway.


Regarding design merge of solib-svr4.c XML with solib-target.c XML I have
read the threads:
	[RFC] Add expat to the GDB sources
	http://sourceware.org/ml/gdb-patches/2006-07/msg00231.html
	[RFC, take 2] Optional expat
	http://sourceware.org/ml/gdb-patches/2006-08/msg00048.html

and there is opposition by Mark and Eli (and IIRC only by Mark and Eli)
against any additional pre-requisites for some minimal native GDB build.

I have to agree just because of some minor internal design clean up it may not
make sense to break this pre-requisite rule.

Sidenote: readline needs to continue being bundled as even latest (=bundled)
readline release needs to stay forked at least by:
	[patch 2/3] readline-6.2: Workaround "ask" regression
	http://sourceware.org/ml/gdb-patches/2011-05/msg00005.html
But work is continuing in general to make the possibility of dropping bundled
readline, where it turns from current technical reasons to political reasons.

solib-svr4.c should be split etc. but I find it now outside of the scope of
this patch.


I would therefore find OK to just technically merge the XML parsing in
solib-svr4.c and solib-target.c into some solib.c for example to be called
from both points (if it still makes sense after the changes requested below).

Besides that there are some bugs in the current solib-svr4.c implementation.
If you:
	prelink -R /lib64/libc-2.14.90.so
Then it will:
Sending packet: $qXfer:libraries:read::0,fff#d5...Packet received: l<library-list>\n  <library name="/lib64/libc.so.6"><segment address="0x0"/></library>\n  <library name="/lib64/ld-linux-x86-64.so.2"><segment address="0x0"/></library>\n</library-list>\n
warning: while parsing target library list (at line 2): No segment defined for /lib64/libc.so.6

Which is correct, because `l_addr' being sent as `segment address' is just
in-memory vs. in-file-at-program-start-time displacement, on prelinked system
l_addr is normally always 0.

This also violates the current protocol description:
gdb.texinfo
@node Library List Format
The segment or section bases are start addresses, not relocation offsets; they
do not depend on the library's link-time base addresses.

So either gdbserver needs to find the real base address of the library (which
is IMO possible only by searching /proc/PID/maps for l_ld mapped object and
taking its base address).  Or a different XML attribute needs to be used.

It also needs to pass l_ld address as it is being used by lm_addr_check to
match up the host in-file bfd addresses to the target in-memory addresses
across various prelink situations.  There are 4 different addresses present at
the same time during debugging:
(1) in-memory target base address where library has been loaded
(2) in-file base address the time the library has been loaded,
    which is contained in ELF data structures in the target memory
(3) in-file host base address of library the time debugger has been started
(4) in-file host separate .debug file address (which is always 0)

gdb.base/break-interp.exp should PASS with it, with working <library-list/>,
currently it prints a lot of:
warning: while parsing target library list: no element found

lm_addr_check currently expects it can read so->lm_info->lm being now NULL
with <library-list/>.  But lm_addr_check will start to be needed with
gdb.base/break-interp.exp so one may hit this problem afterwards.

Sorry for the delay, I can return to it in 1-2 weeks (need to push entryval).


Thanks,
Jan


  reply	other threads:[~2011-08-14 16:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-05 18:11 [patch] Implement qXfer:libraries for Linux/gdbserver [Was: Re: [RFC] Make target_read_string faster over high-latency links.] Paul Pluzhnikov
2011-08-08 18:36 ` Jan Kratochvil
2011-08-08 18:56   ` Paul Pluzhnikov
2011-08-08 21:24     ` [patch] Implement qXfer:libraries for Linux/gdbserver Jan Kratochvil
2011-08-09 18:25       ` Daniel Jacobowitz
2011-08-08 21:10 ` Jan Kratochvil
2011-08-08 21:31   ` Paul Pluzhnikov
2011-08-08 21:38     ` Jan Kratochvil
2011-08-08 23:50       ` Paul Pluzhnikov
2011-08-09  9:07         ` Jan Kratochvil
2011-08-09 16:57           ` Paul Pluzhnikov
2011-08-14 16:36             ` Jan Kratochvil [this message]
2011-10-03 21:57               ` IMO-obsolste: " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110814163543.GA7641@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=ppluzhnikov@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox