Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: "Stephen P. Smith" <ischis2@cox.net>
Cc: gdb <gdb@sources.redhat.com>
Subject: Re: shared library support
Date: Fri, 11 Jun 2004 21:14:00 -0000	[thread overview]
Message-ID: <20040611141424.2bed79f7@saguaro> (raw)
In-Reply-To: <40AE69AB.7000004@cox.net>

Stephen,

Sorry it took me so long to get back to you on this...

On Fri, 21 May 2004 13:42:19 -0700
"Stephen P. Smith" <ischis2@cox.net> wrote:

> In this case, and since some things have changed, I prefer to do it
> the correct way.  I may need quite abit of direction since I this
> will be my first major effort as long as you don't mind.  Kevin,
> would you please go into more detail about the solib.c support that
> you think is needed.

In many of the solib-*.c files, you'll see the following:

  /* FIXME: Don't do this here.  *_gdbarch_init() should set so_ops. */
  current_target_so_ops = &svr4_so_ops;

As indicated by the FIXME, we need some other mechanism for setting
the so_ops vector.  I think we'll want to do away with the global
``current_target_so_ops'' and create something equivalent using the
gdbarch_data machinery.  The per-architecture _gdbarch_init() function
will initialize the so_ops vector based on the OS/ABI.

This machinery is not dissimilar to the way that the link-map-offset
fetchers get set up for the various OS/ABIs that use solib-svr4.c
as its backend.  In a nutshell, we need to have something analogous
to set_solib_svr4_fetch_link_map_offsets() for setting the overall
solib backend.

---

As I've indicated in the past, you'll want to move your shared
library support into a solib-something.c file.  Look at (and mimic)
one or more of the following: solib-svr4.c, solib-irix.c, solib-aix5.c,
and solib-frv.c.  solib-aix5.c might be of particular interest.  Unlike
the the other solib backends listed above, this backend does NOT fetch
dynamic linker info from the target's memory.  It instead reads out of
some /proc files.  This means that solib-aix5.c will only work for native
targets.  This particular property is of zero interest to you, but the
fact that it uses a different (non-memory-based) mechanism for accessing
the dynamic linker data may be.

When I write a new solib backend -- I did one recently for FR-V/uClinux --
I make a copy one of the above mentioned files, say solib-svr4.c, rip
the guts out of each of the functions that implement the so_ops vector
and then delete any remaining unreferenced functions or data structures.
I then choose a representation for ``struct lm_info''.  (It's worth
comparing how this struct differs between each of the files I mention
above.)  Finally, I reimplement the various function comprising the
so_ops vector and add whatever supporting functions and data structures
that I find necessary.

> One of the things, besides what you have talked about already that
> may need done is what do about communicating with the remote target
> on this issue.  As far as I can tell, there isn't anything in the
> remote protocal for the target to let the host know (or for the host
> to ask) about shared libraries.  But that is for a future disussion.

Most of the current shared library backends read the dynamic linker
data out of memory.  I happen to like this approach because it means
that the shared library implementation stays the same for native and
remote targets.

That said, there are definitely some operating environments which
don't fit this mold and it'd be really nice to have a remote protocol
extension for handling it.  Please post your protocol related
proposals to gdb@sources.redhat.com.

> Also would you want me to submit these changes as a series of small
> patches, or big ones. 

We generally like looking at small patches better than large ones. 
That said, there are instances when large patches are acceptable.

One such case is when you want to show the overall direction that
you're taking.  In such a case, you can post a large patch, but
clearly indicate that you intend to break it up into smaller pieces
for actual review.

Also, new files are usually submitted all at once.  So, for example, 
if you had a new shared library backend called solib-foo.c, you'd
submit this file as part of a single patch.

Kevin


  reply	other threads:[~2004-06-11 21:14 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-20 21:05 Stephen P. Smith
2004-05-21 20:49 ` Stephen P. Smith
2004-06-11 21:14   ` Kevin Buettner [this message]
2004-06-24  1:55     ` shared library support hookin the remote.c Stephen & Linda Smith
2004-06-28 21:44       ` Kevin Buettner
2004-06-28 21:45         ` Stephen P. Smith
2004-06-29  1:55           ` Kevin Buettner
2004-06-29  1:56             ` Stephen & Linda Smith
2004-07-01 17:58               ` Kevin Buettner
2004-07-02 20:20                 ` Andrew Cagney
2004-07-02 21:16                   ` Stephen P. Smith
2004-07-02 22:30                     ` Andrew Cagney
2004-07-13 20:15                       ` Stephen P. Smith
2004-07-14 18:30                         ` Andrew Cagney
2004-07-14 18:44                           ` Stephen & Linda Smith
2004-07-14 19:05                             ` Dave Korn
2004-07-14 19:29                             ` Andrew Cagney
2004-07-02 21:25                   ` Kevin Buettner
2004-07-02 22:25                     ` Andrew Cagney
2004-07-02 23:22                       ` Kevin Buettner
2004-07-08 15:04                         ` Andrew Cagney
2004-07-28  3:04                           ` Kevin Buettner
2004-08-03 14:58                             ` Andrew Cagney
     [not found] <20040517120219.5fad9bc0@saguaro>
2004-05-18 13:37 ` shared library support Stephen & Linda Smith
2004-05-18 15:44   ` Kevin Buettner
     [not found]     ` <40AA4328.6000109@cox.net>
2004-05-18 18:48       ` Kevin Buettner
2004-05-20 18:05         ` Stephen P. Smith
2004-05-21  0:24           ` Kevin Buettner

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=20040611141424.2bed79f7@saguaro \
    --to=kevinb@redhat.com \
    --cc=gdb@sources.redhat.com \
    --cc=ischis2@cox.net \
    /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