On 14/12/16 22:49 +0100, François Dumont wrote:
@@ -1321,7 +1328,7 @@ def register_type_printers(obj):
    if not _use_type_printing:
        return

-    for pfx in ('', 'w'):
+    for pfx in ('', 'w', vers_nsp, vers_nsp + 'w'):
        add_one_type_printer(obj, 'basic_string', pfx + 'string')
        add_one_type_printer(obj, 'basic_string_view', pfx + 'string_view')
        add_one_type_printer(obj, 'basic_ios', pfx + 'ios')

Looking at this part again, can't we handle the std::__7:: cases
inside add_one_type_printer instead of here?

The "pfx" prefixes here are intended for names that are imilar, like
std::string and std::wstring. If we want to handle both with an
alternative namespace then the place to do that is where we prepend
the namespace, surely?

def add_one_type_printer(obj, match, name):
    printer = FilteringTypePrinter(match, 'std::' + name)
    gdb.types.register_type_printer(obj, printer)
+    printer = FilteringTypePrinter(match, 'std::__7::' + name)
+    gdb.types.register_type_printer(obj, printer)

That will make the patch *much* smaller, and the logic is easier to
follow.

For the template type printers I think we just want to add (__7::)? to
the regular expressions. If we get a type like

 std::__7::vector<T, std::__7::allocator<T> >

Then I think we want to print that as std::vector<T>, without __7::.

Reply via email to