aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/python-prettyprint.py
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.python/python-prettyprint.py')
-rw-r--r--gdb/testsuite/gdb.python/python-prettyprint.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/python-prettyprint.py b/gdb/testsuite/gdb.python/python-prettyprint.py
index 493cf29..bf009a1 100644
--- a/gdb/testsuite/gdb.python/python-prettyprint.py
+++ b/gdb/testsuite/gdb.python/python-prettyprint.py
@@ -92,6 +92,19 @@ class pp_vbase1:
def to_string (self):
return "pp class name: " + self.val.type.tag
+class pp_ns:
+ "Print a std::basic_string of some kind"
+
+ def __init__(self, val):
+ self.val = val
+
+ def to_string(self):
+ len = self.val['length']
+ return self.val['null_str'].string (gdb.parameter ('target-charset'), length = len)
+
+ def display_hint (self):
+ return 'string'
+
def lookup_function (val):
"Look-up and return a pretty-printer that can print val."
@@ -145,6 +158,8 @@ def register_pretty_printers ():
pretty_printers_dict[re.compile ('^string_repr$')] = string_print
pretty_printers_dict[re.compile ('^container$')] = ContainerPrinter
+ pretty_printers_dict[re.compile ('^struct ns$')] = pp_ns
+ pretty_printers_dict[re.compile ('^ns$')] = pp_ns
pretty_printers_dict = {}
register_pretty_printers ()