class cfg_path_node

A node on a CFG path.

Used by the warningclass report() and report_return_warning() methods that report a warning with a path.

cfg_path_node Details

class cs.cfg_path_node

A node on a CFG path.

__init__(_pnt, _event, _flags)

Constructor for use when constructing pseudo-paths for display that do not correspond to actual control flow.

Parameters:
  • _pnt (point) – A point on the path.
  • _event (str) – Describes the problem at the point, if any. If empty, no event will be associated with this node.
  • _flags (cfg_path_node_flags) – Flags that characterize this node.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> csvec = b.call_sites_vector()
>>> cfg_path_node(csvec[0], 'indirect', cfg_path_node_flags.NONE)
<cs.cfg_path_node <cs.point [call-site] bar(int, void *, int)>, CS_EDGE_LABEL_NULL, indirect, cs.cfg_path_node_flags none>
__init__(_pnt, _edge, _event, _flags)

Constructor.

Parameters:
  • _pnt (point) – A point on the path.
  • _edge (edge_label) – The edge label for this node (identifies an edge out of _pnt. Use the other constructor form if there is no edge label because this does not correspond to actual control flow.
  • _event (str) – Describes the problem at the point, if any. If empty, no event will be associated with this node.
  • _flags (cfg_path_node_flags) – Flags that characterize this node.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> csvec = b.call_sites_vector()
>>> cfg_path_node(csvec[0], edge_label(True), 'indirect', cfg_path_node_flags.NONE)
<cs.cfg_path_node <cs.point [call-site] bar(int, void *, int)>, <cs.edge_label T>, indirect, cs.cfg_path_node_flags none>
__repr__()

Get a representation of a cfg_path_node object that includes information useful for debugging.

Return type:str
Returns:The string representation.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> csvec = b.call_sites_vector()
>>> pathnode = cfg_path_node(csvec[0], edge_label(True), 'indirect', cfg_path_node_flags.NONE)
>>> repr(pathnode)
'<cs.cfg_path_node <cs.point [call-site] bar(int, void *, int)>, <cs.edge_label T>, indirect, cs.cfg_path_node_flags none>'
__str__()

Get a simple string representation of a cfg_path_node object.

Return type:str
Returns:The string representation.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> csvec = b.call_sites_vector()
>>> pathnode = cfg_path_node(csvec[0], edge_label(True), 'indirect', cfg_path_node_flags.NONE)
>>> str(pathnode)
'<cs.cfg_path_node <cs.point [call-site] bar(int, void *, int)>, <cs.edge_label T>, indirect, cs.cfg_path_node_flags none>'
get_edge_label()

Get the edge label from a cfg_path_node .

Return type:edge_label
Returns:The node’s edge_label .
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> csvec = b.call_sites_vector()
>>> pathnode = cfg_path_node(csvec[0], edge_label(True), 'indirect', cfg_path_node_flags.NONE)
>>> pathnode.get_edge_label()
<cs.edge_label T>
get_event()

Get the event string from a cfg_path_node .

Return type:str
Returns:The node’s event string.
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> csvec = b.call_sites_vector()
>>> pathnode = cfg_path_node(csvec[0], edge_label(True), 'indirect', cfg_path_node_flags.NONE)
>>> pathnode.get_event()
'indirect'
get_flags()

Get the flags from a cfg_path_node .

Return type:cfg_path_node_flags
Returns:The node’s flags ( cfg_path_node_flags ).
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> csvec = b.call_sites_vector()
>>> pathnode.get_flags()
<cs.cfg_path_node_flags none>
get_source_point()

Get the source point from a cfg_path_node .

Return type:point
Returns:The node’s path point .
>>> b = project.current().find_procedure('bar(int, void *, int)')
>>> csvec = b.call_sites_vector()
>>> pathnode.get_source_point()
<cs.point [call-site] bar(int, void *, int)>