Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Doug Evans <dje@google.com>
Cc: gdb-patches@sourceware.org, tromey@redhat.com,
	ccoutant@google.com,        saugustine@google.com,
	Jakub Jelinek <jakub@redhat.com>
Subject: Re: [RFA] Work around binutils/15021
Date: Sun, 09 Jun 2013 17:09:00 -0000	[thread overview]
Message-ID: <20130608160421.GA10141@host2.jankratochvil.net> (raw)
In-Reply-To: <yjt24nigsohy.fsf@ruffy2.mtv.corp.google.com>

Hello Doug,

On Thu, 17 Jan 2013 00:21:29 +0100, Doug Evans wrote:
> +     This is also used to work around a difference between the way gold
> +     generates .gdb_index version <=7 and the way gdb does.  Arguably this
> +     is a gold bug.  For symbols coming from TUs, gold records in the index
> +     the CU that includes the TU instead of the TU itself.  This breaks
> +     dw2_lookup_symbol: It assumes that if the index says symbol X lives
> +     in CU/TU Y, then one need only expand Y and a subsequent lookup in Y
> +     will find X.  Alas TUs live in their own symtab, so after expanding CU Y
> +     we need to look in TU Z to find X.  Fortunately, this is akin to
> +     DW_TAG_imported_unit, so we just use the same mechanism: For
> +     .gdb_index version <=7 this also records the TUs that the CU referred
> +     to.  Concurrently with this change gdb was modified to emit version 8
> +     indices so we only pay a price for gold generated indices.  */

what is the gold bug?

According to the description I would expect from gold a line
	[773] C: 1 [no symbol information]

but there is a line similar to what contains a gdb-produced index 7/8.
	[773] C: T0 [no symbol information]

dwz currently supports at most version 7 so I am not sure if there is any
change needed in dwz for version 8.


Thanks,
Jan


echo 'void f() {}' >tu0.C;echo 'class C {} c; int main() {}' >tu.C;for i in tu0 tu;do g++ -c -o $i.o $i.C -Wall -g -fdebug-types-section;done;g++ -o tu tu0.o tu.o -Wall;ld.gold -o tugold tu0.o tu.o --gdb-index;cp tu tu7;~/redhat/gdb-test-gdbindex7/gdb-add-index ./tu7;cp tu tu8;gdb-add-index tu8

==> tu0.C <== --- CU 0
void f() {}

==> tu.C <== --- CU 1
class C {} c; int main() {}


readelf --debug-dump=gdb_index tu{7,8}   # There is no difference in these
------------------------------------------------------------------------------
Contents of the .gdb_index section:
Version {7,8}

CU table:
[  0] 0x0 - 0x48
[  1] 0x49 - 0xb1

TU table:
[  0] 0x0 0x25 e5fcb7a195b2f213 

Address table:
00000000004005b0 00000000004005b6 0
00000000004005b8 00000000004005c3 1

Symbol table:
[489] main: 1 [global function]
[754] int: 1 [static type]
[773] C: T0 [global type]
[1010] c: 1 [global variable]
[1013] f: 0 [global function]
------------------------------------------------------------------------------

readelf --debug-dump=gdb_index tugold
------------------------------------------------------------------------------
Contents of the .gdb_index section:
Version 5

CU table:
[  0] 0x0 - 0x48
[  1] 0x49 - 0xb1

TU table:
[  0] 0x0 0x25 e5fcb7a195b2f213 

Address table:
00000000004000e8 00000000004000ee 0
00000000004000f0 00000000004000fb 1

Symbol table:
[489] main: 1 [no symbol information]
[754] int: 1 [no symbol information]
[773] C: T0 [no symbol information]
[1010] c: 1 [no symbol information]
[1013] f: 0 [no symbol information]
------------------------------------------------------------------------------


  parent reply	other threads:[~2013-06-08 16:04 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 23:21 Doug Evans
2013-01-17 17:53 ` Tom Tromey
2013-01-17 18:42   ` Doug Evans
2013-01-17 21:04   ` [RFA, doc RFA] " Doug Evans
2013-01-18  7:17     ` Eli Zaretskii
2013-01-18 14:32     ` Tom Tromey
2013-01-24 14:59 ` Regressions with dwz [Re: [RFA] Work around binutils/15021] Jan Kratochvil
     [not found]   ` <CADPb22SoND17XeXBL2N+-DXf+yKuWe4PJEXR86qT06-q_LA+7g@mail.gmail.com>
2013-01-24 17:16     ` Jan Kratochvil
2013-01-24 19:08       ` Jan Kratochvil
2013-01-30 20:41         ` Tom Tromey
2013-06-09 17:09 ` Jan Kratochvil [this message]
2013-06-12  9:49   ` [RFA] Work around binutils/15021 Doug Evans
2013-06-12 18:29     ` Jan Kratochvil
2013-06-12 19:50       ` Cary Coutant

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=20130608160421.GA10141@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=ccoutant@google.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=saugustine@google.com \
    --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