Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: unwind support for Linux 2.6 vsyscall DSO
Date: Sat, 04 Oct 2003 07:28:00 -0000	[thread overview]
Message-ID: <vt2znghea1o.fsf@zenia.home> (raw)
In-Reply-To: <200310040010.h940AhG5021281@magilla.sf.frob.com>


Roland McGrath <roland@redhat.com> writes:
> > It seems to me that it should be handled as much like other shared
> > libraries as possible.  So at the point where we load symbols for the
> > shared libraries that a core file references, we also want to load the
> > vsyscall library, if it exists.  Same for attach and run.
> 
> I certainly agree with this in principle.  But in practice I found that
> other shared libraries are handled with complicated hair that it's
> difficult to figure out exactly who calls and when, so I got scared.
> 
> > One approach might be for Linux to define its own linux-solib.h, which
> > #defines SOLIB_ADD and SOLIB_CLEAR to call linux-tdep.c functions that
> > do the standard dynamic linker stuff, but then check the auxv for an
> > AT_SYSINFO_EHDR entry and handle that, too.  That would make things
> > work pretty consistently for the core, attach, and run cases.
> 
> What can I see SOLIB_ADD gets called a lot, and every time it reconstructs
> the inferior's list of objects and compares to gdb's list to see if there
> are any new ones.  The vsyscall DSO is always there and is only possibly
> changed by an exec, so it doesn't make sense to re-check its location a lot.
> Should this SOLIB_ADD then just store whether it has checked yet and clear
> that record in SOLIB_CLEAR?

I think that's what it would take.  Open to better ideas, I'm just
doing the best I can. :)

> > It seems to me that there should be a target vector method for
> > accessing the auxv information, since there's one native-specific way
> > to do it for attach and run, and a core-specific way to do it for core
> > files.  But it's Linux-specific information.  Well, actually, any OS
> > that uses the SYSV-style program invocation process is going to work
> > that way, so maybe it's justifiable.  I don't know.
> 
> The notion of auxv information is at least ELF-specific, and in fact a
> little more specific than that (a system need not use the canonical program
> startup stack protocol to use the ELF file formats).  The style of getting
> the auxv information is so far the same on every system I'm aware of that
> provides a method, i.e. Solaris and Linux (now) both have NT_AUXV in core
> files and /proc/PID/auxv for live processes.

When I say "target vector", I mean 'struct target_ops', not 'struct
gdbarch'.  That is, for core files you ask BFD for the .auxv section,
whereas for live processes you open /proc/PID/auxv.  The code dealing
with the vsyscall solib in the shared library handler (or whereever)
would just call target_get_auxilliary_vector, and the target stack
would decide where to look for it.

> > It seems to me this belongs in a new linux-tdep.c file.
> 
> Agreed.
> 
> > Would it be appropriate to move auxv_parse into BFD?  If I remember
> > right, the dynamic linker parses the auxilliary vector into an array
> > indexed by AT_* values; GDB could call something like that, and then
> > just pick out the AT_SYSINFO_EHDR value pretty easily.
> 
> Though the AT_* values in use are a small set with few holes, it's actually
> an arbitrary tag and not an index of any kind.  Nothing general-purpose can
> assume the range of values is appropriate for an index, and no API
> should.

Okay, maybe that's not the greatest API.

> BFD is overkill for this (not that I'm saying BFD isn't overkill for
> everything).  There is no variation in the format among ELF flavors, it's
> just an even number of words in the format word size.  The very notion of
> an auxilliary vector is ELF-specific; if a non-ELF backend had something
> useful to export in the way of an auxilliary data from somewhere extraction
> interface, it seems doubtful it would be a useful abstraction to call the
> two the same thing in the frontend interface.  I don't have any objection
> to moving the parsing portion out somewhere else, but making it any more
> overblown than the few dozen lines of code it is would be pointless IMHO.

Yeah, I had in mind another elf-specific BFD function, like the one
that reads the solib data from memory.  All I'm suggesting is, take
the code that you've got, move it into bfd, and call it
bfd_elf_auxilliary_vector_sysinfo_ehdr.


  reply	other threads:[~2003-10-04  7:28 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-03  8:27 Roland McGrath
2003-10-03 23:44 ` Jim Blandy
2003-10-04  0:10   ` Roland McGrath
2003-10-04  7:28     ` Jim Blandy [this message]
2003-10-04 20:27       ` Roland McGrath
2003-10-04 21:14         ` Daniel Jacobowitz
2003-10-04 22:01           ` Roland McGrath
2003-10-04 23:28             ` Daniel Jacobowitz
2003-10-06 17:14         ` Jim Blandy
2003-10-06 19:35       ` Elena Zannoni
2003-10-06 19:31 ` Elena Zannoni
2003-10-06 20:24   ` Roland McGrath
2003-10-06 21:48     ` Elena Zannoni
2003-10-06 23:59       ` Roland McGrath
2003-10-07  0:13         ` Roland McGrath
2003-10-07  2:30           ` Elena Zannoni
2003-10-07  2:40             ` Roland McGrath
2003-10-07  2:47               ` Roland McGrath
2003-10-07  3:53           ` Andrew Cagney
2003-10-07  4:07             ` Daniel Jacobowitz
2003-10-07  4:17               ` Andrew Cagney
2003-10-07  4:28             ` Roland McGrath
2003-10-08  0:02               ` Michael Snyder
2003-10-08  0:46                 ` Roland McGrath
2003-10-08 18:27                   ` Andrew Cagney
2003-10-08 21:00               ` Andrew Cagney
2003-10-08 21:47                 ` Roland McGrath
2003-10-08 23:25                   ` Elena Zannoni
2003-10-09  0:45                     ` Roland McGrath
2003-10-08 23:10                 ` Elena Zannoni
2003-10-09  0:50                   ` Roland McGrath
2003-10-08 23:53                 ` Daniel Jacobowitz
2003-10-07  0:17         ` Daniel Jacobowitz
2003-10-07 23:54         ` Michael Snyder
2003-10-08  0:07           ` Roland McGrath
2003-10-07  4:43     ` Jim Blandy
2003-10-07  4:45       ` Roland McGrath
2003-10-09 19:58         ` Kevin Buettner
2003-10-09 20:02           ` Daniel Jacobowitz
2003-10-09 20:10             ` Jim Blandy
2003-10-09 22:20               ` Roland McGrath
2003-10-09 22:49                 ` Kevin Buettner
2003-10-10  0:12                   ` Michael Snyder
2003-10-11  1:44                   ` Roland McGrath
2003-10-09 23:04                 ` Kevin Buettner
2003-10-11  1:47                   ` Roland McGrath
2003-10-15  4:33                     ` Kevin Buettner
2003-10-09 20:21             ` Kevin Buettner
2003-10-09 20:23               ` Daniel Jacobowitz
2003-10-09 20:46                 ` Kevin Buettner
2003-10-09 22:32                   ` Roland McGrath
2003-10-09 22:46                     ` Kevin Buettner
2003-10-11  1:40                       ` Roland McGrath
2003-10-09 22:07           ` Roland McGrath
2003-10-09 22:32             ` Kevin Buettner
2003-10-07  3:33 Roland McGrath

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=vt2znghea1o.fsf@zenia.home \
    --to=jimb@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=roland@redhat.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