package debug
import "cuelang.org/go/internal/golangorgx/gopls/debug"
Package debug exports debug information for gopls.
Index ¶
- Constants
- Variables
- func PrintVersionInfo(_ context.Context, w io.Writer, verbose bool, mode PrintMode) error
- func StdTrace(exporter event.Exporter) event.Exporter
- func WithInstance(ctx context.Context, agent string) context.Context
- type Client
- type Instance
- func GetInstance(ctx context.Context) *Instance
- func (i *Instance) AddService(s protocol.Server, session *cache.Session)
- func (i *Instance) DebugAddress() string
- func (i *Instance) ListenedDebugAddress() string
- func (i *Instance) PrintServerInfo(ctx context.Context, w io.Writer)
- func (i *Instance) Serve(ctx context.Context, addr string) (string, error)
- func (i *Instance) SetLogFile(logfile string, isDaemon bool) (func(), error)
- type PrintMode
- type Rpcs
- type Server
- type ServerVersion
- type State
- func (st *State) Analysis() (_ analysisTmpl)
- func (st *State) Bugs() []bug.Bug
- func (st *State) Cache(id string) *cache.Cache
- func (st *State) Caches() []*cache.Cache
- func (st *State) Client(id string) *Client
- func (st *State) Clients() []*Client
- func (st *State) Servers() []*Server
- func (st *State) Session(id string) *cache.Session
- func (st *State) Sessions() []*cache.Session
- func (st *State) View(id string) *cache.View
- func (st *State) Views() []*cache.View
- type TraceResults
Constants ¶
Variables ¶
var AnalysisTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 168 byte string literal not displayed */, ))
var BaseTemplate = template.Must(template.New("").Parse("" /* 935 byte string literal not displayed */, )).Funcs(template.FuncMap{ "fuint64": fuint64, "fuint32": fuint32, "fcontent": fcontent, "localAddress": func(s string) string { host, port, err := net.SplitHostPort(s) if err != nil { return s } ip := net.ParseIP(host) if ip == nil { return s } if ip.IsLoopback() || ip.IsUnspecified() { return "localhost:" + port } return s }, })
var CacheTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 335 byte string literal not displayed */, ))
var ClientTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 335 byte string literal not displayed */, ))
var DebugTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(` {{define "title"}}GoPls Debug pages{{end}} {{define "body"}} <a href="/debug/pprof">Profiling</a> {{end}} `))
var FileTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 282 byte string literal not displayed */, ))
var InfoTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(` {{define "title"}}Gopls version information{{end}} {{define "body"}} {{.}} {{end}} `))
var MainTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 612 byte string literal not displayed */, ))
var MemoryTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 1890 byte string literal not displayed */, ))
var RPCTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 717 byte string literal not displayed */, ))
var ServerTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 262 byte string literal not displayed */, ))
var SessionTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 568 byte string literal not displayed */, ))
var TraceTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse("" /* 1269 byte string literal not displayed */, ))
TraceTmpl extends BaseTemplate and renders a TraceResults, e.g. from getData().
Functions ¶
func PrintVersionInfo ¶
PrintVersionInfo writes version information to w, using the output format specified by mode. verbose controls whether additional information is written, including section headers.
func StdTrace ¶
func WithInstance ¶
WithInstance creates debug instance ready for use using the supplied configuration and stores it in the returned context.
Types ¶
type Client ¶
type Client struct { Session *cache.Session DebugAddress string Logfile string GoplsPath string ServerID string Service protocol.Server }
A Client is an incoming connection from a remote client.
type Instance ¶
type Instance struct { Logfile string StartTime time.Time ServerAddress 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 (*Instance) AddService ¶
func (*Instance) DebugAddress ¶
func (*Instance) ListenedDebugAddress ¶
func (*Instance) PrintServerInfo ¶
PrintServerInfo writes HTML debug info to w for the Instance.
func (*Instance) Serve ¶
Serve starts and runs a debug server in the background on the given addr. It also logs the port the server starts on, to allow for :0 auto assigned ports.
func (*Instance) SetLogFile ¶
SetLogFile sets the logfile for use with this instance.
type PrintMode ¶
type PrintMode int
type Rpcs ¶
type Rpcs struct { Inbound []*rpcStats // stats for incoming lsp rpcs sorted by method name Outbound []*rpcStats // stats for outgoing lsp rpcs sorted by method name // contains filtered or unexported fields }
func (*Rpcs) ProcessEvent ¶
type Server ¶
type Server struct { ID string DebugAddress string Logfile string GoplsPath string ClientID string }
A Server is an outgoing connection to a remote LSP server.
type ServerVersion ¶
ServerVersion is the format used by gopls to report its version to the client. This format is structured so that the client can parse it easily.
func VersionInfo ¶
func VersionInfo() *ServerVersion
VersionInfo returns the build info for the gopls process. If it was not built in module mode, we return a GOPATH-specific message with the hardcoded version.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State holds debugging information related to the server state.
func (*State) Analysis ¶
func (st *State) Analysis() (_ analysisTmpl)
Analysis returns the global Analysis template value.
func (*State) Bugs ¶
func (*State) Cache ¶
Cache returns the Cache that matches the supplied id.
func (*State) Caches ¶
Caches returns the set of Cache objects currently being served.
func (*State) Client ¶
Client returns the Client matching the supplied id.
func (*State) Clients ¶
Clients returns the set of Clients currently being served.
func (*State) Servers ¶
Servers returns the set of Servers the instance is currently connected to.
func (*State) Session ¶
Session returns the Session that matches the supplied id.
func (*State) Sessions ¶
Sessions returns the set of Session objects currently being served.
func (*State) View ¶
View returns the View that matches the supplied id.
func (*State) Views ¶
Views returns the set of View objects currently being served.
type TraceResults ¶
type TraceResults struct { Traces []*traceSet Selected *traceSet Recent []spanStartEnd }
A TraceResults is the subject for the /trace HTML template.
Source Files ¶
info.go metrics.go rpc.go serve.go trace.go
Directories ¶
Path | Synopsis |
---|---|
internal/golangorgx/gopls/debug/log | Package log provides helper methods for exporting log events to the internal/event package. |
- Version
- v0.12.0 (latest)
- Published
- Jan 30, 2025
- Platform
- linux/amd64
- Imports
- 36 packages
- Last checked
- 7 hours ago –
Tools for package owners.