From patchwork Fri Oct 8 11:31:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 67181 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 6ACC2B70A7 for ; Fri, 8 Oct 2010 22:32:12 +1100 (EST) Received: (qmail 3183 invoked by alias); 8 Oct 2010 11:32:07 -0000 Received: (qmail 3164 invoked by uid 22791); 8 Oct 2010 11:32:07 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Oct 2010 11:32:00 +0000 Received: by wyf23 with SMTP id 23so827900wyf.20 for ; Fri, 08 Oct 2010 04:31:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.235.106 with SMTP id t84mr2095319weq.46.1286537518241; Fri, 08 Oct 2010 04:31:58 -0700 (PDT) Received: by 10.216.136.130 with HTTP; Fri, 8 Oct 2010 04:31:58 -0700 (PDT) Date: Fri, 8 Oct 2010 12:31:58 +0100 Message-ID: Subject: [v3] libstdc++/45403 support gdb 7.0 in std::string pretty printer From: Jonathan Wakely To: "libstdc++" , gcc-patches Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Tested with GNU gdb (GDB) Fedora (7.1-34.fc13) Committed to trunk. PR libstdc++/45403 * python/libstdcxx/v6/printers.py: Check for lazy_string support. Index: python/libstdcxx/v6/printers.py =================================================================== --- python/libstdcxx/v6/printers.py (revision 165162) +++ python/libstdcxx/v6/printers.py (working copy) @@ -580,7 +580,9 @@ class StdStringPrinter: reptype = gdb.lookup_type (str (realtype) + '::_Rep').pointer () header = ptr.cast(reptype) - 1 len = header.dereference ()['_M_length'] - return self.val['_M_dataplus']['_M_p'].lazy_string (length = len) + if hasattr(ptr, "lazy_string"): + return ptr.lazy_string (length = len) + return ptr.string (length = len) def display_hint (self): return 'string'