From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D78CC3858C2C for ; Mon, 3 Oct 2022 08:10:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D78CC3858C2C Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-144-d__swmLqOtiZkQI_MB4eFw-1; Mon, 03 Oct 2022 04:10:16 -0400 X-MC-Unique: d__swmLqOtiZkQI_MB4eFw-1 Received: by mail-wm1-f72.google.com with SMTP id e3-20020a05600c218300b003b4e4582006so2660946wme.6 for ; Mon, 03 Oct 2022 01:10:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=1zfaGtvUzrMrwF/Mvd/IW+7XUaMIztIkcWSkjbomcYQ=; b=yvl0t62FlrFtfJiEYv92tB8/6fmcLGj0oqopkutXj4AwS5ZDmaDKGiBjYhWj0elzcs JfVY4RYiRP4SdPW5PjX6V+Peu4LHHfLQRXvllwP3tmgR4rJQB+hmJWIfHwSuh89syO88 fQgQTLyLYW9s3sPEVDR/SQ7tB/A8w4xMWe3/R0h7Zdl1QgwL+CbV4cHdDaSslHouZ6hC xPc9A31VwUvH1QUUKTpuT5Ek431sV+8H+A7GWKvbBfPP9qlOlMGZw17CSKWXxE/IM9YI jXCdQ1nnXMPlMlxFP4XHpjoCTehsH9d6C1znamoBmZZ8QqEvy8W6RFaQf01FSBu168S/ 8JbA== X-Gm-Message-State: ACrzQf1XHtWdSETa0HdMtgpylPRqSA1UKbGtGXqGn1fuNVwVi2ZO5aIb Nls8v2lqdx/1lvKF9cVqPNF4rZOGWdMwm+haJ4mS03atkPGYTN10eG5F8bOOgI0PlbOph/lKQ7m iTiIl1w1AJwp2EJJSIBZkSw== X-Received: by 2002:a5d:654f:0:b0:22d:ac82:f870 with SMTP id z15-20020a5d654f000000b0022dac82f870mr8399402wrv.7.1664784615158; Mon, 03 Oct 2022 01:10:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4IIffA08RMhD3u6gtSpTomrLhgWsrYOP2dOinz+A56LJsFI49WQsVjIiLH9Wt5WmO1rC63YA== X-Received: by 2002:a5d:654f:0:b0:22d:ac82:f870 with SMTP id z15-20020a5d654f000000b0022dac82f870mr8399388wrv.7.1664784614904; Mon, 03 Oct 2022 01:10:14 -0700 (PDT) Received: from [10.43.2.105] (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id p3-20020a5d4e03000000b002238ea5750csm10022536wrt.72.2022.10.03.01.10.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Oct 2022 01:10:14 -0700 (PDT) Message-ID: Date: Mon, 3 Oct 2022 10:10:14 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH] Improve GDB's baseclass detection with typedefs To: Tom Tromey , Bruno Larsen via Gdb-patches References: <20220929071418.2621404-1-blarsen@redhat.com> <87bkqyxe12.fsf@tromey.com> From: Bruno Larsen In-Reply-To: <87bkqyxe12.fsf@tromey.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2022 08:10:19 -0000 On 29/09/2022 19:54, Tom Tromey wrote: >>>>>> "Bruno" == Bruno Larsen via Gdb-patches writes: > Bruno> When a class inherits from a typedef'd baseclass, GDB may be unable to > Bruno> find the baseclass if the user is not using the typedef'd name, as is > Bruno> tested on gdb.cp/virtbase2.exp; the reason that test case is working > Bruno> under gcc is that the dwarf generated by gcc links the class to the > Bruno> original definition of the baseclass, not to the typedef. If the > Bruno> inheritance is linked to the typedef, such as how clang does it, > Bruno> gdb.cp/virtbase2.exp starts failing. > > Bruno> This can also be seen in gdb.cp/impl-this.exp, when attempting to print > Bruno> D::Bint::i, and GDB not being able to find the baseclass Bint. > > Bruno> This happens because searching for baseclasses only uses the macro > Bruno> TYPE_BASECLASS_NAME, which returns the typedef'd name. However, we can't > Bruno> switch that macro to checking for typedefs, otherwise we wouldn't be > Bruno> able to find the typedef'd name anymore. This is fixed by searching for > Bruno> members or baseclasses by name, we check both the saved name and the > Bruno> name after checking for typedefs. > > Bruno> This also fixes said long-standing bug in gdb.cp/impl-this.exp when the > Bruno> compiler adds information about typedefs in the debuginfo. > > Thank you for the patch. This is ok. Thanks, pushed! Cheers, Bruno > > Tom >