From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) by sourceware.org (Postfix) with ESMTPS id 64D2B3857C69 for ; Tue, 1 Sep 2020 03:07:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 64D2B3857C69 Received: by mail-io1-xd2a.google.com with SMTP id d190so7344964iof.3 for ; Mon, 31 Aug 2020 20:07:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fCAwIDYxjgl3NEnd5ZSB3hJio5P3uW/yWSeqh2LVZt4=; b=i66Z0HfRlxTEu5PEE4f9FENACPFXY5Kgez6iA3JJ+bwH8qxid05hrHCH8i396DUGPJ ffGwZDIE/rULRItcPO1UipKJk1uSt/PZpJCwopkphkIxdZYFRGRN+Ei+J6EWqo2Uz0Yo ZPJd1qvEJ1g5fOufUdSB5SirkD0LUyFXj9zbZBNJ2oGeqoZr034ZXmSxKYT3Q6gZhbnA GtftoC2SInT6NX/IWwQDDxx/+47GLkGlXkFrUmmPiu2MaV6UNDu2HD0/PknSzayLtZTD azWNZwUjZMP1Xg6vUc7ZA2zHr262Ya3WyUzq9XeTb2n1t+9ecRbQjRClXPbG7/CRQhJN Y97g== X-Gm-Message-State: AOAM533d6J/Wv8VEndcLcg5Xyx2tlbV0cF1fSHR514nE+t6zBgCK8XLK 8wsIX2B1hvneRO9YEe4qoORnVBZtNdeVWQjRbKE= X-Google-Smtp-Source: ABdhPJzww16GZLJpVQx5Gc1AJYWcD4HINJ2kFcCD1gW2EDT7cJ2C5Fl+w6OjCnZp8YRosUlc59zXBt+roFB8EXDO2CY= X-Received: by 2002:a05:6638:12d4:: with SMTP id v20mr3942954jas.108.1598929650709; Mon, 31 Aug 2020 20:07:30 -0700 (PDT) MIME-Version: 1.0 References: <20200831082826.GA2164630@host1.jankratochvil.net> In-Reply-To: <20200831082826.GA2164630@host1.jankratochvil.net> From: David Blaikie Date: Mon, 31 Aug 2020 20:07:19 -0700 Message-ID: Subject: Re: DWARF5 and .gdb_index/.debug_names To: Jan Kratochvil Cc: Mark Wielaard , gdb@sourceware.org, Eric Christopher X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, 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 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Tue, 01 Sep 2020 03:07:32 -0000 On Mon, Aug 31, 2020 at 1:29 AM Jan Kratochvil via Gdb wrote: > 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. DWARFv5, Page 137 lists the things that must be in the debug_names table, including: "If a subprogram or inlined subroutine is included, and has a DW_AT_linkage_name attribute, there will be an additional index entry for the linkage name." It's really important that all the producers ensure the names present are the same/at least what is in the spec, otherwise we can easily erode trust in the name table and consumers may end up having to ignore it to ensure correctness. > 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 >