This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix a couple libstdc++ pretty-printer bugs

This patch fixes a few pretty-printer bugs:

* There is a bogus ";" in the python code.
  This doesn't hurt but it is unnecessary

* g++ has started emitting shorter names for some basic_string
  instantiations.  This caused the printer lookup code not to
  recognize strings.

* Doug Evans pointed out that the code still refers to WideEncoding,
  which no longer exists.



2009-06-04  Tom Tromey  <>

	* python/libstdcxx/v6/ (lookup_function): Remove extra
	(build_libstdcxx_dictionary): Accept shortened form of
	basic_string names.
	(StdStringPrinter.to_string): Remove reference to WideEncoding.

Index: python/libstdcxx/v6/
--- python/libstdcxx/v6/	(revision 148103)
+++ python/libstdcxx/v6/	(working copy)
@@ -452,8 +452,6 @@
             encoding = gdb.parameter('target-charset')
         elif encoding == 1:
             encoding = gdb.parameter('target-wide-charset')
-        elif isinstance(encoding, WideEncoding):
-            encoding = encoding.value
         return self.val['_M_dataplus']['_M_p'].string(encoding)
     def display_hint (self):
@@ -559,7 +557,7 @@
     "Look-up and return a pretty-printer that can print val."
     # Get the type.
-    type = val.type;
+    type = val.type
     # If it points to a reference, get the reference.
     if type.code == gdb.TYPE_CODE_REF:
@@ -587,10 +585,10 @@
     # libstdc++ objects requiring pretty-printing.
     # In order from:
-    pretty_printers_dict[re.compile('^std::basic_string<char,.*>$')] = lambda val: StdStringPrinter(0, val)
-    pretty_printers_dict[re.compile('^std::basic_string<wchar_t,.*>$')] = lambda val: StdStringPrinter(1, val)
-    pretty_printers_dict[re.compile('^std::basic_string<char16_t,.*>$')] = lambda val: StdStringPrinter('UTF-16', val)
-    pretty_printers_dict[re.compile('^std::basic_string<char32_t,.*>$')] = lambda val: StdStringPrinter('UTF-32', val)
+    pretty_printers_dict[re.compile('^std::basic_string<char(,.*)?>$')] = lambda val: StdStringPrinter(0, val)
+    pretty_printers_dict[re.compile('^std::basic_string<wchar_t(,.*)?>$')] = lambda val: StdStringPrinter(1, val)
+    pretty_printers_dict[re.compile('^std::basic_string<char16_t(,.*)?>$')] = lambda val: StdStringPrinter('UTF-16', val)
+    pretty_printers_dict[re.compile('^std::basic_string<char32_t(,.*)?>$')] = lambda val: StdStringPrinter('UTF-32', val)
     pretty_printers_dict[re.compile('^std::bitset<.*>$')] = StdBitsetPrinter
     pretty_printers_dict[re.compile('^std::deque<.*>$')] = StdDequePrinter
     pretty_printers_dict[re.compile('^std::list<.*>$')] = StdListPrinter

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]