ssaviz

package
v0.0.0-...-c06eb33 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package ssaviz helps user to visualize SSA function.

Index

Constants

View Source
const (
	Prog    = "ssaviz"
	Version = "0.1.0"
	Author  = "Shengyu Zhang <silverrainz.me>"
	Desc    = "Visualize Go SSA function using Graphviz"
)

Package meta informations.

Variables

View Source
var (
	// Debug decides whether to output debug logs.
	Debug bool
)

Functions

This section is empty.

Types

type Attr

type Attr string

Attr is attribute of vertex and edge of Graphviz.

var (
	Fontame Attr = "Courier New"
)

type Format

type Format string

Format is file format of rendered graph.

const (
	DOT Format = "dot"
	SVG Format = "svg"
)

func (Format) Ext

func (s Format) Ext() string

type Graph

type Graph struct {
	Name string
	Kind Kind
	// contains filtered or unexported fields
}

func Build

func Build(kind Kind, f *ssa.Function) (*Graph, error)

Build builds a graph of specific Kind from SSA function.

func (Graph) Render

func (g Graph) Render(format Format) ([]byte, error)

Render renders to specific format. See Format for available formats.

type HTML

type HTML struct {
	// contains filtered or unexported fields
}

HTML is a HTML report that contains multiple [Graph]s.

func Render

func Render(graphs []*Graph) (*HTML, error)

Render renders multiple graphs to a single HTML documentation.

func (*HTML) Save

func (r *HTML) Save(path string) error

Save saves HTML report to given path.

func (*HTML) View

func (r *HTML) View() error

View opens the HTML report in system default application.

NOTE: This function will leave a HTML file named "go-ssaviz-*.html" in the default temporary directory if the HTML has never been saved.

type Kind

type Kind string

Kind is kind of graph.

const (
	CFG Kind = "Control Flow Graph"
)

Jump to

Keyboard shortcuts

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