From: Jim Blandy <jimb@redhat.com>
To: Andrew Cagney <ac131313@cygnus.com>
Cc: gdb@sources.redhat.com
Subject: Re: GDB support for thread-local storage
Date: Fri, 21 Jun 2002 12:34:00 -0000 [thread overview]
Message-ID: <npadpotohp.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <3D1282DD.7000508@cygnus.com>
Andrew Cagney <ac131313@cygnus.com> writes:
> > I've posted a note to the Dwarf mailing list, describing the
> > DW_OP_push_tls_address approach, and saying that we'll experiment with
> > this as a GNU extension to Dwarf and write back when we've actually
> > got something working.
>
> Hmm, would you be able to post the prososal here?
Sure thing. (I re-used most of the language in the Dwarf proposal in
the message you replied to, so you've seen almost all of it already.)
Something to make clear, though --- this isn't a "proposal" proper.
The way the Dwarf committee operates (or the way I think it should
operate, and thus the way I try to deal with it) is:
- you float an idea by them for general approval;
- then you go off and implement it as a vendor extension;
- then once you've got it actually working you come back and make it a
real proposal;
- if it's accepted you get assigned proper numbers (not in the vendor
extension range) for your attribute tags, die tags, and so on;
- and finally you switch your emitter to recognize the real numbers.
So this is in the "float an idea by them" stage. Very preliminary.
$Id: dwarf,v 1.4 2002/06/12 21:44:14 jimb Exp $
(The function of DW_OP_push_tls_address is similar to that of the
run-time function __get_tls_addr, so it was tempting to name the
operation DW_OP_get_tls_addr. However, DW_OP_push_tls_address is more
consistent with the names of the other operations, especially
DW_OP_push_object_address.)
To section 2.4.1.3, "Stack Operations", add the following paragraphs
after DW_OP_push_object_address:
12. DW_OP_push_tls_address
The DW_OP_push_tls_address operation pushes the base address of the
current thread's thread-local storage block. If the expression occurs
in the Dwarf information for a dynamically loaded library, then
DW_OP_push_tls_address pushes the base address of that library's block
for the current thread. If the library's storage for the current
thread has not yet been allocated, a Dwarf consumer may arrange for it
to be allocated now, or report an error to the user.
<rationale italics>
Some implementations of C and C++ support a ``__thread'' storage
class, for variables that occupy distinct memory in distinct threads.
For example, the definition:
__thread int foo;
declares an integer variable named ``foo'' which has a separate value
and address in each thread, much as a variable declared ``auto'' has a
separate value and address in each invocation of the function
containing its declaration. Creating a new thread creates a new
instance of ``foo'', and when the thread exits, the storage for
``foo'' is freed.
Typically, a program includes an ``initialization image'' --- a block
of memory containing the initial values for any thread-local variables
it defines. When the program creates a new thread, the run-time
system allocates a fresh block of memory for those thread-local
variables, and copies the initialization image into it to give the
variables their initialized values.
A dynamically loaded library may also define thread-local variables.
Some implementations delay allocating memory for such variables until
the thread actually refers to them for the first time. This avoids
the overhead of allocating and initializing the library's thread-local
storage for all the threads present in a program when the library is
loaded, even though only a few threads might actually use the library.
However, when an implementation allocates thread-local storage on
demand, this makes it hard to describe the location of a thread-local
variable using ordinary Dwarf expressions: referencing the storage may
entail allocating memory, copying an initialization image into place,
registering it with the thread, and so on. A dedicated operation like
DW_OP_push_tls_address leaves this complicated task to the debugger,
which is presumably already familiar with the program's ABI and thread
system, and can handle the request appropriately.
</rationale italics>
next prev parent reply other threads:[~2002-06-21 19:34 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-19 9:00 Jim Blandy
2002-06-19 10:08 ` Daniel Berlin
2002-06-19 12:20 ` Jim Blandy
2002-06-19 13:12 ` Daniel Berlin
2002-06-19 13:40 ` Jim Blandy
2002-06-20 18:35 ` Andrew Cagney
2002-06-20 18:48 ` Daniel Jacobowitz
2002-06-21 10:18 ` Andrew Cagney
2002-06-21 10:32 ` Daniel Jacobowitz
2002-06-21 13:08 ` Jim Blandy
2002-06-21 13:18 ` Daniel Jacobowitz
2002-06-21 13:54 ` Jim Blandy
2002-06-21 14:03 ` Daniel Jacobowitz
2002-06-21 14:46 ` Andrew Cagney
2002-06-21 14:55 ` Daniel Jacobowitz
2002-06-21 15:31 ` Andrew Cagney
2002-06-21 22:59 ` Daniel Jacobowitz
2002-06-22 8:22 ` Andrew Cagney
2002-06-24 7:53 ` Daniel Jacobowitz
2002-06-21 16:14 ` Jim Blandy
2002-06-21 22:57 ` Daniel Jacobowitz
2002-06-26 12:37 ` Jim Blandy
2002-06-21 13:20 ` Daniel Jacobowitz
2002-06-21 15:37 ` Jim Blandy
2002-06-21 23:00 ` Daniel Jacobowitz
2002-06-21 12:34 ` Jim Blandy [this message]
2002-06-21 12:49 ` Jim Blandy
2002-06-21 18:10 ` Jim Blandy
2002-06-21 20:24 ` Andrew Cagney
2002-06-21 21:09 ` Jim Blandy
2002-06-22 8:31 ` Andrew Cagney
2002-06-21 15:04 ` Andrew Cagney
2002-06-21 15:41 ` Jim Blandy
2002-06-21 15:59 ` Andrew Cagney
2002-06-21 16:08 ` Jim Blandy
2002-06-22 1:04 ` unsuscribe phi
[not found] <1024952640.13693.ezmlm@sources.redhat.com>
2002-06-25 1:48 ` GDB support for thread-local storage James Cownie
2002-06-25 8:05 ` Daniel Jacobowitz
2002-06-25 8:31 ` James Cownie
2002-06-25 8:42 ` Daniel Jacobowitz
2002-06-25 8:53 ` James Cownie
2002-06-25 8:56 ` Daniel Jacobowitz
2002-06-25 9:11 ` James Cownie
2002-06-25 9:29 ` Daniel Jacobowitz
2002-06-25 10:44 ` Andrew Cagney
2002-06-25 10:02 ` Daniel Jacobowitz
2002-06-26 12:45 ` Jim Blandy
2002-06-26 19:31 ` Andrew Cagney
2002-06-26 21:57 ` Jim Blandy
2002-06-27 8:13 ` Andrew Cagney
2002-08-19 9:05 ` Daniel Jacobowitz
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=npadpotohp.fsf@zwingli.cygnus.com \
--to=jimb@redhat.com \
--cc=ac131313@cygnus.com \
--cc=gdb@sources.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