Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: jan.kratochvil@redhat.com (Jan Kratochvil)
Cc: gary@intrepid.com (Gary Funck),
	vinay@linux.vnet.ibm.com (Vinay Sridhar),
	        gdb-patches@sources.redhat.com,
	drow@false.org (Daniel Jacobowitz),
	        luisgpm@linux.vnet.ibm.com
Subject: Re: [patch] Accessing tls variables across files causes a bug
Date: Mon, 01 Dec 2008 18:30:00 -0000	[thread overview]
Message-ID: <200812011829.mB1ITtMU028584@d12av02.megacenter.de.ibm.com> (raw)
In-Reply-To: <20081201141408.GA10447@host0.dyn.jankratochvil.net> from "Jan Kratochvil" at Dec 01, 2008 03:14:08 PM

Jan Kratochvil wrote:

> +	/* SYMBOL_VALUE_ADDRESS should return the translated address.  */

I'm not sure I understand this comment -- the translated address of
a thread-local variable obviously depends on the thread in which it
is evaluated, so how should a single location like SYMBOL_VALUE_ADDRESS
be able to hold that value for all threads?

Otherwise, I guess it makes sense to do that translation for 
LOC_UNRESOLVED TLS symbols in read_var_value, just like it would
be done for LOC_COMPUTED symbols; in both cases assuming evaluation
in the current thread.

> +	    /* SYMBOL_VALUE_ADDRESS should return the translated address.  */
> +	    if (section
> +		&& (section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0)
> +	      {
> +		printf_filtered (_("a thread-local variable at offset %s "
> +				   "at final address "), paddr_nz (load_addr));
> +		load_addr = target_translate_tls_address (section->objfile,
> +							  load_addr);
> +	      }

Again, I think "at final address" may be misleading; if we give an absolute
address, it should explicitly mention it is relative to the current thread.

On the other hand, I'm wondering if we should perform the resolution here
at all; isn't "info address" also allowed when the target is not actually
running, so we don't even have a current thread?

In the LOC_COMPUTED case, we'd output something like "at offset ...
in the thread-local storage for ...".  For consistency reasons, I'd
prefer to have the same output in the LOC_UNDEFINED case as well.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2008-12-01 18:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-10  4:24 [Fwd: Re: [patch] Re: Accessing tls variables across files causes a bug] Vinay Sridhar
2008-11-27 15:01 ` [patch] Accessing tls variables across files causes a bug Gary Funck
2008-11-27 17:07   ` Jan Kratochvil
2008-12-01 14:15     ` Jan Kratochvil
2008-12-01 18:30       ` Ulrich Weigand [this message]
     [not found]     ` <20081201182931.GA18248@intrepid.com>
2008-12-01 21:54       ` Jan Kratochvil
2008-12-02 13:54         ` Ulrich Weigand
2008-12-02 14:53           ` Gary Funck
2008-12-02 15:13             ` Jan Kratochvil
2008-12-02 15:40               ` Gary Funck

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=200812011829.mB1ITtMU028584@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=drow@false.org \
    --cc=gary@intrepid.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jan.kratochvil@redhat.com \
    --cc=luisgpm@linux.vnet.ibm.com \
    --cc=vinay@linux.vnet.ibm.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