GDB operator tree plugin improvement suggestion
Summary: The previous version didn't seemt to be able to print the operator tree below the `Expand` operator. It seems it was unable to reach the `input_` field because it's a member of the `ExpandCommon` super-type. The proposed fix handles that. @teon, please test, verify, modify, whatever, just ensure printing works below `Expand` operators. Reviewers: teon.banek, buda Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D679
This commit is contained in:
parent
1dec024bc8
commit
ce902e7a86
@ -37,11 +37,17 @@ def _smart_ptr_pointee(smart_ptr):
|
||||
|
||||
def _get_operator_input(operator):
|
||||
'''Returns the input operator of given operator, if it has any.'''
|
||||
if 'input_' not in [f.name for f in operator.type.fields()]:
|
||||
types_to_process = [operator.type]
|
||||
all_fields = []
|
||||
while types_to_process:
|
||||
for field in types_to_process.pop().fields():
|
||||
if field.is_base_class:
|
||||
types_to_process.append(field.type)
|
||||
else:
|
||||
all_fields.append(field)
|
||||
if "input_" not in [f.name for f in all_fields]:
|
||||
return None
|
||||
input_addr = _smart_ptr_pointee(operator['input_'])
|
||||
if input_addr == 0:
|
||||
return None
|
||||
pointer_type = _logical_operator_type().pointer()
|
||||
input_op = gdb.Value(input_addr).cast(pointer_type).dereference()
|
||||
return input_op.cast(input_op.dynamic_type)
|
||||
|
Loading…
Reference in New Issue
Block a user