From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 441D93858C52 for ; Wed, 18 Jan 2023 22:01:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 441D93858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-x232.google.com with SMTP id s124so207799oif.1 for ; Wed, 18 Jan 2023 14:01:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=xk4y0EN+JlojZsaoAvcS5w9k9HoFmUq09lteOD2amrk=; b=JkFykALsxuEE4wG8bMYn9MfknFO9JExfYMVpFnQElP/4HhQRiMVLtRmr/v7Y336TBH 9D06p9CIMoBB+t18oWOFytVJxu95mEHTdMnGXIJtg0qdR/E1kO+OZf5WScKPIMmrz6pe tMfLlGB0EAlbl8C6INCfPlxyDekm7vVs4XN7Y6s59u+n44ZklXYED65orgsdjuJRXBpp 7hwidAEoEYKCj21majc9IL3ZT+tBH+Q8HWMO2awgKO0kKGeTIy9HdyGzjnDUGbKQd2rL JBXn1nRRG9+rPE/BghROSG8OUQnYHeqeIROLcU5GuSv6iOyjHf1ilcI0ukHS2Pk4eJpf Gj+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xk4y0EN+JlojZsaoAvcS5w9k9HoFmUq09lteOD2amrk=; b=zN2wmpf4kP/l5BjdKzaCW3cG7fbLXhWZpaPuapzgSLfvB88NYDa1CBRh6lboEZAlnp 4szLZXL9o0bMM2M2A984bhn1fhFfh7HfSFdFeNk5kaG1r9NdeCtOQVySCmdWbgqIjTXl lCebyKpJgyCJBne/bLSF3COr2J5QnGFYA1+pqICnk4JTDOw8+zC5eAXRJXN5mu2pgTOi 9QOanH3j4A5CKmIbSlo1fdrCW6oMdKaXIcUlR1JLRPKanluJQTT08Zv19mzqaSgbnSvM I311GGYNjBcBtOy2VpXjqgKb3NQJqLJdnRyvBZ3UAo0EFFx41/7d6sJedfn2qcmL+A6R MdYg== X-Gm-Message-State: AFqh2kqbE44tZ0Cxd8G0uO/+nquc8Z9VLWkukiTL/xsSwaeTzXq7AM1y n8n1xpLc7l9pUBeyi8UNSoWf7817mUnSzTGpbgh8eJJDIdE= X-Google-Smtp-Source: AMrXdXvI/n+/oO7T9hyxSuz2W3EExb4mBEZamKZKRqVzWVwFBAufCnEcIRISH2KtEo212dvFY7FWYexEqcRADgWpgFE= X-Received: by 2002:a05:6808:1513:b0:363:b8c3:a76b with SMTP id u19-20020a056808151300b00363b8c3a76bmr460300oiw.118.1674079307303; Wed, 18 Jan 2023 14:01:47 -0800 (PST) MIME-Version: 1.0 References: <525f9315-27f1-935a-4e5e-4a043b24eecf@simark.ca> In-Reply-To: <525f9315-27f1-935a-4e5e-4a043b24eecf@simark.ca> From: David Blaikie Date: Wed, 18 Jan 2023 14:01:35 -0800 Message-ID: Subject: Re: Decl/def matching with templates without template parameters in the DW_AT_name To: Simon Marchi Cc: gdb Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Jan 11, 2023 at 5:46 PM Simon Marchi wrote: > Digging in the history leads me to: > > https://inbox.sourceware.org/gdb-patches/201007302017.41074.pedro@codesourcery.com/ > > So RVCT, the RealView compiler. I don't have access to that, > unfortunately. It seems obsolete, also. Oh, that's satisfying/interesting to know - figured /someone/ had done this before, judging by gdb's behavior. > If you end up merging this, it will be interesting to run the full GDB > testsuite against clang with that flag, it would cover a lot of things. Oh, it's already in Clang, under `-gsimple-template-names`, I think even Clang 15's functionality is well baked enough - I finished up the work about a year ago now. Here's a very small example: https://godbolt.org/z/r8zMf5qvr showing the shortened name in the .debug_info, and in the .debug_gdb_pubnames (which ends up in the index, which turns out was the bug I came across... filed here: https://sourceware.org/bugzilla/show_bug.cgi?id=30023 ) As I mentioned, though, there's a bunch of cases where Clang doesn't simplify names because they don't roundtrip well/DWARF is lossy/problematic in some way in the way it describes the template parameters. Some of the interesting (positive and negative/simplified and unsimplified) test cases I encountered were: https://github.com/llvm/llvm-project/blob/main/cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp - this checks that I could easily rebuild the original name from llvm-dwarfdump. So, things like templates with lambda parameters aren't simplified because there isn't necessarily enough info to rebuild the name as clang generates them (also GCC generates those names differently - and those are probably harder to roundtrip, but more likely to be canonical/unique/unambiguous), operator overloads were not simplified because it was hard to tell if they were/weren't simplified with all the <> involved in some operator names even without template parameters - etc...