public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/11717] common/.bss variables from shared libraries not  displayed correctly
Date: Tue, 03 Apr 2012 08:30:00 -0000	[thread overview]
Message-ID: <bug-11717-4717-4uuKcFlnql@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-11717-4717@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=11717

Jakub Jelinek <jakub at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at redhat dot com

--- Comment #4 from Jakub Jelinek <jakub at redhat dot com> 2012-04-03 08:30:08 UTC ---
(In reply to comment #3)
> As the test case shows, this problem is not limited to unintialized variables
> in .bss -- it also occurs with initialized variables in .data.  
> 
> The basic problem is that the DW_AT_location for the variable in the shared
> library is incorrect, since it does not match how the variable is accessed.  It
> says that var is addressed directly, while in fact it is accessed indirectly
> through the GOT.
> 
> GCC generates
>     DW_OP_addr  var
> which points to the unused copy of var in the shared library.  The correct
> DWARF should be
>     DW_OP_addr  var@GOT
>     DW_OP_deref

Unfortunately, that has a couple of problems:
1) we don't want to generate runtime overhead just for debugging, so the above
   would "work" only if we have some other GOT reference to that symbol in the
   code
2) on most targets we don't have suitable relocations that would give us the 
   address of the GOT slot
Even
DW_OP_addr var@GOT
DW_OP_addr _GLOBAL_OFFSET_TABLE_
DW_OP_plus
DW_OP_deref
doesn't work on x86_64, while var@GOT in that case gives the relative offset
from _GLOBAL_OFFSET_TABLE_ to the GOT entry for var, unfortunately
_GLOBAL_OFFSET_TABLE_ symbol is handled specially and thus becomes a wrong kind
of relocation.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


  parent reply	other threads:[~2012-04-03  8:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-11717-4717@http.sourceware.org/bugzilla/>
2012-01-31 18:05 ` eager at eagercon dot com
2012-04-03  8:30 ` jakub at redhat dot com [this message]
2010-06-18 13:25 [Bug symtab/11717] New: " lance604 at gmail dot com
2010-07-12 20:01 ` [Bug symtab/11717] " nbowler at draconx dot ca
2010-07-21  8:43 ` jan dot kratochvil at redhat dot com
2010-07-21  8:55 ` jan dot kratochvil at redhat dot com
2010-08-22  7:41 ` jan dot kratochvil at redhat dot com

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=bug-11717-4717-4uuKcFlnql@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).