Advertisement
Guest User

Untitled

a guest
Jun 16th, 2015
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import gdb  # gdb.Value() not defined
  4. import dumper   # Children is not defined
  5.  
  6. def qdump__arma__Mat(d, value):
  7.     array = value["mem"]
  8.     cols = value["n_cols"]
  9.     rows = value["n_rows"]
  10.     maxDisplayItems = 50
  11.     innerType = d.templateArgument(value.type, 0)
  12.     p = gdb.Value(array.cast(innerType.pointer()))
  13.     d.putItemCount(cols)
  14.     d.putNumChild(cols)
  15.     if d.isExpanded():
  16.         numDisplayItems = min(maxDisplayItems, cols)
  17.         with dumper.Children(d, numChild=cols,
  18.                maxNumChild=numDisplayItems,
  19.                childType=innerType,
  20.                addrBase=p,
  21.                addrStep=p.dereference().__sizeof__):
  22.             for i in range(0, int(numDisplayItems)):
  23.                 with dumper.Children(d):
  24.                     d.putItemCount(rows)
  25.                     d.putNumChild(rows)
  26.                     if d.isExpanded():
  27.                         numDisplayItems = min(maxDisplayItems, rows)
  28.                         with dumper.Children(d, numChild=rows,
  29.                                maxNumChild=numDisplayItems,
  30.                                childType=innerType,
  31.                                addrBase=p,
  32.                                addrStep=p.dereference().__sizeof__):
  33.                             for j in range(0, int(numDisplayItems)):
  34.                                 d.putSubItem(j, p.dereference())
  35.                                 p += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement