traceback

package
v0.0.0-...-8d1c8a5 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2015 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fprint

func Fprint(out io.Writer, trace *Traceback, config PrintConfig)

Types

type Call

type Call struct {
	Func   string
	Source string
	Line   int
	Args   []uint64
}

Call represents a function call of a call stack trace.

func (Call) Clone

func (c Call) Clone() Call

type PrintConfig

type PrintConfig struct {
	Format               PrintFormat
	PreserveSourcePrefix bool
}

type PrintFormat

type PrintFormat int
const (
	Text PrintFormat = iota
	Pretty
	Quickfix
	JSON
)

type Stack

type Stack struct {
	ID     int
	Status StackStatus
	Calls  []Call
}

Stack represents the call stack trace of a goroutine.

func ExcludeGoroot

func ExcludeGoroot(srcs []Stack, preserveOne bool) []Stack

ExcludeGoroot filters out GOROOT function calls form the top of stacks. If `preserveOne` is set, it leaves the nearest GOROOT function call.

func ExcludeGotest

func ExcludeGotest(srcs []Stack) (dst []Stack)

ExcludeGotest filters out no meaningful stacks and calls caused by go test command and testing package.

func ExcludeLowers

func ExcludeLowers(srcs []Stack) []Stack

ExcludeLowers filters calls of stacks by excluding function calls that is not the top of stack.

func TrimSourcePrefix

func TrimSourcePrefix(srcs []Stack) []Stack

TrimSourcePrefix trims file path prefix from src.Calls.Source field.

func (Stack) Clone

func (s Stack) Clone() Stack

type StackStatus

type StackStatus string
const (
	StackStatusChanReceive    StackStatus = "chan receive"
	StackStatusChanReceiveNil StackStatus = "chan receive (nil chan)"
	StackStatusChanSend       StackStatus = "chan send"
	StackStatusChanSendNil    StackStatus = "chan send (nil chan)"
	StackStatusSemAcquire     StackStatus = "semacquire"
	StackStatusRunning        StackStatus = "running"
	StackStatusRunnable       StackStatus = "runnable"
	StackStatusSleep          StackStatus = "sleep"
	StackStatusFinalizerWait  StackStatus = "finalizer wait"
	StackStatusSyscall        StackStatus = "syscall"
	StackStatusIOWait         StackStatus = "IO Wait"

	StackStatusWrite         StackStatus = "Write"
	StackStatusRead          StackStatus = "Read"
	StackStatusPreviousWrite StackStatus = "Previous write"
	StackStatusPreviousRead  StackStatus = "Previous read"

	StackStatusRuntime StackStatus = "runtime stack"
)

type Traceback

type Traceback struct {
	Reason string
	Races  []Stack `json:omitempty`
	Stacks []Stack
}

Traceback represents the per-goroutine stacktraces generated by GOTRACEBACK=1 environment.

func ParseTraceback

func ParseTraceback(r io.Reader, w io.Writer) (*Traceback, error)

ParseTraceback parses the per-goroutine stacktraces generated by GOTRACEBACK=1 environment. It reads `r` and constructs a `Traceback` struct to return. It also writes unrelated lines to `w`.

func (Traceback) Clone

func (t Traceback) Clone() Traceback

Jump to

Keyboard shortcuts

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