35 "Print Eigen Matrix or Array of some kind" 38 "Extract all the necessary information" 45 if type.code == gdb.TYPE_CODE_REF:
47 self.
type = type.unqualified().strip_typedefs()
49 regex = re.compile(
'<.*>')
50 m = regex.findall(tag)[0][1:-1]
51 template_params = m.split(
',')
52 template_params = [x.replace(
" ",
"")
for x
in template_params]
54 if template_params[1] ==
'-0x00000000000000001' or template_params[1] ==
'-0x000000001' or template_params[1] ==
'-1':
55 self.
rows = val[
'm_storage'][
'm_rows']
57 self.
rows =
int(template_params[1])
59 if template_params[2] ==
'-0x00000000000000001' or template_params[2] ==
'-0x000000001' or template_params[2] ==
'-1':
60 self.
cols = val[
'm_storage'][
'm_cols']
62 self.
cols =
int(template_params[2])
65 if len(template_params) > 3:
66 self.
options = template_params[3];
75 self.
data = self.
val[
'm_storage'][
'm_data']
76 if self.data.type.code == gdb.TYPE_CODE_STRUCT:
78 self.
data = self.data.cast(self.innerType.pointer())
81 def __init__ (self, rows, cols, dataPtr, rowMajor):
117 item = self.dataPtr.dereference()
120 return (
'[%d]' % (row,), item)
121 elif (self.
rows == 1):
122 return (
'[%d]' % (col,), item)
123 return (
'[%d,%d]' % (row, col), item)
133 "Print an Eigen Quaternion" 136 "Extract all the necessary information" 139 if type.code == gdb.TYPE_CODE_REF:
141 self.
type = type.unqualified().strip_typedefs()
146 self.
data = self.
val[
'm_coeffs'][
'm_storage'][
'm_data'][
'array']
147 self.
data = self.data.cast(self.innerType.pointer())
169 item = self.dataPtr.dereference()
178 return "Eigen::Quaternion<%s> (data ptr: %s)" % (self.
innerType, self.
data)
182 pretty_printers_dict[re.compile(
'^Eigen::Matrix<.*>$')] =
lambda val:
EigenMatrixPrinter(
"Matrix", val)
183 pretty_printers_dict[re.compile(
'^Eigen::Array<.*>$')] =
lambda val:
EigenMatrixPrinter(
"Array", val)
186 "Register eigen pretty-printers with objfile Obj" 190 obj.pretty_printers.append(lookup_function)
193 "Look-up and return a pretty-printer that can print va." 197 if type.code == gdb.TYPE_CODE_REF:
200 type = type.unqualified().strip_typedefs()
206 for function
in pretty_printers_dict:
207 if function.search(typename):
208 return pretty_printers_dict[function](val)
212 pretty_printers_dict = {}
214 build_eigen_dictionary ()
def __init__(self, rows, cols, dataPtr, rowMajor)
def __init__(self, variety, val)
def __init__(self, dataPtr)
def register_eigen_printers(obj)
def build_eigen_dictionary()