Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: Mark Kettenis <kettenis@gnu.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFC] Generic support for qGetTLSAddr packet
Date: Mon, 06 Dec 2004 23:46:00 -0000	[thread overview]
Message-ID: <20041206164416.5eba79c4.kevinb@redhat.com> (raw)
In-Reply-To: <200412062237.iB6MbIGY000533@elgar.sibelius.xs4all.nl>

On Mon, 6 Dec 2004 23:37:18 +0100 (CET)
Mark Kettenis <kettenis@gnu.org> wrote:

> Yikes!  That qGetTLSAddr in the function name is really ugly.

Yeah, it is.

Okay, how about something like

    get_remote_TLS_load_module_params

?

> That said, I don't understand why there's any need for the remote code
> to get so deep into the core GDB code.  I don't see the big picture
> yet, but my initial reaction is that this must be wrong.  Why does the
> remote protocol need to know more than a native GDB?

A thread local address is requested via to_get_thread_local_address().
Here's the comment / declaration from target.h:

    /* Return the thread-local address at OFFSET in the
       thread-local storage for the thread PTID and the shared library
       or executable file given by OBJFILE.  If that block of
       thread-local storage hasn't been allocated yet, this function
       may return an error.  */
    CORE_ADDR (*to_get_thread_local_address) (ptid_t ptid,
					      struct objfile *objfile,
					      CORE_ADDR offset);

Abstracting this only a little bit, the following pieces of information
are needed:

    1) The thread id associated with the thread local storage.  Native
       GDB gets this from ``ptid''.
    2) The load module containing the thread local storage.  Native GDB
       gets this by examining ``objfile''.
    3) The offset provided by the debug information.  (Provided by
       ``offset''.)

(1) and (3) are provided to the stub in an unsurprising fashion.

(2), the load module, is represented by an objfile which is a struct
(pointer) The gdbarch method (whose name you object to) provides a
mechanism by which suitable portions of the objfile struct may be
extracted / translated for benefit of the stub.  As Daniel indicates,
for GNU/Linux, the crucial bit of translation needed by the stub is
the mapping from objfile to a linkmap address.  (This is something that
it would be difficult for the stub to do on its own.) However, this
link map address is simply another representation of the load module,
albeit in a form that's readily usable by the stub.

>    The patch below implements support for the qGetTLSAddr packet.  See:
> 
>        http://sources.redhat.com/ml/gdb/2004-11/msg00189.html
> 
>    This patch also adds a new gdbarch method for fetching the OS / ABI
>    specific load module parameters.
> 
> I don't think this should be added to the "glibal" gdbbarch vector.
> Instead, this probably should be architecture-dependent data that's
> only known to the remote protocol module.

Yeah, this could be done.  I'll look to see what the implications are
of doing it this way...

Kevin


  parent reply	other threads:[~2004-12-06 23:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-06 21:57 Kevin Buettner
2004-12-06 22:51 ` Mark Kettenis
2004-12-06 23:06   ` Daniel Jacobowitz
2004-12-08  0:24     ` Kevin Buettner
2004-12-08  0:38       ` Kevin Buettner
2004-12-08  1:39         ` Daniel Jacobowitz
2004-12-06 23:46   ` Kevin Buettner [this message]
2004-12-12 18:17 ` Andrew Cagney

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=20041206164416.5eba79c4.kevinb@redhat.com \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=kettenis@gnu.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