This is the mail archive of the mailing list for the GDB 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]

[PATCH, PR 17364] Need better printer names in

Moved the printer to the global scope and changed the name of the
printer to a more specific name.

2014.09.11  Walfred Tedeschi  <>


	* (mpx_bound_reg_printer) Added function to
	register pretty-printing for bound registers, and fixed comments.
	(build_pretty_printer) Removed.

 gdb/python/lib/gdb/command/ | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/gdb/python/lib/gdb/command/ b/gdb/python/lib/gdb/command/
index 24d4c45..6f2dbc6 100644
--- a/gdb/python/lib/gdb/command/
+++ b/gdb/python/lib/gdb/command/
@@ -16,8 +16,8 @@
 import gdb.printing
-class BoundPrinter:
-    """Adds size field to a _rawbound128 type."""
+class BoundPrinter (object):
+    """Adds size field to a  __gdb_builtin_type_bound128 type."""
     def __init__ (self, val):
         self.val = val
@@ -31,15 +31,14 @@ class BoundPrinter:
         result = '{lbound = %s, ubound = %s} : size %s' % (lower, upper, size)
         return result
-# There are two pattern matching used: first one is related to a library
-# second is related to the type. Since we are displaying a register all
-# libraries are accepted. Type to be processed is the same present
-# in the xml file.
+# Register a global pretty-printer for the bnd[0..3] pseudo
+# register.
-def build_pretty_printer ():
-    pp = gdb.printing.RegexpCollectionPrettyPrinter (".*")
-    pp.add_printer ('bound', '^__gdb_builtin_type_bound128', BoundPrinter)
-    return pp
+def mpx_bound_reg_printer (val):
+    lookup_tag = val.type.tag
+    if lookup_tag == None:
+        return None
+    if lookup_tag == "__gdb_builtin_type_bound128":
+        return BoundPrinter (val)
-gdb.printing.register_pretty_printer (gdb.current_objfile (),
-                                      build_pretty_printer ())
+gdb.pretty_printers.append (mpx_bound_reg_printer)

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