Blame gdb-bz562763-pretty-print-2d-vectors-libstdcxx.patch
|
|
ee681d3 |
2010-06-01 Chris Moller <cmoller@redhat.com>
|
|
|
ee681d3 |
|
|
|
ee681d3 |
* python/libstdcxx/v6/printers.py (StdVectorPrinter): Add
|
|
|
ee681d3 |
detection for matrices as nested vectors.
|
|
|
ee681d3 |
|
|
|
ee681d3 |
Index: libstdc++-v3/python/libstdcxx/v6/printers.py
|
|
|
ee681d3 |
===================================================================
|
|
|
ee681d3 |
--- ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (revision 159937)
|
|
|
ee681d3 |
+++ ./libstdc++-v3-python-r155978/libstdcxx/v6/printers.py (working copy)
|
|
|
ee681d3 |
@@ -19,6 +19,9 @@
|
|
|
ee681d3 |
import itertools
|
|
|
ee681d3 |
import re
|
|
|
ee681d3 |
|
|
|
ee681d3 |
+vector_sig = 'std::vector'
|
|
|
ee681d3 |
+vector_regex = re.compile('^' + vector_sig + '<.*>$')
|
|
|
ee681d3 |
+
|
|
|
ee681d3 |
class StdPointerPrinter:
|
|
|
ee681d3 |
"Print a smart pointer of some kind"
|
|
|
ee681d3 |
|
|
|
ee681d3 |
@@ -186,7 +189,13 @@
|
|
|
ee681d3 |
% (self.typename, int (finish - start), int (end - start)))
|
|
|
ee681d3 |
|
|
|
ee681d3 |
def display_hint(self):
|
|
|
ee681d3 |
- return 'array'
|
|
|
ee681d3 |
+ itype0 = self.val.type.template_argument(0)
|
|
|
ee681d3 |
+ itag = itype0.tag
|
|
|
ee681d3 |
+ if itag and re.match(vector_regex, itag):
|
|
|
ee681d3 |
+ rc = 'matrix'
|
|
|
ee681d3 |
+ else:
|
|
|
ee681d3 |
+ rc = 'array'
|
|
|
ee681d3 |
+ return rc
|
|
|
ee681d3 |
|
|
|
ee681d3 |
class StdVectorIteratorPrinter:
|
|
|
ee681d3 |
"Print std::vector::iterator"
|
|
|
ee681d3 |
@@ -692,7 +701,7 @@
|
|
|
ee681d3 |
pretty_printers_dict[re.compile('^std::set<.*>$')] = lambda val: StdSetPrinter("std::set", val)
|
|
|
ee681d3 |
pretty_printers_dict[re.compile('^std::stack<.*>$')] = lambda val: StdStackOrQueuePrinter("std::stack", val)
|
|
|
ee681d3 |
pretty_printers_dict[re.compile('^std::unique_ptr<.*>$')] = UniquePointerPrinter
|
|
|
ee681d3 |
- pretty_printers_dict[re.compile('^std::vector<.*>$')] = lambda val: StdVectorPrinter("std::vector", val)
|
|
|
ee681d3 |
+ pretty_printers_dict[vector_regex] = lambda val: StdVectorPrinter(vector_sig, val)
|
|
|
ee681d3 |
# vector<bool>
|
|
|
ee681d3 |
|
|
|
ee681d3 |
# Printer registrations for classes compiled with -D_GLIBCXX_DEBUG.
|