From patchwork Tue Aug 4 14:51:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andres Rodriguez X-Patchwork-Id: 1340894 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gcc.gnu.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=oHxAUUAb; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BLd4N0jccz9sSt for ; Wed, 5 Aug 2020 00:51:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5108A3870854; Tue, 4 Aug 2020 14:51:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5108A3870854 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1596552689; bh=ihpLtNtsOw8OgL1/pdOtj/A5Rfy/cTeCiMAvWXH1FAI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=oHxAUUAbfjlU6qRmmAtrRt9jKhPoNf8oWSOx4XGXhooLgTdD/6XsEwri5cdDUcdHU BHiC9BOrDiBTgZejhDboNRV+xIziwLrpPZkN6yOtBCo8lUHo5R5Z/ev0+uNpuRpxD0 9LA863zwnRPfyi90rqgwBz1u8lAtgSuWpOKhu8ak= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by sourceware.org (Postfix) with ESMTPS id 8D8A5385702C for ; Tue, 4 Aug 2020 14:51:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8D8A5385702C Received: by mail-qt1-x82f.google.com with SMTP id x12so22560794qtp.1 for ; Tue, 04 Aug 2020 07:51:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ihpLtNtsOw8OgL1/pdOtj/A5Rfy/cTeCiMAvWXH1FAI=; b=TUZqLm7+8dCMHlbu1Hu7VE7MlmeSRzGLosCdC9Fa1hGL21uqN2k0U+VWyajJlVEgNt szkKR1zX0ucCpgfye5Msnqo4NElz8B4U+NykDT3bvEyfTuHcfw7bG8eZzFa7NrzgAvGH SBorleTtSS3Gk+C1k4eqcyaeizxzmMJsxqRiO2kvAAV6qSFI48simaDWuXZ2I2Tvy1EM 92M9XtCxNkHi1zUDTwRrlWq8swMDnUfxBDMT9RwGFR2MRh+VwG1z7RzuZ55XFdXgAT37 abTrygNBvHvv8xEoiMUj3wJ9y73KMcspmdex9T3Qk1z+CFlMm9BJKDif8aplNZKMOj7Z G+LA== X-Gm-Message-State: AOAM530bFk54gW/fEdPmgcVpPaRfmVdEXxJGOjyhwCvmLg//SQ9rQ5b5 KlHjdSUPvi7Sbd8tuEC1lfDFerEPTPc= X-Google-Smtp-Source: ABdhPJycqbz5pH/Wz2XToFwQiWC62t1nFn7Gc/CbMCbO3Mr+Can6k3GNhQXHbiw4z0chxvom55PWtw== X-Received: by 2002:ac8:6052:: with SMTP id k18mr21676109qtm.60.1596552685839; Tue, 04 Aug 2020 07:51:25 -0700 (PDT) Received: from andres-dev.valve.org (135-23-182-85.cpe.pppoe.ca. [135.23.182.85]) by smtp.gmail.com with ESMTPSA id t8sm26811450qtc.50.2020.08.04.07.51.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2020 07:51:25 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [RFC] libstdc++: Fix pretty-printing old implementations of std::unique_ptr Date: Tue, 4 Aug 2020 10:51:23 -0400 Message-Id: <20200804145123.8023-1-andresx7@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-10.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Andres Rodriguez via Gcc-patches From: Andres Rodriguez Reply-To: Andres Rodriguez Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" On binaries compiled against gcc5 the impl_type parameter is None, which results in an exception being raised by is_specialization_of() These versions of std::unique_ptr have the tuple as a root element. --- Hi, I ran into this issue when debugging a binary built using gcc5. I'm not very familiar with python or the gcc codebase, so this might be the wrong way to address this problem. But a patch seemed like a good way to start the conversation. Thanks for taking a look. -Andres P.S.: This is a resend of the patch. I joined the mailing list after sending this patch so I'm guessing the original email got stuck in a moderation queue. libstdc++-v3/python/libstdcxx/v6/printers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index e4da8dfe5b6..3154a2a6f9d 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -247,7 +247,9 @@ class UniquePointerPrinter: self.val = val impl_type = val.type.fields()[0].type.tag # Check for new implementations first: - if is_specialization_of(impl_type, '__uniq_ptr_data') \ + if impl_type is None: + tuple_member = val['_M_t'] + elif is_specialization_of(impl_type, '__uniq_ptr_data') \ or is_specialization_of(impl_type, '__uniq_ptr_impl'): tuple_member = val['_M_t']['_M_t'] elif is_specialization_of(impl_type, 'tuple'):