From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id CB0A73948AB3 for ; Mon, 31 Aug 2020 08:28:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CB0A73948AB3 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-iMImrADfONin9al7OiOX_A-1; Mon, 31 Aug 2020 04:28:30 -0400 X-MC-Unique: iMImrADfONin9al7OiOX_A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 98D96640C6; Mon, 31 Aug 2020 08:28:29 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-112-29.ams2.redhat.com [10.36.112.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD02E87A70; Mon, 31 Aug 2020 08:28:28 +0000 (UTC) Date: Mon, 31 Aug 2020 10:28:26 +0200 From: Jan Kratochvil To: Mark Wielaard Cc: gdb@sourceware.org Subject: Re: DWARF5 and .gdb_index/.debug_names Message-ID: <20200831082826.GA2164630@host1.jankratochvil.net> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="H+4ONPRPur6+Ovig" Content-Disposition: inline X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2020 08:28:37 -0000 --H+4ONPRPur6+Ovig Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sun, 30 Aug 2020 19:18:51 +0200, Mark Wielaard wrote: > During the BoF Pedro mentioned that the GDB DWARF5 .debug_names support > is incomplete/wrong. I was wondering whether there was a good > description of the issue and/or a bug report for it. When using the > contrib/gdb-add-index.sh it does add a .gdb_index for objects > containing DWARF5 and the results seem correct, gdb also seems to be > able to use it. When adding -dwarf-5 it seems to output a .debug_names > section which can be read by binutils readelf (elfutils doesn't yet > support .debug_names). I couldn't immediately see in what way it was > wrong/incomplete. .debug_names from GDB needs to produce also DW_IDX_die_offset to make it consumable by debuggers with reasonable performance. Then I see clang++ -gdwarf-5 -gpubnames produces C++ names mangled while GDB produces them unmangled. I haven't found anything in DWARF-5 standard suggesting either. Given mangled->unmangled mapping is possible but unmangled->mangled is not (such as variants of ctors/dtors) I find the clang way should be followed. Jan --H+4ONPRPur6+Ovig Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="ns3.debug_names" ns3: file format ELF64-x86-64 .debug_names contents: Name Index @ 0x0 { Header { Length: 0xC4 Version: 5 Padding: 0x0 CU count: 1 Local TU count: 0 Foreign TU count: 0 Bucket count: 5 Name count: 5 Abbreviations table size: 0x19 Augmentation: 'LLVM0700' } Compilation Unit offsets [ CU[0]: 0x00000000 ] Abbreviations [ Abbreviation 0x34 { Tag: DW_TAG_variable DW_IDX_die_offset: DW_FORM_ref4 } Abbreviation 0x2 { Tag: DW_TAG_class_type DW_IDX_die_offset: DW_FORM_ref4 } Abbreviation 0x2e { Tag: DW_TAG_subprogram DW_IDX_die_offset: DW_FORM_ref4 } Abbreviation 0x24 { Tag: DW_TAG_base_type DW_IDX_die_offset: DW_FORM_ref4 } ] Bucket 0 [ EMPTY ] Bucket 1 [ Name 1 { Hash: 0x7C9A7F6A String: 0x00000052 "main" Entry @ 0x99 { Abbrev: 0x2E Tag: DW_TAG_subprogram DW_IDX_die_offset: 0x00000041 } } ] Bucket 2 [ Name 2 { Hash: 0x2B608 String: 0x00000030 "C" Entry @ 0xa2 { Abbrev: 0x2 Tag: DW_TAG_class_type DW_IDX_die_offset: 0x0000002c } } ] Bucket 3 [ Name 3 { Hash: 0x2B60E String: 0x00000043 "i" Entry @ 0xab { Abbrev: 0x34 Tag: DW_TAG_variable DW_IDX_die_offset: 0x00000023 } } Name 4 { Hash: 0xB888030 String: 0x00000045 "int" Entry @ 0xb4 { Abbrev: 0x24 Tag: DW_TAG_base_type DW_IDX_die_offset: 0x0000003d } } Name 5 { Hash: 0xDBA78B3F String: 0x00000049 "_ZN1C1iE" Entry @ 0xbd { Abbrev: 0x34 Tag: DW_TAG_variable DW_IDX_die_offset: 0x00000023 } } ] Bucket 4 [ EMPTY ] } --H+4ONPRPur6+Ovig Content-Type: application/octet-stream Content-Disposition: inline; filename="ns3g.debug_names" Content-Transfer-Encoding: quoted-printable ns3g:=09file format ELF64-x86-64=0A=0A.debug_names contents:=0AName Index @= 0x0 {=0A Header {=0A Length: 0xA9=0A Version: 5=0A Padding: 0x0= =0A CU count: 1=0A Local TU count: 0=0A Foreign TU count: 0=0A = Bucket count: 8=0A Name count: 4=0A Abbreviations table size: 0x25=0A= Augmentation: 'GDB=00'=0A }=0A Compilation Unit offsets [=0A CU[0]= : 0x00000000=0A ]=0A Abbreviations [=0A Abbreviation 0x2 {=0A Tag= : DW_TAG_typedef=0A DW_IDX_compile_unit: DW_FORM_udata=0A DW_IDX_= unknown_2000: DW_FORM_flag_present=0A }=0A Abbreviation 0x4 {=0A = Tag: DW_TAG_variable=0A DW_IDX_compile_unit: DW_FORM_udata=0A DW= _IDX_unknown_2001: DW_FORM_flag_present=0A }=0A Abbreviation 0x1 {=0A= Tag: DW_TAG_structure_type=0A DW_IDX_compile_unit: DW_FORM_udata= =0A DW_IDX_unknown_2001: DW_FORM_flag_present=0A }=0A Abbreviati= on 0x3 {=0A Tag: DW_TAG_subprogram=0A DW_IDX_compile_unit: DW_FOR= M_udata=0A DW_IDX_unknown_2001: DW_FORM_flag_present=0A }=0A ]=0A = Bucket 0 [=0A Name 1 {=0A Hash: 0x2B608=0A String: 0x0000007d= "C"=0A Entry @ 0xa1 {=0A Abbrev: 0x1=0A Tag: DW_TAG_str= ucture_type=0A DW_IDX_compile_unit: 0=0A DW_IDX_unknown_2001:= true=0A }=0A }=0A Name 2 {=0A Hash: 0xB888030=0A Stri= ng: 0x0000007f "int"=0A Entry @ 0xa4 {=0A Abbrev: 0x2=0A = Tag: DW_TAG_typedef=0A DW_IDX_compile_unit: 0=0A DW_IDX_unkn= own_2000: true=0A }=0A }=0A ]=0A Bucket 1 [=0A EMPTY=0A ]=0A = Bucket 2 [=0A Name 3 {=0A Hash: 0x7C9A7F6A=0A String: 0x00000= 06f "main"=0A Entry @ 0xa7 {=0A Abbrev: 0x3=0A Tag: DW_T= AG_subprogram=0A DW_IDX_compile_unit: 0=0A DW_IDX_unknown_200= 1: true=0A }=0A }=0A ]=0A Bucket 3 [=0A EMPTY=0A ]=0A Bucket= 4 [=0A EMPTY=0A ]=0A Bucket 5 [=0A Name 4 {=0A Hash: 0x7C9457= A5=0A String: 0x00000083 "C::i"=0A Entry @ 0xaa {=0A Abbre= v: 0x4=0A Tag: DW_TAG_variable=0A DW_IDX_compile_unit: 0=0A = DW_IDX_unknown_2001: true=0A }=0A }=0A ]=0A Bucket 6 [=0A = EMPTY=0A ]=0A Bucket 7 [=0A EMPTY=0A ]=0A}=0A --H+4ONPRPur6+Ovig Content-Type: text/plain; charset=us-ascii Content-Disposition: inline; filename="ns3.C" class C { public: static inline int i=42; }; int main() { return C::i; } --H+4ONPRPur6+Ovig--