diff mbox

Committed: gdbhooks.py: fix prettyprinting of NULL vec<>*

Message ID 1384977950.11568.185.camel@surprise
State New
Headers show

Commit Message

David Malcolm Nov. 20, 2013, 8:05 p.m. UTC
r205086's implementation of prettyprinting vec<>* didn't check for NULL
before attempting to walk the elements of the vec, leading to noise
within gdb:
  (gdb) p cfun->cfg->x_entry_block_ptr->preds
  $12 = 0x0<error reading variable: Cannot access memory at address 0x4>

The attached patch fixes this issue, giving this output:
  (gdb) p cfun->cfg->x_entry_block_ptr->preds
  $6 = 0x0

Committed to trunk as r205139.
diff mbox

Patch

Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog	(revision 205138)
+++ gcc/ChangeLog	(revision 205139)
@@ -1,3 +1,8 @@ 
+2013-11-20  David Malcolm  <dmalcolm@redhat.com>
+
+	* gdbhooks.py (VecPrinter.children): Don't attempt to iterate
+	the children of a NULL pointer.
+
 2013-11-20  Robert Suchanek  <Robert.Suchanek@imgtec.com>
 
 	* lra.c (lra): Set lra_in_progress before check_rtl call.
Index: gcc/gdbhooks.py
===================================================================
--- gcc/gdbhooks.py	(revision 205138)
+++ gcc/gdbhooks.py	(revision 205139)
@@ -383,6 +383,8 @@ 
         return '0x%x' % long(self.gdbval)
 
     def children (self):
+        if long(self.gdbval) == 0:
+            return
         m_vecpfx = self.gdbval['m_vecpfx']
         m_num = m_vecpfx['m_num']
         m_vecdata = self.gdbval['m_vecdata']