This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3/67] Add GDB pretty printer for machine mode classes
- From: Richard Sandiford <richard dot sandiford at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 09 Dec 2016 12:53:02 +0000
- Subject: [3/67] Add GDB pretty printer for machine mode classes
- Authentication-results: sourceware.org; auth=none
- References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com>
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(