godebug

package
v0.0.0-...-bfb01ae Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Go = gls.Go

Functions

func Case

func Case(c *Context, s *Scope, line int) interface{}

Case marks a case clause. Intended to be inserted as its own case clause immediately prior to the case clause it is marking.

func Comm

func Comm(c *Context, s *Scope, line int) chan struct{}

Comm marks a case in a select statement. It returns a nil channel to read from as a new case immediately before the case it is marking.

func Defer

func Defer(c *Context, s *Scope, line int)

Defer marks a defer statement. Intended to be run in a defer statement of its own after the corresponding defer in the original source.

func ElseIfExpr

func ElseIfExpr(c *Context, s *Scope, line int)

ElseIfExpr marks an "else if" expression.

func ElseIfSimpleStmt

func ElseIfSimpleStmt(c *Context, s *Scope, line int)

ElseIfSimpleStmt marks a simple statement preceding an "else if" expression.

func EndSelect

func EndSelect(c *Context, s *Scope) chan struct{}

EndSelect marks the end of a select statement. It returns a nil channel to read from as the last case of that select statement.

func EnterFuncWithRecovers

func EnterFuncWithRecovers(r chan chan interface{}, fn func(*Context)) (<-chan chan interface{}, chan interface{})

EnterFuncWithRecovers is a special wrapper for functions that call recover(). recover only works if it is called directly by a deferred function. It does not work if a deferred function calls a function that in turn calls another function that calls recover. But EnterFunc and EnterFuncLit depend on being able to wrap their functions and call them farther down in the stack.

The solution is to create a new goroutine, use EnterFuncLit as normal in the new goroutine, and have the code generator replace calls to recover with channel communications. Then in the original function frame, we call recover when asked to and pass its value into the new goroutine over a channel.

EnterFuncWithRecovers takes care of maintaining goroutine-local-storage in the new goroutine, as well as propagating any panic from that goroutine to the original goroutine.

func ExitFunc

func ExitFunc(ctx *Context)

ExitFunc marks the end of a function.

func Line

func Line(c *Context, s *Scope, line int)

Line marks a normal line where the debugger might pause.

func Select

func Select(c *Context, s *Scope, line int)

Select marks a select statement.

func SetTrace

func SetTrace()

SetTrace is deprecated. It will be deleted in a future release.

func SetTraceGen

func SetTraceGen(ctx *Context)

SetTraceGen is the generated entrypoint to the debugger.

Types

type Context

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

Context contains debugging context information.

func EnterFunc

func EnterFunc(fn func()) (ctx *Context, proceed bool)

EnterFunc marks the beginning of a function. Calling fn should be equivalent to running the function that is being entered. If proceed is false, EnterFunc did in fact call fn, and so the caller of EnterFunc should return immediately rather than proceed to duplicate the effects of fn.

func EnterFuncLit

func EnterFuncLit(fn func(*Context)) (ctx *Context, proceed bool)

EnterFuncLit is like EnterFunc, but intended for function literals. The passed callback takes a *Context rather than no input.

type Scope

type Scope struct {
	Vars, Consts, Funcs map[string]interface{}
	// contains filtered or unexported fields
}

Scope represents a lexical scope for variable bindings.

func EnteringNewFile

func EnteringNewFile(parent *Scope, fileText string) *Scope

EnteringNewFile returns a new Scope and internally sets the current scope to be the returned scope.

func (*Scope) AddConst

func (s *Scope) AddConst(ident string, c reflect.Value)

func (*Scope) AddFunc

func (s *Scope) AddFunc(ident string, f reflect.Value)

func (*Scope) AddPkg

func (s *Scope) AddPkg(pkg string, p eval.Env)

func (*Scope) AddType

func (s *Scope) AddType(ident string, t reflect.Type)

func (*Scope) AddVar

func (s *Scope) AddVar(ident string, v reflect.Value)

func (*Scope) Const

func (s *Scope) Const(ident string) reflect.Value

func (*Scope) Constant

func (s *Scope) Constant(namevalue ...interface{})

Constant is like Declare, but for constants. The values must be passed directly.

func (*Scope) Declare

func (s *Scope) Declare(namevalue ...interface{})

Declare creates new variable bindings in s from a list of name, value pairs. The values should be pointers to the values in the program rather than copies of them so that s can track changes to them.

func (*Scope) EnteringNewChildScope

func (s *Scope) EnteringNewChildScope() *Scope

EnteringNewChildScope returns a new Scope that is the child of s and internally sets the current scope to be the returned scope.

func (*Scope) Func

func (s *Scope) Func(ident string) reflect.Value

func (*Scope) Pkg

func (s *Scope) Pkg(pkg string) eval.Env

func (*Scope) PopScope

func (s *Scope) PopScope() eval.Env

func (*Scope) PushScope

func (s *Scope) PushScope() eval.Env

func (*Scope) Type

func (s *Scope) Type(ident string) reflect.Type

func (*Scope) Var

func (s *Scope) Var(ident string) reflect.Value

Jump to

Keyboard shortcuts

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