gdbhooks.py (class DWDieRefPrinter): New class.
authorAldy Hernandez <aldyh@redhat.com>
Wed, 10 Dec 2014 23:16:42 +0000 (23:16 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Wed, 10 Dec 2014 23:16:42 +0000 (23:16 +0000)
* gdbhooks.py (class DWDieRefPrinter): New class.
(build_pretty_printer): Register dw_die_ref's.

From-SVN: r218612

gcc/ChangeLog
gcc/gdbhooks.py

index b7021a051aea72ea2247ff93f8b9c5d812a80d89..dfff862a822019a5d8973121f10bba1099a25d8c 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-10  Aldy Hernandez  <aldyh@redhat.com>
+
+       * gdbhooks.py (class DWDieRefPrinter): New class.
+       (build_pretty_printer): Register dw_die_ref's.
+
 2014-12-10  Ilya Tocar  <ilya.tocar@intel.com>
 
        * config.gcc: Support "knl".
index a74e712c1e124b44b7c250303eca654bcdbb4383..6d9e41e611beae5efcbb655e8f79bfc7c6746de3 100644 (file)
@@ -252,6 +252,26 @@ class CGraphNodePrinter:
         result += '>'
         return result
 
+######################################################################
+# Dwarf DIE pretty-printers
+######################################################################
+
+class DWDieRefPrinter:
+    def __init__(self, gdbval):
+        self.gdbval = gdbval
+
+    def to_string (self):
+        if long(self.gdbval) == 0:
+            return '<dw_die_ref 0x0>'
+        result = '<dw_die_ref 0x%x' % long(self.gdbval)
+        result += ' %s' % self.gdbval['die_tag']
+        if long(self.gdbval['die_parent']) != 0:
+            result += ' <parent=0x%x %s>' % (long(self.gdbval['die_parent']),
+                                             self.gdbval['die_parent']['die_tag'])
+                                             
+        result += '>'
+        return result
+
 ######################################################################
 
 class GimplePrinter:
@@ -455,6 +475,8 @@ def build_pretty_printer():
                              'tree', TreePrinter)
     pp.add_printer_for_types(['cgraph_node *'],
                              'cgraph_node', CGraphNodePrinter)
+    pp.add_printer_for_types(['dw_die_ref'],
+                             'dw_die_ref', DWDieRefPrinter)
     pp.add_printer_for_types(['gimple', 'gimple_statement_base *',
 
                               # Keep this in the same order as gimple.def: