From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 38377 invoked by alias); 7 Feb 2018 07:21:35 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 38312 invoked by uid 89); 7 Feb 2018 07:21:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=BAYES_00,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=H*i:sk:d880fd5, H*f:sk:d880fd5, H*c:alternative, talk X-HELO: mail-pf0-f179.google.com Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 07 Feb 2018 07:21:32 +0000 Received: by mail-pf0-f179.google.com with SMTP id l9so1782786pfi.6 for ; Tue, 06 Feb 2018 23:21:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=D+kuHO2xkZjSsJkd04AlE+/XV6hmp33yRAi4jb1Es1k=; b=a09ryNk1LgPHNIipEU5pNXJG38tMlHT4xeBktT7xQVQj7VtCgSf/ZDiXQivH6y7utc IwUjgs+J9JF5ieaZzRT+xsDGAz5sLFsrZGdITndbAFKNQSPY9DQjbdkLQKtN7c+5WH6O HPVawz2ywL9YAm7XsRiDRYG/rkjHwXDM3UP6IVhxE+S9eDq378s5vpGMpyGLjA2en5uk eL2H+0bt7B7w8GZevmmEccSiBJOW41VUGeUlSjGoEd2qEm77BFJX8VJ4yS4Hga6yMyN6 H2wrwhFX8QyI4Txi0kxzrmat+EPfb/eBqSWdYuhyEjeDMTDfnUfHd+mr47zV7/UUI1uJ /+sg== X-Gm-Message-State: APf1xPA/7jOcuozzWbwsevr8C7XqfTzpaftVmJsMGvGcgoCXvYN6nuhM HNJA4jfU6P5RmA8YLO71OglqiVd5tE32HJoaI4JN2A== X-Google-Smtp-Source: AH8x2263j0elDlFQ3btxEDjAbHgRJkiF6AXmI9k8gD1hA+PPqWgoD3P5O5P5roo3EMFAW5SpADU805HdgUheSkCpX2w= X-Received: by 10.99.190.76 with SMTP id g12mr4182501pgo.235.1517988090730; Tue, 06 Feb 2018 23:21:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.100.148.198 with HTTP; Tue, 6 Feb 2018 23:21:30 -0800 (PST) In-Reply-To: References: <1517667601.3405.123.camel@gnu.org> <1b58e2df-5425-4f22-510c-d2e9f51040ba@polymtl.ca> <39845077-6bdf-f60d-9bfc-a491e7fa4fc7@gmail.com> <132fbd97-4f0d-020f-1c0f-1d4097800233@polymtl.ca> <6da16f7c-4801-4c57-2197-271db491a88f@gmail.com> From: Daniel Berlin Date: Wed, 07 Feb 2018 07:21:00 -0000 Message-ID: Subject: Re: gdb 8.x - g++ 7.x compatibility To: Martin Sebor Cc: Simon Marchi , Manfred , gdb@sourceware.org, GCC Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2018-02/txt/msg00059.txt.bz2 As the person who, eons ago, wrote a bunch of the the GDB code for this C++ ABI support, and as someone who helped with DWARF support in both GDB and GCC, let me try to propose a useful path forward (in the hopes that someone will say "that's horrible, do it this instead") Here are the constraints i believe we are working with. 1. GDB should work with multiple DWARF producers and multiple C++ compilers implementing the C++ ABI 2. There is no canonical demangled format for the C++ ABI 3. There is no canoncial target demangler you can say everyone should use (and even if there was, you don't want to avoid debugging working because someone chose not to) 4. You don't want to slow down GDB if you can avoid it 5. Despite them all implementation the same ABI, it's still possible to distinguish the producers by the producer/compiler in the dwarf info. Given all that: GDB has ABI hooks that tell it what to do for various C++ ABIs. This is how it knows to call the right demangler for gcc v3's abi vs gcc v2's abi. and handle various differences between them. See gdb/cp-abi.h The IMHO, obvious thing to do here is: Handle the resulting demangler differences with 1 or more new C++ ABI hooks. Or, introduce C++ debuginfo producer hooks that the C++ ABI hooks use if folks want it to be separate. Once the producer is detected, fill in the hooks with a set of functions that does the right thing. I imagine this would also clean up a bundle of hacks in various parts of gdb trying to handle these differences anyway (which is where a lot of the multiple symbol lookups/etc that are often slow come from. If we just detected and said "this is gcc 6, it behaves like this", we wouldn't need to do that) In case you are worried, you will discover this is how a bunch of stuff is done and already contains a ball of hacks. Using hooks would be, IMHO, a significant improvement. On Mon, Feb 5, 2018 at 7:52 PM, Martin Sebor wrote: > On 02/05/2018 09:59 AM, Simon Marchi wrote: > >> On 2018-02-05 11:45, Martin Sebor wrote: >> >>> Yes, with auto, the type of the constant does determine the type >>> of the specialization of the template in the source code. >>> >>> In non-type template arguments, and more to the point I was making, >>> in diagnostics, the suffix shouldn't or doesn't need to be what >>> distinguishes the type of the template, even with auto. The part >>> "with auto IVAL = 10" in the message >>> >>> 'void foo::print() [with auto IVAL = 10]': >>> >>> would be far clearer if auto were replaced by the deduced type, >>> say along these lines: >>> >>> 'void foo::print() [with int IVAL = 10]': >>> >>> rather than relying on the suffix alone to distinguish between >>> different specializations of the template. That seems far too >>> subtle to me. But I think the diagnostic format is (or should >>> be) independent of the debug info. >>> >> >> That makes sense. >> >> With respect to the suffix, I keep coming back to the reality >>> that even if GCC were to change to emit a format that GDB can >>> interpret easily and efficiently, there still are other >>> compilers that emit a different format. So the conclusion >>> that a general solution that handles more than just one format >>> (at least for non-type template arguments without auto) seems >>> unescapable. >>> >> >> If there are other compilers we wanted to support for which we can't >> trust the template format, we could always ignore the template part of >> DW_AT_name specifically for them. But since g++ and gdb are part of the >> same project and are expected to work well and efficiently together, I >> would have hoped that we could agree on a format so that gdb would not >> have to do the extra work when parsing a g++-generated file >> (consequently the same format that libiberty's demangler produces). >> >> Given the problem I illustrated in my previous mail, I don't have a >> general solution to the problem to propose. >> > > Okay, let me talk to Jason to see what he thinks. I'm open > to restoring the suffix for the debug info as long as it doesn't > adversely affect the diagnostics. I agree that if GCC can help > make GDB more efficient it's worth putting effort into. (I do > still think that GDB should work with other providers besides > GCC, even if perhaps not necessarily as efficiently.) > > Martin >