public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Orgad Shaneh <orgads@gmail.com>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix python compatibility with old versions of GDB
Date: Sun, 11 Jun 2017 17:48:00 -0000	[thread overview]
Message-ID: <CAGHpTBJWOuixhd5U-rfGbvqgDwCaMFykTzPev9DHriUbKptvGg@mail.gmail.com> (raw)

> 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(-)

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  <orgads@gmail.com>
+
+       * printing.py: Fix compatibility with old versions of GDB
+
2017-06-10  Simon Marchi  <simon.marchi@polymtl.ca>

       * 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
--
2.11.0

             reply	other threads:[~2017-06-11 17:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-11 17:48 Orgad Shaneh [this message]
2017-06-11 21:09 ` Simon Marchi
2017-06-12  4:31   ` Orgad Shaneh
2017-06-13 11:23     ` Simon Marchi
2017-06-13 12:12       ` Tom Tromey
2017-06-13 12:29         ` Phil Muldoon
2017-06-13 14:44         ` Eli Zaretskii
2017-06-13 17:29           ` Simon Marchi
2017-06-13 17:47             ` Matt Rice
2017-06-13 18:42               ` Tom Tromey
2017-06-13 19:33                 ` Eli Zaretskii
2017-06-13 19:30             ` Eli Zaretskii
2017-06-13 12:53       ` Paul.Koning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGHpTBJWOuixhd5U-rfGbvqgDwCaMFykTzPev9DHriUbKptvGg@mail.gmail.com \
    --to=orgads@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).