This patch adds gdb hooks for printing machine_modes in the
natural way.

gcc/
        * gdbhooks.py (MachineModePrinter): New class.
        (build_pretty_printer): Use it for machine_modes.

diff --git a/gcc/gdbhooks.py b/gcc/gdbhooks.py
index 1212312..95f4b95 100644
--- a/gcc/gdbhooks.py
+++ b/gcc/gdbhooks.py
@@ -422,6 +422,16 @@ class VecPrinter:
 
 ######################################################################
 
+class MachineModePrinter:
+    def __init__(self, gdbval):
+        self.gdbval = gdbval
+
+    def to_string (self):
+       name = str(self.gdbval['m_mode'])
+       return name[2:] if name.startswith('E_') else name
+
+######################################################################
+
 # TODO:
 #   * hashtab
 #   * location_t
@@ -518,6 +528,9 @@ def build_pretty_printer():
                              'vec',
                              VecPrinter)
 
+    pp.add_printer_for_types(['machine_mode'],
+                            'machine_mode', MachineModePrinter)
+
     return pp
 
 gdb.printing.register_pretty_printer(

Reply via email to