gdb.printers Namespace Reference

Classes

class  _MatrixEntryIterator
 
class  EigenMatrixPrinter
 
class  EigenSparseMatrixPrinter
 
class  EigenQuaternionPrinter
 

Functions

def cast_eigen_block_to_matrix (val)
 
def build_eigen_dictionary ()
 
def register_eigen_printers (obj)
 
def lookup_function (val)
 

Variables

dictionary pretty_printers_dict = {}
 

Function Documentation

◆ build_eigen_dictionary()

def gdb.printers.build_eigen_dictionary ( )
297  pretty_printers_dict[re.compile('^Eigen::Quaternion<.*>$')] = lambda val: EigenQuaternionPrinter(val)
298  pretty_printers_dict[re.compile('^Eigen::Matrix<.*>$')] = lambda val: EigenMatrixPrinter("Matrix", val)
299  pretty_printers_dict[re.compile('^Eigen::Block<.*>$')] =\
300  lambda val: EigenMatrixPrinter("Matrix", cast_eigen_block_to_matrix(val))
301  pretty_printers_dict[re.compile('^Eigen::VectorBlock<.*>$')] =\
302  lambda val: EigenMatrixPrinter("Matrix", cast_eigen_block_to_matrix(val))
303  pretty_printers_dict[re.compile('^Eigen::SparseMatrix<.*>$')] = lambda val: EigenSparseMatrixPrinter(val)
304  pretty_printers_dict[re.compile('^Eigen::Array<.*>$')] = lambda val: EigenMatrixPrinter("Array", val)
305 
306 
def cast_eigen_block_to_matrix(val)
Definition: printers.py:282
def build_eigen_dictionary()
Definition: printers.py:296

References gdb.printers.cast_eigen_block_to_matrix().

◆ cast_eigen_block_to_matrix()

def gdb.printers.cast_eigen_block_to_matrix (   val)
283  # Get the type of the variable (and convert to a string)
284  # Example: 'const Eigen::Block<Eigen::Block<Eigen::Matrix<double, -1, -1, 0, -1, -1>, -1, -1, false> const, -1, -1, false>'
285  val_type = str(val.type)
286 
287  # Extract the Eigen::Matrix type from the Block:
288  # From the previous example: Eigen::Matrix<double, -1, -1, 0, -1, -1>
289  begin = val_type.find('Eigen::Matrix<')
290  end = val_type.find('>', begin) + 1
291 
292  # Convert the Eigen::Block to an Eigen::Matrix
293  return val.cast(gdb.lookup_type(val_type[begin:end]))
294 
295 
str
Definition: compute_granudrum_aor.py:141

References compute_granudrum_aor.str.

Referenced by gdb.printers.build_eigen_dictionary().

◆ lookup_function()

def gdb.printers.lookup_function (   val)
Look-up and return a pretty-printer that can print val.
315 def lookup_function(val):
316  """Look-up and return a pretty-printer that can print val."""
317 
318  typeinfo = val.type
319 
320  if typeinfo.code == gdb.TYPE_CODE_REF:
321  typeinfo = typeinfo.target()
322 
323  typeinfo = typeinfo.unqualified().strip_typedefs()
324 
325  typename = typeinfo.tag
326  if typename is None:
327  return None
328 
329  for function in pretty_printers_dict:
330  if function.search(typename):
331  return pretty_printers_dict[function](val)
332 
333  return None
334 
335 
def lookup_function(val)
Definition: printers.py:315

◆ register_eigen_printers()

def gdb.printers.register_eigen_printers (   obj)
Register eigen pretty-printers with objfile Obj
307 def register_eigen_printers(obj):
308  """Register eigen pretty-printers with objfile Obj"""
309 
310  if obj is None:
311  obj = gdb
312  obj.pretty_printers.append(lookup_function)
313 
314 
def register_eigen_printers(obj)
Definition: printers.py:307

Variable Documentation

◆ pretty_printers_dict

dictionary gdb.printers.pretty_printers_dict = {}