From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway21.websitewelcome.com (gateway21.websitewelcome.com [192.185.45.176]) by sourceware.org (Postfix) with ESMTPS id AB8733858439 for ; Thu, 4 Nov 2021 18:44:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AB8733858439 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tromey.com Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway21.websitewelcome.com (Postfix) with ESMTP id 4BD23400CE6B9 for ; Thu, 4 Nov 2021 13:44:59 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id ihjPm5baVIWzGihjPmC3aO; Thu, 04 Nov 2021 13:44:59 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=U207ciinImUngRkGvY5P94qeJ1y+sh/+N68bgn8k6D8=; b=bSK/+US7s2VnKiHW3q2aCzJ7Qv AYKfSrdhQKfLL/eCGkTfBv8UX49RGVfoG4k+gGt8KOHeh/j82ZJiYHZvpzj1ykgvZGpkl8isxymSQ KGu59XQRNwG3pyr+QAy03MvCu; Received: from 75-166-134-234.hlrn.qwest.net ([75.166.134.234]:54140 helo=murgatroyd) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mihjP-003mEX-1d; Thu, 04 Nov 2021 12:44:59 -0600 From: Tom Tromey To: Bruno Larsen via Gdb-patches Subject: Re: [RFC PATCH] [gdb] Fix std::unique_ptr printing regression (PR 28480) References: <20211104151317.19615-1-blarsen@redhat.com> X-Attribution: Tom Date: Thu, 04 Nov 2021 12:44:58 -0600 In-Reply-To: <20211104151317.19615-1-blarsen@redhat.com> (Bruno Larsen via Gdb-patches's message of "Thu, 4 Nov 2021 12:13:17 -0300") Message-ID: <874k8rkbf9.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 75.166.134.234 X-Source-L: No X-Exim-ID: 1mihjP-003mEX-1d X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 75-166-134-234.hlrn.qwest.net (murgatroyd) [75.166.134.234]:54140 X-Source-Auth: tom+tromey.com X-Email-Count: 48 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3026.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 04 Nov 2021 18:45:02 -0000 >>>>> "Bruno" == Bruno Larsen via Gdb-patches writes: Thank you for the patch. Bruno> Or with a valid memory address. This happened because the searching Bruno> algorithm, when looking for internal members of __uniq_ptr, would stop Bruno> at the first _M_head_impl, which is of type class Deleter, instead of Bruno> returning the second finding, which is the managed pointer. I don't really understand this explanation. However, see my comments below about the test case. Bruno> The second is that I'm having trouble with the testing. running with Bruno> -data-directory gdb/data-directory gives me a very verbose printing that Bruno> is always correct, but also counter-productive for debugging. How can I Bruno> make the testsuite have the minimal printing? Bruno> + std::unique_ptr uptr(nullptr); Using a standard library type in the test suite is usually not what you want, because it means that the gdb feature being tested then depends on the precise implementation of this type. Instead, because you're changing gdb to handle some C++ scenario, I think it would be better to write out exactly what is being tested -- basically, the relevant parts of unique_ptr. I think it's fine to add these to the existing test. However, it sounds like you also are trying to test the pretty-printer here? This part wasn't clear to me, but IIRC std::unique_ptr has a pretty-printer in libstdc++. In this case, you'd also need to write a pretty-printer, in which case you'd probably just want a whole new test in gdb.python. Integration testing for the unique_ptr pretty-printer would also be good, but those tests ought to be in libstdc++. I don't have a comment on the particular change here. I suspect it ought to be done some other way, but I don't really understand it. I think a more self-contained test would help with this as well. thanks, Tom