callgraph

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallstackOfColoredFunctions

type CallstackOfColoredFunctions struct {
	// Stack is functions placed in order, only colored functions.
	Stack Nodes
	// ColorsChain is blended colors of stacked functions, one-by-one.
	ColorsChain []palette.Color
	// IndexSet is quick index for Contains(), has the same elements as stack.
	IndexSet map[*Node]struct{}
	// ColorsMask is mask of all ColorsChain.
	ColorsMasks palette.ColorMasks
}

CallstackOfColoredFunctions is a structure for storing a stack of called colored functions with a quick check for the presence of a certain node.

func NewCallstackOfColoredFunctions

func NewCallstackOfColoredFunctions() *CallstackOfColoredFunctions

NewCallstackOfColoredFunctions creates a new callstack.

func (*CallstackOfColoredFunctions) Append

func (c *CallstackOfColoredFunctions) Append(fun *Node)

Append adds the passed node onto the stack.

func (*CallstackOfColoredFunctions) AsVector

func (c *CallstackOfColoredFunctions) AsVector() Nodes

AsVector returns a slice of the functions that are on the stack.

func (*CallstackOfColoredFunctions) Contains

func (c *CallstackOfColoredFunctions) Contains(fun *Node) bool

Contains checks for the existence of the passed node.

func (*CallstackOfColoredFunctions) PopBack

func (c *CallstackOfColoredFunctions) PopBack()

PopBack removes the last function from the stack.

func (*CallstackOfColoredFunctions) Size

func (c *CallstackOfColoredFunctions) Size() int

Size returns the number of functions.

type Graph

type Graph struct {
	Functions Nodes

	Graph    RawGraph
	RevGraph RawGraph
}

Graph is a structure for storing the complete call graph, as well as the functions that are included in it.

func (*Graph) Remove

func (g *Graph) Remove(node *Node)

Remove is a function that removes the passed node from the Graph.

Note: Node is not removed from the RevGraph.

type Node

type Node struct {
	Function *symbols.Function

	// Next is an array of functions that are called from the current one.
	// Prev is an array of functions that call the current one.
	//
	// All functions are always contained here, in contrast to Graph,
	// where some functions can be deleted.
	// Use these fields only if you need to know if there is a connection,
	// but for other, use the Graph.
	Next Nodes
	Prev Nodes

	// Pointer to a slice containing the
	// following nodes that have colors.
	NextWithColors *Nodes
}

Node is a structure for storing information about the functions that call the function, the functions in which the function is called, and the reachable colored functions from the function.

func (*Node) String

func (n *Node) String() string

String method for debugging.

type Nodes

type Nodes []*Node

Nodes is an alias for a slice of graph nodes for which a Remove function is defined for ease of interaction.

func (Nodes) Remove

func (n Nodes) Remove(node *Node) Nodes

Remove is a function that removes the passed node from the slice if any.

type RawGraph

type RawGraph map[*Node]Nodes

RawGraph is a map that stores all the functions that are called in the function or the function in which the function is called.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL