[Python] Make regexp collection printers work with typedefs as well.
authorJoel Brobecker <brobecker@adacore.com>
Thu, 30 Jan 2014 03:37:08 +0000 (07:37 +0400)
committerJoel Brobecker <brobecker@adacore.com>
Wed, 26 Feb 2014 19:04:12 +0000 (11:04 -0800)
commit1b588015839caafc608a6944a78aea170f5fb2f6
treec70dbe69d571d253d677f29aa732c69b7a298466
parentdbb9c2b1f231262ece36790241fe1fc3902cf03d
[Python] Make regexp collection printers work with typedefs as well.

Consider the following type for which we would like to provide
a pretty-printer and manage it via RegexpCollectionPrettyPrinter:

        typedef long time_t;

Currently, this does not work because this framework only considers
the type's tag name:

        typename = gdb.types.get_basic_type(val.type).tag
        if not typename:
            return None

This patch extends it to use the type's name if the basic type
does not have a tag name, thus allowing the framework to also
work with typedefs like the above.

gdb/ChangeLog:

        * python/lib/gdb/printing.py (RegexpCollectionPrettyPrinter):
        Use the type's name if its basic type does not have a tag.

gdb/testsuite/ChangeLog:

        * testsuite/gdb.python/py-pp-re-notag.c: New file.
        * testsuite/gdb.python/py-pp-re-notag.ex: New file.
        * testsuite/gdb.python/py-pp-re-notag.p: New file.
gdb/ChangeLog
gdb/python/lib/gdb/printing.py
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-pp-re-notag.c [new file with mode: 0644]
gdb/testsuite/gdb.python/py-pp-re-notag.exp [new file with mode: 0644]
gdb/testsuite/gdb.python/py-pp-re-notag.py [new file with mode: 0644]