From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7961 invoked by alias); 11 Jun 2013 23:39:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 7950 invoked by uid 89); 11 Jun 2013 23:39:46 -0000 X-Spam-SWARE-Status: No, score=-4.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD,SPF_PASS,TW_DW autolearn=ham version=3.3.1 Received: from mail-ve0-f176.google.com (HELO mail-ve0-f176.google.com) (209.85.128.176) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 11 Jun 2013 23:39:45 +0000 Received: by mail-ve0-f176.google.com with SMTP id c13so6192603vea.21 for ; Tue, 11 Jun 2013 16:39:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding:x-gm-message-state; bh=XY3P/rpWJqW4EQqHTsQTB/QDvPr7MCE03IaUTSaTHgE=; b=RV1ieXWDXJq/jjQ0PmM0V3OgWj1oVUlEF7VJjHTFPNzmMR7qWTbFFIzY+HSEMuFe06 Kcy61aq3zeCZM/dUayTUs+Lk5KW18Ul2j6ga7Q5217LvsOu+Ymm50/ZZkx5ycnU5okWR Unvq7QNJ/8wPIOh6GkmUJFW/i0fqsEDe+cgRCXgRqWPM6ONHs6sM2Z1N5aqCZPWW/s8g hrVKxZYiWXM3rw6QmL/EfZwXTzBFXx3yARQr7V6q+1A1ROrpshT8w7HvA0LPQP1JiwlU VZl/TnOevpNyKgrRW9sKY0h3MXd52GyTvALzBp6eQmtVBeFPCf63E6MfdG1fPnBuSRMp FAgA== MIME-Version: 1.0 X-Received: by 10.220.71.200 with SMTP id i8mr8744028vcj.44.1370993983652; Tue, 11 Jun 2013 16:39:43 -0700 (PDT) Received: by 10.220.189.74 with HTTP; Tue, 11 Jun 2013 16:39:43 -0700 (PDT) In-Reply-To: <20130608160421.GA10141@host2.jankratochvil.net> References: <20130608160421.GA10141@host2.jankratochvil.net> Date: Wed, 12 Jun 2013 09:49:00 -0000 Message-ID: Subject: Re: [RFA] Work around binutils/15021 From: Doug Evans To: Jan Kratochvil Cc: gdb-patches , Tom Tromey , Cary Coutant , Sterling Augustine , Jakub Jelinek Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQl3vwmbvPL5kDYXsyh4t340p04wgISaOtjRIvD2EsMvdFVVzicMyzNDEllJBV5nuFw87uWF7NDzMjkNHcz6pktbwCWxn3kmi47BsgXQH7STazY7gKUhkdnaNzUVmB0RLFN07tJKUOKJpVC7A3L9Qc2RNly8R4My/Y/ueu4et3XJ3HDIsVqZXglPqYqn8gQwiG5wrcLJiT2ww+fqJGgpi70uAsYNUw== X-SW-Source: 2013-06/txt/msg00267.txt.bz2 On Sat, Jun 8, 2013 at 9:04 AM, Jan Kratochvil wrote: > 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 <=3D7 and the way gdb does. Arguably= this >> + is a gold bug. For symbols coming from TUs, gold records in the i= ndex >> + 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 expandin= g 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 <=3D7 this also records the TUs that the CU ref= erred >> + to. Concurrently with this change gdb was modified to emit versio= n 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] Hi. The gold "bug" is that, when using pubnames(/pubtypes) to generate the index, gold doesn't have sufficient info to generate as "accurate" a .gdb_index ("accurate" as in: the CU will have a DW_AT_GNU_pubtypes attribute when it would be better if the TU had that attribute). If those sections are missing then gold falls back to reading all the debug info and using that to generate the index, and when it does that it can generate a better index, and I'm guessing that's what you're seeing. > dwz currently supports at most version 7 so I am not sure if there is any > change needed in dwz for version 8. There is no change in the file format or semantics between 7 and 8, so no change should be needed for dwz. [I didn't know dwz dealt with .gdb_index - something for my TIL file. :-)] > > > 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;~/r= edhat/gdb-test-gdbindex7/gdb-add-index ./tu7;cp tu tu8;gdb-add-index tu8 > > =3D=3D> tu0.C <=3D=3D --- CU 0 > void f() {} > > =3D=3D> tu.C <=3D=3D --- CU 1 > class C {} c; int main() {} > > > readelf --debug-dump=3Dgdb_index tu{7,8} # There is no difference in th= ese > -------------------------------------------------------------------------= ----- > 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=3Dgdb_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] > -------------------------------------------------------------------------= -----