From patchwork Sun Jun 11 17:48:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Orgad Shaneh X-Patchwork-Id: 20913 Received: (qmail 10420 invoked by alias); 11 Jun 2017 17:48:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 9898 invoked by uid 89); 11 Jun 2017 17:48:29 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f176.google.com Received: from mail-wr0-f176.google.com (HELO mail-wr0-f176.google.com) (209.85.128.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 11 Jun 2017 17:48:19 +0000 Received: by mail-wr0-f176.google.com with SMTP id g76so74812879wrd.1 for ; Sun, 11 Jun 2017 10:48:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=m3G3umcyC4hdlHsepjHZLtvwQaSZUtLRHwnuIOaQ4tc=; b=nnGlr/w9Km0T227aS0i6sDIWYDKo2OzPMB1rnC3Ho2BtWHWYU4s1JcaDnTwxWD+q8b o02Q1+6q098YKLUlA6EqHBmJ9ohKVMRpj8DEvVOGxDybZ9TqCcJCUUOtpyHkvSfc6c/b Ofvr8I0n13L0e6+jDLV7nQ+34aMJhzFZdZ78wUjWRxHzTb0WwoaaAJiY3MDLYc9r0Hxu h7JvM68Q6iSiX4eI4q7OhYSXrRVhW64VXrSpOh2KnHBOKTJR2oohBfXzu8JQHpzeBcLw /PPG14kb5TkcSy9l8NbQvH7cVXzsIpnkrgoAzqZbKOqI0Cg9R04rCrNzKFyGthlfKNDC 3vLg== X-Gm-Message-State: AODbwcCBYIh2zX+pQ0b53xeyhIWWgs4fwSitx6vgDFSmGcgJoV9r20Hz oK2qXz51THzE/UEDDD2n0/1YLb8JcaC7HOo= X-Received: by 10.80.148.129 with SMTP id s1mr35037438eda.106.1497203293123; Sun, 11 Jun 2017 10:48:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.137.173 with HTTP; Sun, 11 Jun 2017 10:48:12 -0700 (PDT) From: Orgad Shaneh Date: Sun, 11 Jun 2017 20:48:12 +0300 Message-ID: Subject: Re: [PATCH] Fix python compatibility with old versions of GDB To: Simon Marchi , gdb-patches@sourceware.org > Hi Orgad, > > Thanks for submitting this, and sorry for the wait. Could you provide a > little bit of context to help others understand what's wrong? Can you give > some details on how to reproduce the problem? Make sure to add it to the > commit message. > > Also, please include a ChangeLog entry in your commit message, more details > here: > > https://sourceware.org/gdb/wiki/ContributionChecklist#Properly_Formatted_GNU_ChangeLog > > If anything is not clear, please ask. > > Thanks, > > Simon If data-directory is shared between various version of GDB, it should work for all of them. There are several hasattr conditions that enable this kind of compatibility. RegexpCollectionPrettyPrinter was missing a check that enables it to work with GDB prior to 7.9, when Type.name was introduced. gdb/ChangeLog: * printing.py: Fix compatibility with old versions of GDB --- gdb/ChangeLog | 4 ++++ gdb/python/lib/gdb/printing.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c48fb92e9e..0a0005090b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-06-11 Orgad Shaneh + + * printing.py: Fix compatibility with old versions of GDB + 2017-06-10 Simon Marchi * gdbarch.sh (displaced_step_free_closure): Remove. diff --git a/gdb/python/lib/gdb/printing.py b/gdb/python/lib/gdb/printing.py index 181701c719..106da4ac8b 100644 --- a/gdb/python/lib/gdb/printing.py +++ b/gdb/python/lib/gdb/printing.py @@ -205,7 +205,7 @@ class RegexpCollectionPrettyPrinter(PrettyPrinter): # Get the type name. typename = gdb.types.get_basic_type(val.type).tag - if not typename: + if not typename and hasattr(val.type, "name"): typename = val.type.name if not typename: return None