debug

package
v0.190.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Overview

Package debug exports debug information for gopls.

Index

Constants

View Source
const (
	PlainText = PrintMode(iota)
	Markdown
	HTML
)

Variables

View Source
var Version = "master"

Version is a manually-updated mechanism for tracking versions.

Functions

func PrintVersionInfo

func PrintVersionInfo(w io.Writer, verbose bool, mode PrintMode)

PrintVersionInfo writes version and environment information to w, using the output format specified by mode. verbose controls whether additional information is written, including section headers.

func WithInstance

func WithInstance(ctx context.Context, workdir, agent string) context.Context

WithInstance creates debug instance ready for use using the supplied configuration and stores it in the returned context.

Types

type Cache

type Cache interface {
	ID() string
	FileSet() *token.FileSet
	MemStats() map[reflect.Type]int
}

A Cache is an in-memory cache.

type Client

type Client interface {
	ID() string
	// MODIFIED: SYSL_LSP
	//Session() Session
	DebugAddress() string
	Logfile() string
	ServerID() string
}

A Client is an incoming connection from a remote client.

type File

type File struct {
	Session Session
	URI     span.URI
	Data    string
	Error   error
	Hash    string
}

A File is is a file within a session.

type Instance

type Instance struct {
	Logfile              string
	StartTime            time.Time
	ServerAddress        string
	DebugAddress         string
	ListenedDebugAddress string
	Workdir              string
	OCAgentConfig        string

	LogWriter io.Writer

	State *State
	// contains filtered or unexported fields
}

An Instance holds all debug information associated with a gopls instance.

func GetInstance

func GetInstance(ctx context.Context) *Instance

func (*Instance) MonitorMemory

func (i *Instance) MonitorMemory(ctx context.Context)

MonitorMemory starts recording memory statistics each second.

func (*Instance) PrintServerInfo

func (i *Instance) PrintServerInfo(w io.Writer)

PrintServerInfo writes HTML debug info to w for the Instance.

func (*Instance) Serve

func (i *Instance) Serve(ctx context.Context) error

Serve starts and runs a debug server in the background. It also logs the port the server starts on, to allow for :0 auto assigned ports.

func (*Instance) SetLogFile

func (i *Instance) SetLogFile(logfile string) (func(), error)

SetLogFile sets the logfile for use with this instance.

type PrintMode

type PrintMode int

type Server

type Server interface {
	ID() string
	DebugAddress() string
	Logfile() string
	ClientID() string
}

A Server is an outgoing connection to a remote LSP server.

type Session

type Session interface {
	ID() string
	Cache() Cache
	Files() []*File
	File(hash string) *File
}

A Session is an LSP serving session.

type State

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

State holds debugging information related to the server state.

func (*State) AddCache

func (st *State) AddCache(cache Cache)

AddCache adds a cache to the set being served.

func (*State) AddClient

func (st *State) AddClient(client Client)

AddClient adds a client to the set being served.

func (*State) AddServer

func (st *State) AddServer(server Server)

AddServer adds a server to the set being queried. In practice, there should be at most one remote server.

func (*State) AddSession

func (st *State) AddSession(session Session)

AddSession adds a session to the set being served.

func (*State) AddView

func (st *State) AddView(view View)

AddView adds a view to the set being served.

func (*State) Caches

func (st *State) Caches() []Cache

Caches returns the set of Cache objects currently being served.

func (*State) Clients

func (st *State) Clients() []Client

Clients returns the set of Clients currently being served.

func (*State) DropCache

func (st *State) DropCache(cache Cache)

DropCache drops a cache from the set being served.

func (*State) DropClient

func (st *State) DropClient(client Client)

DropClient adds a client to the set being served.

func (*State) DropServer

func (st *State) DropServer(server Server)

DropServer drops a server to the set being queried.

func (*State) DropSession

func (st *State) DropSession(session Session)

DropSession drops a session from the set being served.

func (*State) DropView

func (st *State) DropView(view View)

DropView drops a view from the set being served.

func (*State) Servers

func (st *State) Servers() []Server

Servers returns the set of Servers the instance is currently connected to.

func (*State) Sessions

func (st *State) Sessions() []Session

Sessions returns the set of Session objects currently being served.

func (*State) Views

func (st *State) Views() []View

Views returns the set of View objects currently being served.

type View

type View interface {
	ID() string
	Name() string
	Folder() span.URI
	Session() Session
}

A View is a root directory within a Session.

Jump to

Keyboard shortcuts

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