Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Ansis Atteka <ansisatteka.dev@gmail.com>
To: gdb@sourceware.org
Subject: Why GDB ignores relative RPATH to find shared libraries?
Date: Fri, 19 Nov 2010 01:31:00 -0000	[thread overview]
Message-ID: <AANLkTi=q4hnvgg_J514Q-Z1F1Pg6HNUuLGKRyYor2NmB@mail.gmail.com> (raw)

Hello,

This is actually a suggestion of how GDB might make easier coredump
analysis when RPATH with $ORIGIN is used to specify relative paths to
shared libraries.

Use case:
I have a program which runs on a different machine than it was built
on. It uses some system shared libraries (in "/lib" directory) and
also some of our own shared libraries (in "/opt/application/lib"
directory). The executable itself is in "/opt/application/bin". So
path to my libraries is relative with respect to executable (obviously
the path to my private libs will be "../lib" from
"/opt/application/bin").

The problem is that whenever I need to do remote coredump analysis on
development workstation I always have to make sure that GDB uses
correct shared libraries. So is there a reason why gdb ignores
relative $ORIGIN RPATH and does not automatically load my libs from
correct rpath whenever I do "gdb /path/to/executable
/path/to/coredump?

It seems that GDB favours the paths to shared libraries specified in
coredump file instead of those specified in executable and that is not
portable for remote analysis. The only case when GDB should favour
path to shared libraries from coredump is when executable itself
loaded shared library with dlopen().

Other solutions, which I do not like that much:
1. Use relative LD_LIBRARY_PATH=../lib. The problem with this approach
is that it sets relative path in respect to Current Working Directory
instead of respect to Executable. And of course LD_LIBRARY_PATH leads
to other problems...
2. Set *.so lib paths from GDB manually. Extra overhead of work which
might lead to other problems. I would prefer that I could simply copy
coredump to my build products and do analysis right away without
setting any paths explicitly.

Best regards,
Ansis Atteka


             reply	other threads:[~2010-11-19  1:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19  1:31 Ansis Atteka [this message]
2010-11-21 18:26 ` 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='AANLkTi=q4hnvgg_J514Q-Z1F1Pg6HNUuLGKRyYor2NmB@mail.gmail.com' \
    --to=ansisatteka.dev@gmail.com \
    --cc=gdb@sourceware.org \
    /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