Documentation
¶
Overview ¶
Package debugger implements source-level debugger policy and orchestration over a retained VM execution.
Index ¶
- type Breakpoint
- type BreakpointBindingMode
- type BreakpointID
- type BreakpointOptions
- type Config
- type Event
- type FormatOptions
- type Frame
- type Location
- type Reason
- type Session
- func (s *Session) Breakpoints() []Breakpoint
- func (s *Session) Close() error
- func (s *Session) Continue(ctx context.Context) (*Event, error)
- func (s *Session) DeleteBreakpoint(id BreakpointID) error
- func (s *Session) Evaluate(ctx context.Context, expression string) (Value, error)
- func (s *Session) Frames() ([]Frame, error)
- func (s *Session) Locals() ([]Variable, error)
- func (s *Session) Next(ctx context.Context) (*Event, error)
- func (s *Session) Out(ctx context.Context) (*Event, error)
- func (s *Session) Pause() error
- func (s *Session) SetBreakpoint(file string, line int) (Breakpoint, error)
- func (s *Session) SetBreakpointAt(location SourceLocation, opts BreakpointOptions) (Breakpoint, error)
- func (s *Session) Start(ctx context.Context) (*Event, error)
- func (s *Session) Step(ctx context.Context) (*Event, error)
- func (s *Session) Variables(reference ValueReference) ([]Variable, error)
- type SessionServices
- type SourceLocation
- type StateError
- type Value
- type ValueReference
- type Variable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Breakpoint ¶
type Breakpoint struct {
File string
RequestedLine int
RequestedColumn int
ID BreakpointID
PointID bytecode.DebugPointID
FunctionID int
Line int
Column int
BindingMode BreakpointBindingMode
Bound bool
}
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 )
type BreakpointID ¶
type BreakpointID int
BreakpointID identifies a breakpoint within one debugger session.
type BreakpointOptions ¶
type BreakpointOptions struct {
BindingMode BreakpointBindingMode
}
BreakpointOptions configures how a requested source location binds.
type Config ¶
type Config struct {
Execution vm.DebugExecution
Values vm.DebugValueAccess
Services SessionServices
Source *source.Source
DebugPoints []bytecode.DebugPoint
Params []string
Format FormatOptions
}
Config contains the dependencies for an advanced debugger session.
type Event ¶
type Event struct {
Error error
Output *encoding.Output
Reason Reason
HitBreakpointIDs []BreakpointID
Location Location
Depth int
}
Event reports a debugger stop, completion, or termination.
type FormatOptions ¶
FormatOptions bounds debugger value traversal and rendered output.
func DefaultFormatOptions ¶
func DefaultFormatOptions() FormatOptions
DefaultFormatOptions returns conservative debugger formatting limits.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session controls one retained-state source-level debug execution. Command calls are serialized. Pause is safe to call concurrently with a running command.
func NewSession ¶
NewSession creates an advanced debugger session from explicit dependencies.
func (*Session) Breakpoints ¶
func (s *Session) Breakpoints() []Breakpoint
Breakpoints returns a stable ID-ordered snapshot.
func (*Session) Close ¶
Close requests termination, then releases retained VM state and embedding-owned session resources after any active command exits.
func (*Session) Continue ¶
Continue resumes execution until a breakpoint, pause request, error, or completion.
func (*Session) DeleteBreakpoint ¶
func (s *Session) DeleteBreakpoint(id BreakpointID) error
DeleteBreakpoint removes a breakpoint by ID.
func (*Session) Evaluate ¶
Evaluate evaluates a conservative, side-effect-free expression against the paused top frame. It supports literals, locals, parameters, supported member reads, scalar arithmetic/comparisons, boolean logic, and conditionals. It rejects calls, queries, mutation, async/event behavior, and full collection execution.
func (*Session) Next ¶
Next stops at the next logical source location at the same or shallower call depth.
func (*Session) Out ¶
Out stops at the next logical source location in a caller. At main it runs to completion.
func (*Session) SetBreakpoint ¶
func (s *Session) SetBreakpoint(file string, line int) (Breakpoint, error)
SetBreakpoint adds a source-line breakpoint using the legacy friendly next-executable-in-file binding policy.
func (*Session) SetBreakpointAt ¶
func (s *Session) SetBreakpointAt(location SourceLocation, opts BreakpointOptions) (Breakpoint, error)
SetBreakpointAt adds a breakpoint at an explicit source location.
type SessionServices ¶
type SessionServices interface {
BeforeRun(context.Context) (context.Context, error)
AfterRun(context.Context, error) error
ExtendContext(context.Context) context.Context
Materialize(*vm.Result) (*encoding.Output, error)
Close() error
}
SessionServices supplies embedding-owned lifecycle and output behavior.
type SourceLocation ¶
SourceLocation identifies a requested location in debugger source. Line and Column are 1-based; Column 0 means no column was requested.
type StateError ¶
StateError reports a debugger command that is invalid for the current session state.
func (*StateError) Error ¶
func (e *StateError) Error() string
func (*StateError) Is ¶
func (e *StateError) Is(target error) bool
func (*StateError) Unwrap ¶
func (e *StateError) Unwrap() error
type Value ¶
type Value struct {
Type string
Display string
Reference ValueReference
}
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.
func (ValueReference) Valid ¶
func (r ValueReference) Valid() bool
Valid reports whether the reference can be used to request child variables.