Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@redhat.com>
Subject: Re: RFC: change needs_frame_tls_address
Date: Sat, 24 Jul 2010 01:04:00 -0000	[thread overview]
Message-ID: <201007240204.20661.pedro@codesourcery.com> (raw)
In-Reply-To: <m31vat3k2y.fsf@fleche.redhat.com>

> For this we get a warning from value_static_field, then things go
> downhill and we hit an internal_error.  From the PR:

(...)

> After tracing through the TLS code for a bit, I have concluded that TLS
> does not really need a frame, at least not in the gdb sense.  Instead, I
> think it only needs registers -- a funny sort of distinction to make,
> but nevertheless...

Given that if you have registers, you always have a frame, I don't
think that's a good check.

>     (gdb) p A::num
>     $1 = 1
>     (gdb) kill
>     Kill the program being debugged? (y or n) y
>     (gdb) p A::num
>     Cannot access memory at address 0xb7fdb6d8

Is that useful?  It seems to be trying to print a bogus
address.  Actually, I'm surprised you even got that memory error
instead of "Cannot find thread-local variables on this target", which
is what I get on x86-64 (both -m64/-m32) with your change applied.
Clearly gdb didn't try reading any register, otherwise, you would see
some other error.  Do you have other changes in your tree perhaps?

> If it is not acceptable, I would appreciate some enlightenment as to
> what other approach I should take.

The warning seems bogus to me:

> (gdb) print A::num
> warning: static field's value depends on the current frame - bad debug info?
> findvar.c:427: internal-error: read_var_value: Assertion `frame' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n) 

I think we should throw an error instead, just like what you get when
you try to print a non class static global TLS variable:

 __thread int global_num = 1;

Both cases are the same in the user's perpective, so should behave
equal.  Trying to print `global_num' with no process/core throws an
error in value_of_variable.  I guess we should make value_static_field
use value_of_variable instead of read_var_value directly too (or a factored
out variant that doesn't throw if read_var_value returns NULL).

-- 
Pedro Alves


  reply	other threads:[~2010-07-24  1:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 22:33 Tom Tromey
2010-07-24  1:04 ` Pedro Alves [this message]
2010-07-26 13:36   ` 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=201007240204.20661.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@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