debug package

This package stores different program information (call graphs and struct representations) as graphs and saves them as .dot files. Such functionality only occurs when the -d or --debug options are passed from the command line.

Submodules

debug.graph module

A graph representing the struct structures created in memory”

class debug.graph.Graph(graph_dict=None)[source]

Bases: object

A general-purpose graph class

Delta()[source]

the maximum degree of the vertices

add_edge(edge)[source]

assumes that edge is of type set, tuple or list; between two vertices can be multiple edges!

add_vertex(vertex)[source]

If the vertex “vertex” is not in self.__graph_dict, a key “vertex” with an empty list as a value is added to the dictionary. Otherwise nothing has to be done.

degree_sequence()[source]

calculates the degree sequence

delta()[source]

the minimum degree of the vertices

density()[source]

method to calculate the density of a graph

diameter()[source]

calculates the diameter of the graph

edges()[source]

returns the edges of a graph

static erdoes_gallai(dsequence)[source]

Checks if the condition of the Erdoes-Gallai inequality is fullfilled

find_all_paths(start_vertex, end_vertex, path=[])[source]

find all paths from start_vertex to end_vertex in graph

find_isolated_vertices()[source]

returns a list of isolated vertices.

find_path(start_vertex, end_vertex, path=[])[source]

find a path from start_vertex to end_vertex in graph

is_connected(vertices_encountered=None, start_vertex=None)[source]

determines if the graph is connected

static is_degree_sequence(sequence)[source]

Method returns True, if the sequence “sequence” is a degree sequence, i.e. a non-increasing sequence. Otherwise False is returned.

vertex_degree(vertex)[source]

The degree of a vertex is the number of edges connecting it, i.e. the number of adjacent vertices. Loops are counted double, i.e. every occurence of vertex in the list of adjacent vertices.

vertices()[source]

returns the vertices of a graph

debug.call_inspector module

A visitor implementation that stores a representation of the calling graph into a text stream. Its use is for debugging purposes, to check the structure of the generated program.

debug.call_inspector.callinsp_visit(node, nodes, edges, *args, **kwargs)[source]
debug.call_inspector.callinsp_visit(program: core.ast.Program, nodes, edges)
debug.call_inspector.callinsp_visit(function: core.ast.Function, nodes, edges)
debug.call_inspector.callinsp_visit(invocation: core.ast.Invocation, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.TernaryExpression, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.TernaryExpression, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.TernaryExpression, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.TernaryExpression, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.TernaryExpression, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.TernaryExpression, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.TernaryExpression, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.Label, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.Label, nodes, edges, func_name, parent)
debug.call_inspector.callinsp_visit(node: core.ast.Label, nodes, edges, func_name, parent)
debug.call_inspector.write_graph(program, visit_main, path)[source]

debug.structure_inspector module

Stores in a text stream the representation of the struct data types in the generated program. Its use is for debugging purposes, to check the structure of the struct types in the generated program.

debug.structure_inspector.get_struct_name(t)[source]
debug.structure_inspector.write_graph(program, path)[source]