debugger

package
v1.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Breakpoint

type Breakpoint struct {
	Location          source.Range          `json:"location"`
	RequestedLocation source.Location       `json:"requestedLocation"`
	ID                BreakpointID          `json:"id"`
	PointID           PointID               `json:"pointID"`
	FunctionID        FunctionID            `json:"functionID"`
	BindingMode       BreakpointBindingMode `json:"bindingMode"`
	Bound             bool                  `json:"bound"`
}

Breakpoint describes a requested source-location breakpoint and its resolved executable location, when one exists.

type BreakpointBindingMode

type BreakpointBindingMode int

BreakpointBindingMode selects how a requested source location resolves to an executable debug point.

const (
	// BreakpointBindNextExecutableInFile preserves the friendly legacy binding
	// behavior and is the zero-value default.
	BreakpointBindNextExecutableInFile BreakpointBindingMode = iota
	BreakpointBindExact
	BreakpointBindNextExecutableInFunction
)

func BreakpointBindingModeFromString

func BreakpointBindingModeFromString(s string) BreakpointBindingMode

type BreakpointID

type BreakpointID int

BreakpointID identifies a breakpoint within one debugger session.

type BreakpointOptions

type BreakpointOptions struct {
	BindingMode BreakpointBindingMode `json:"bindingMode"`
}

BreakpointOptions configures how a requested source location binds.

type Event

type Event struct {
	Error            error          `json:"error"`
	Output           *result.Output `json:"output"`
	Reason           Reason         `json:"reason"`
	HitBreakpointIDs []BreakpointID `json:"hitBreakpointIDs"`
	Location         source.Range   `json:"location"`
	Depth            int            `json:"depth"`
}

Event reports a debugger stop, completion, or termination.

type Frame

type Frame struct {
	Name       string          `json:"name"`
	Location   source.Location `json:"location"`
	FunctionID FunctionID      `json:"functionID"`
}

Frame describes the paused top frame or one of its callers.

type FunctionID

type FunctionID int

type PointID

type PointID int

PointID identifies a debug point within one compiled program.

type Reason

type Reason string

Reason identifies why a debug execution stopped.

const (
	ReasonEntry        Reason = "entry"
	ReasonBreakpoint   Reason = "breakpoint"
	ReasonStep         Reason = "step"
	ReasonPause        Reason = "pause"
	ReasonRuntimeError Reason = "runtime-error"
	ReasonCompleted    Reason = "completed"
	ReasonTerminated   Reason = "terminated"
)

func ReasonFromString

func ReasonFromString(s string) Reason

type Session

type Session interface {
	io.Closer
	Start(ctx context.Context) (*Event, error)
	Continue(ctx context.Context) (*Event, error)
	Step(ctx context.Context) (*Event, error)
	Next(ctx context.Context) (*Event, error)
	Out(ctx context.Context) (*Event, error)
	Pause() error
	SetBreakpoint(pos source.Location) (Breakpoint, error)
	SetBreakpointAt(loc source.Location, opts BreakpointOptions) (Breakpoint, error)
	DeleteBreakpoint(id BreakpointID) error
	Breakpoints() []Breakpoint
	Frames() ([]Frame, error)
	Locals() ([]Variable, error)
	FrameLocals(frame int) ([]Variable, error)
	Variables(reference ValueReference) ([]Variable, error)
	Evaluate(ctx context.Context, expression string) (Value, error)
	EvaluateFrame(ctx context.Context, frame int, expression string) (Value, error)
}

type Value

type Value struct {
	Type      string         `json:"type"`
	Display   string         `json:"display"`
	Reference ValueReference `json:"reference"`
}

Value is a safely formatted debugger value.

type ValueReference

type ValueReference int

ValueReference identifies an expandable debugger value within one paused session state. References are invalidated when execution starts or resumes.

type Variable

type Variable struct {
	Name    string `json:"name"`
	Value   Value  `json:"value"`
	Mutable bool   `json:"mutable"`
	Param   bool   `json:"param"`
}

Variable describes a visible local or bind parameter.

Jump to

Keyboard shortcuts

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