From patchwork Tue Jul 28 19:05:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andres Rodriguez X-Patchwork-Id: 1337965 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=2620:52:3:1:0:246e:9693:128c; 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=rqZNdSgd; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 4BGR2W74JXz9sRN for ; Wed, 29 Jul 2020 05:05:22 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2AB44383F841; Tue, 28 Jul 2020 19:05:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AB44383F841 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1595963119; bh=8gsuEfIfKj8zPD0jRzVBq4ySUVS9eim38dxN9wrcOko=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=rqZNdSgddFfMBTYOcCGdSdypG/X5ZVe8W1F3Hc0JSV6HBVVKOHGL96A5uMXo4nLox 8tNZ9b8wzzzMBjoLifNF8J6HEGi9e2wiRt1bn6DZQHkjxE+KILwjAqS7eLRoDEicu5 U3ccZ8vU2CiaVSmqQW01qIfN22vjXyHpg1LnSwB4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) by sourceware.org (Postfix) with ESMTPS id 9ACF4386F47D for ; Tue, 28 Jul 2020 19:05:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9ACF4386F47D Received: by mail-qv1-xf2c.google.com with SMTP id dd12so4617173qvb.0 for ; Tue, 28 Jul 2020 12:05:16 -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=8gsuEfIfKj8zPD0jRzVBq4ySUVS9eim38dxN9wrcOko=; b=NaqIY4knhIv1auVT72HRhQtJQnKYvcC83MsdmJPTsaholrCHOONPIwz0Vis4irtqfg EXdjLnUZlZ5I7TBzsLaXey5vwfb6T4UetKe5U5K9faQBPbL0rx5TTpLThiyCYwU1QOus qs8CM+on99qMS2J3wQduTHaaJiU7lwF97RkVydnPZDqldNlzjE5W9WrMzoNzP11K4LdK mftOU4razOwWEzk6LFeMagLRmogwDKa2d+ZwXnL5HGk4RHIBzPfwqmfJl/3MG9BDT1Q5 QTct0/otgHyDuGFugpmOuTIc6pUj8qkgDUelYyHLwyQEDp5xCpqBvaYzaZUvN3bhhMg2 wegw== X-Gm-Message-State: AOAM531d1khAmxPOZ5frOlyTOQQXGn2TFX5BqekQdmyX+jNvoVbusfSy BGEgnGw34n9aTl5xj2mhmnqe94csM5U= X-Google-Smtp-Source: ABdhPJzhQcQmj1OZ/SKU3fptjfuZ8u9QILBKagEmwTO368utdR1XhjqlCNBb8zmZhFyOauVvzhSzyg== X-Received: by 2002:a0c:9b94:: with SMTP id o20mr29699167qve.177.1595963115890; Tue, 28 Jul 2020 12:05:15 -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 c22sm24444866qke.2.2020.07.28.12.05.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 12:05:15 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [RFC] libstdc++: Fix pretty-printing old implementations of std::unique_ptr Date: Tue, 28 Jul 2020 15:05:12 -0400 Message-Id: <20200728190512.92283-1-andresx7@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-9.5 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 Cc: andresx7@gmail.com 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 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'):