public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Re: [PATCH] Fix python compatibility with old versions of GDB
@ 2017-06-11 17:48 Orgad Shaneh
  2017-06-11 21:09 ` Simon Marchi
  0 siblings, 1 reply; 13+ messages in thread
From: Orgad Shaneh @ 2017-06-11 17:48 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-06-13 19:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-11 17:48 [PATCH] Fix python compatibility with old versions of GDB Orgad Shaneh
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

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