Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sources.redhat.com, "Levchenko,
	Vasily V" <vasily.v.levchenko@intel.com>
Subject: Re: Relative and absolute paths in link_map
Date: Fri, 18 Feb 2005 02:32:00 -0000	[thread overview]
Message-ID: <20050217130923.215ae9af@ironwood.lan> (raw)
In-Reply-To: <20050217174326.GA18733@nevyn.them.org>

On Thu, 17 Feb 2005 12:43:26 -0500
Daniel Jacobowitz <drow@false.org> wrote:

> On Thu, Feb 17, 2005 at 09:14:15AM -0700, Kevin Buettner wrote:
> > On Thu, 17 Feb 2005 18:20:43 +0300
> > "Levchenko, Vasily V" <vasily.v.levchenko@intel.com> wrote:
> > 
> > > This is a patch corrects comparing of the shared object names which
> > > could be relative and absolute.
> > > Situation:
> > > 	To get tls-variable from shared library.
> > 
> > Hi Vasily,
> > 
> > Thanks for your patch!
> > 
> > In the future, please send some sort of context diff, that is, patches
> > generated either with "diff -u" or "diff -C".  (I also like it when the
> > "-p" switch is used.)
> > 
> > I have read your patch and understand what it is doing, but before
> > putting your change in, I'd first like to understand why it's necessary.
> > Could you offer a bit more explanation about why it is needed?  Do you
> > happen to have a small test case?
> 
> I'd also like to see a testcase.  The patch compares only the basenames
> of libraries (it should use lbasename from libiberty, by the way), but
> it's possible to have two DSO plugins with the same basename and
> different directories loaded.

Actually, I've been thinking about rewriting svr4_fetch_objfile_link_map()
so that it looks more like this (which will be in a forthcoming patch
for remote TLS support on the FR-V):

+CORE_ADDR
+frv_fetch_objfile_link_map (struct objfile *objfile)
+{
+  struct so_list *so;
+
+  /* Cause frv_current_sos() to be run if it hasn't been already.  */
+  if (main_lm_addr == 0)
+    solib_add (0, 0, 0, 1);
+
+  /* frv_current_sos() will set main_lm_addr for the main executable.  */
+  if (objfile == symfile_objfile)
+    return main_lm_addr;
+
+  /* The other link map addresses may be found by examining the list
+     of shared libraries.  */
+  for (so = NULL; ((so = so_list_iterator (so))); )
+    {
+      if (so->objfile == objfile)
+	return so->lm_info->lm_addr;
+    }
+
+  /* Not found!  */
+  return 0;
+}

I haven't included the full patch.  There's a few other bits and pieces
such as the code which sets main_lm_addr in the ``current_sos'' function.

Anyway,...  this method is much more efficient in that it doesn't read
any memory on the target.  It simply uses the list of shared objects
that's already been constructed in GDB.

I suspect that a rewrite like the above will handle whatever case
Vasily's been running into, but I want to understand the exact
scenario first.

Kevin


  reply	other threads:[~2005-02-17 20:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-17 16:59 Levchenko, Vasily V
2005-02-17 17:13 ` Kevin Buettner
2005-02-17 23:48   ` Daniel Jacobowitz
2005-02-18  2:32     ` Kevin Buettner [this message]
2005-02-18 16:51 Levchenko, Vasily V

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=20050217130923.215ae9af@ironwood.lan \
    --to=kevinb@redhat.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=vasily.v.levchenko@intel.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