dap

package
v1.3.5-alpha-0814 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnsupportedCommand int = 9999
	InternalError      int = 8888
	NotYetImplemented  int = 7777

	FailedToLaunch             = 3000
	FailedToAttach             = 3001
	FailedToInitialize         = 3002
	UnableToSetBreakpoints     = 2002
	UnableToDisplayThreads     = 2003
	UnableToProduceStackTrace  = 2004
	UnableToListLocals         = 2005
	UnableToListArgs           = 2006
	UnableToListGlobals        = 2007
	UnableToLookupVariable     = 2008
	UnableToEvaluateExpression = 2009
	UnableToHalt               = 2010
	UnableToGetExceptionInfo   = 2011
	UnableToSetVariable        = 2012
	UnableToDisassemble        = 2013
	UnableToListRegisters      = 2014
	UnableToRunDlvCommand      = 2015

	NoDebugIsRunning  = 3000
	DebuggeeIsRunning = 4000
	DisconnectError   = 5000
)
View Source
const (
	DAVersion = "0.1.0"
)
View Source
const (
	HelpInfo = `
h, help                          : show help info

`
)

Variables

View Source
var (
	SimpleYakTestCase   = "simple.yak"
	FuncCallTestcase    = "func_call.yak"
	IncrementTestcase   = "increment.yak"
	GoroutineTestcase   = "goroutine.yak"
	VariablesTestcase   = "variables.yak"
	StepAndNExtTestcase = "step_and_next.yak"
	// HardCodeBreakPointTestcase = "hardcode_breakpoint.yak"
	PanicTestcase = "panic.yak"
)

Functions

func GetYakTestCasePath

func GetYakTestCasePath(p string) string

Types

type Client

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

func NewTestClient

func NewTestClient(addr string) *Client

func NewTestClientFromConn

func NewTestClientFromConn(conn net.Conn) *Client

func (*Client) CheckConfigurationDoneResponse

func (c *Client) CheckConfigurationDoneResponse(t *testing.T, m dap.Message) *dap.ConfigurationDoneResponse

func (*Client) CheckContinueResponse

func (c *Client) CheckContinueResponse(t *testing.T, m dap.Message) *dap.ContinueResponse

func (*Client) CheckDisconnectResponse

func (c *Client) CheckDisconnectResponse(t *testing.T, m dap.Message) *dap.DisconnectResponse

func (*Client) CheckErrorResponse

func (c *Client) CheckErrorResponse(t *testing.T, m dap.Message) *dap.ErrorResponse

func (*Client) CheckEvaluateResponse

func (c *Client) CheckEvaluateResponse(t *testing.T, m dap.Message) *dap.EvaluateResponse

func (*Client) CheckExceptionInfoResponse

func (c *Client) CheckExceptionInfoResponse(t *testing.T, m dap.Message) *dap.ExceptionInfoResponse

func (*Client) CheckInitializeResponse

func (c *Client) CheckInitializeResponse(t *testing.T, m dap.Message) *dap.InitializeResponse

func (*Client) CheckInitializedEvent

func (c *Client) CheckInitializedEvent(t *testing.T, m dap.Message) *dap.InitializedEvent

func (*Client) CheckLaunchResponse

func (c *Client) CheckLaunchResponse(t *testing.T, m dap.Message) *dap.LaunchResponse

func (*Client) CheckNextResponse

func (c *Client) CheckNextResponse(t *testing.T, m dap.Message) *dap.NextResponse

func (*Client) CheckOutputEvent

func (c *Client) CheckOutputEvent(t *testing.T, m dap.Message) *dap.OutputEvent

func (*Client) CheckScopesResponse

func (c *Client) CheckScopesResponse(t *testing.T, m dap.Message) *dap.ScopesResponse

func (*Client) CheckSetBreakpointsResponse

func (c *Client) CheckSetBreakpointsResponse(t *testing.T, m dap.Message) *dap.SetBreakpointsResponse

func (*Client) CheckSetExceptionBreakpointsResponse

func (c *Client) CheckSetExceptionBreakpointsResponse(t *testing.T, m dap.Message) *dap.SetExceptionBreakpointsResponse

func (*Client) CheckSetExpressionResponse

func (c *Client) CheckSetExpressionResponse(t *testing.T, m dap.Message) *dap.SetExpressionResponse

func (*Client) CheckSetVariableResponse

func (c *Client) CheckSetVariableResponse(t *testing.T, m dap.Message) *dap.SetVariableResponse

func (*Client) CheckStackTraceResponse

func (c *Client) CheckStackTraceResponse(t *testing.T, m dap.Message) *dap.StackTraceResponse

func (*Client) CheckStepInResponse

func (c *Client) CheckStepInResponse(t *testing.T, m dap.Message) *dap.StepInResponse

func (*Client) CheckStepOutResponse

func (c *Client) CheckStepOutResponse(t *testing.T, m dap.Message) *dap.StepOutResponse

func (*Client) CheckStopLocation

func (c *Client) CheckStopLocation(t *testing.T, thread int, name string, line int)

func (*Client) CheckStoppedEvent

func (c *Client) CheckStoppedEvent(t *testing.T, m dap.Message) *dap.StoppedEvent

func (*Client) CheckTerminatedEvent

func (c *Client) CheckTerminatedEvent(t *testing.T, m dap.Message) *dap.TerminatedEvent

func (*Client) CheckThreadsResponse

func (c *Client) CheckThreadsResponse(t *testing.T, m dap.Message) *dap.ThreadsResponse

func (*Client) CheckVariablesResponse

func (c *Client) CheckVariablesResponse(t *testing.T, m dap.Message) *dap.VariablesResponse

func (*Client) Close

func (c *Client) Close()

func (*Client) ConfigurationDoneRequest

func (c *Client) ConfigurationDoneRequest()

func (*Client) ContinueRequest

func (c *Client) ContinueRequest(thread int)

func (*Client) DisconnectRequest

func (c *Client) DisconnectRequest()

func (*Client) EvaluateRequest

func (c *Client) EvaluateRequest(expr string, fid int, context string)

func (*Client) ExceptionInfoRequest

func (c *Client) ExceptionInfoRequest(threadID int)

func (*Client) ExpectConfigurationDoneResponse

func (c *Client) ExpectConfigurationDoneResponse(t *testing.T) *dap.ConfigurationDoneResponse

func (*Client) ExpectContinueResponse

func (c *Client) ExpectContinueResponse(t *testing.T) *dap.ContinueResponse

func (*Client) ExpectDisconnectResponse

func (c *Client) ExpectDisconnectResponse(t *testing.T) *dap.DisconnectResponse

func (*Client) ExpectErrorResponse

func (c *Client) ExpectErrorResponse(t *testing.T) *dap.ErrorResponse

func (*Client) ExpectEvaluateResponse

func (c *Client) ExpectEvaluateResponse(t *testing.T) *dap.EvaluateResponse

func (*Client) ExpectExceptionInfoResponse

func (c *Client) ExpectExceptionInfoResponse(t *testing.T) *dap.ExceptionInfoResponse

func (*Client) ExpectInitializeResponse

func (c *Client) ExpectInitializeResponse(t *testing.T) *dap.InitializeResponse

func (*Client) ExpectInitializeResponseAndCapabilities

func (c *Client) ExpectInitializeResponseAndCapabilities(t *testing.T) *dap.InitializeResponse

func (*Client) ExpectInitializedEvent

func (c *Client) ExpectInitializedEvent(t *testing.T) *dap.InitializedEvent

func (*Client) ExpectInvisibleErrorResponse

func (c *Client) ExpectInvisibleErrorResponse(t *testing.T) *dap.ErrorResponse

func (*Client) ExpectLaunchResponse

func (c *Client) ExpectLaunchResponse(t *testing.T) *dap.LaunchResponse

func (*Client) ExpectMessage

func (c *Client) ExpectMessage(t *testing.T) dap.Message

func (*Client) ExpectNextResponse

func (c *Client) ExpectNextResponse(t *testing.T) *dap.NextResponse

func (*Client) ExpectOutputEvent

func (c *Client) ExpectOutputEvent(t *testing.T) *dap.OutputEvent

func (*Client) ExpectOutputEventDetaching

func (c *Client) ExpectOutputEventDetaching(t *testing.T) *dap.OutputEvent

func (*Client) ExpectOutputEventHelpInfo

func (c *Client) ExpectOutputEventHelpInfo(t *testing.T) *dap.OutputEvent

func (*Client) ExpectOutputEventRegex

func (c *Client) ExpectOutputEventRegex(t *testing.T, want string) *dap.OutputEvent

func (*Client) ExpectScopesResponse

func (c *Client) ExpectScopesResponse(t *testing.T) *dap.ScopesResponse

func (*Client) ExpectSetBreakpointsResponse

func (c *Client) ExpectSetBreakpointsResponse(t *testing.T) *dap.SetBreakpointsResponse

func (*Client) ExpectSetExceptionBreakpointsResponse

func (c *Client) ExpectSetExceptionBreakpointsResponse(t *testing.T) *dap.SetExceptionBreakpointsResponse

func (*Client) ExpectSetExpressionResponse

func (c *Client) ExpectSetExpressionResponse(t *testing.T) *dap.SetExpressionResponse

func (*Client) ExpectSetVariableResponse

func (c *Client) ExpectSetVariableResponse(t *testing.T) *dap.SetVariableResponse

func (*Client) ExpectStackTraceResponse

func (c *Client) ExpectStackTraceResponse(t *testing.T) *dap.StackTraceResponse

func (*Client) ExpectStepInResponse

func (c *Client) ExpectStepInResponse(t *testing.T) *dap.StepInResponse

func (*Client) ExpectStepOutResponse

func (c *Client) ExpectStepOutResponse(t *testing.T) *dap.StepOutResponse

func (*Client) ExpectStoppedEvent

func (c *Client) ExpectStoppedEvent(t *testing.T) *dap.StoppedEvent

func (*Client) ExpectTerminatedEvent

func (c *Client) ExpectTerminatedEvent(t *testing.T) *dap.TerminatedEvent

func (*Client) ExpectThreadsResponse

func (c *Client) ExpectThreadsResponse(t *testing.T) *dap.ThreadsResponse

func (*Client) ExpectVariablesResponse

func (c *Client) ExpectVariablesResponse(t *testing.T) *dap.VariablesResponse

func (*Client) InitializeRequest

func (c *Client) InitializeRequest()

func (*Client) LaunchRequest

func (c *Client) LaunchRequest(mode, program string, stopOnEntry bool)

func (*Client) NextRequest

func (c *Client) NextRequest(thread int)

func (*Client) PauseRequest

func (c *Client) PauseRequest(threadId int)

func (*Client) ReadMessage

func (c *Client) ReadMessage() (dap.Message, error)

func (*Client) ScopesRequest

func (c *Client) ScopesRequest(frameID int)

func (*Client) SetBreakpointsRequest

func (c *Client) SetBreakpointsRequest(file string, lines []int)

func (*Client) SetBreakpointsRequestWithArgs

func (c *Client) SetBreakpointsRequestWithArgs(file string, lines []int, conditions, hitConditions, logMessages map[int]string)

func (*Client) SetExceptionBreakpointsRequest

func (c *Client) SetExceptionBreakpointsRequest()

func (*Client) SetExpressionRequest

func (c *Client) SetExpressionRequest()

func (*Client) SetVariableRequest

func (c *Client) SetVariableRequest(variablesRef int, name, value string)

func (*Client) StackTraceRequest

func (c *Client) StackTraceRequest(threadID, startFrame, levels int)

func (*Client) StepInRequest

func (c *Client) StepInRequest(thread int)

func (*Client) StepOutRequest

func (c *Client) StepOutRequest(thread int)

func (*Client) ThreadsRequest

func (c *Client) ThreadsRequest()

func (*Client) VariablesRequest

func (c *Client) VariablesRequest(variablesReference int)

type DAPDebugger

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

func NewDAPDebugger

func NewDAPDebugger() *DAPDebugger

func (*DAPDebugger) AddObserveBreakPoint

func (d *DAPDebugger) AddObserveBreakPoint(expr string) error

func (*DAPDebugger) AddObserveExpression

func (d *DAPDebugger) AddObserveExpression(expr string) error

func (*DAPDebugger) AddVariableRef

func (d *DAPDebugger) AddVariableRef(v interface{}) int

func (*DAPDebugger) CallBack

func (d *DAPDebugger) CallBack() func(g *yakvm.Debugger)

func (*DAPDebugger) ClearOtherBreakPoints

func (d *DAPDebugger) ClearOtherBreakPoints(path string, existLines []int)

func (*DAPDebugger) Continue

func (d *DAPDebugger) Continue()

func (*DAPDebugger) CurrentFrameID

func (d *DAPDebugger) CurrentFrameID() int

func (*DAPDebugger) CurrentThreadID

func (d *DAPDebugger) CurrentThreadID() int

func (*DAPDebugger) EvalExpression

func (d *DAPDebugger) EvalExpression(expr string, frameID int) (*yakvm.Value, error)

func (*DAPDebugger) ExistBreakPoint

func (d *DAPDebugger) ExistBreakPoint(path string, lineIndex int) (*yakvm.Breakpoint, bool)

func (*DAPDebugger) ForceSetVariableRef

func (d *DAPDebugger) ForceSetVariableRef(id int, v interface{})

func (*DAPDebugger) GetAllObserveExpressions

func (d *DAPDebugger) GetAllObserveExpressions() map[string]*yakvm.Value

func (*DAPDebugger) GetScopes

func (d *DAPDebugger) GetScopes(frameID int) map[int]*yakvm.Scope

func (*DAPDebugger) GetStackTraces

func (d *DAPDebugger) GetStackTraces() map[int]*yakvm.StackTraces

func (*DAPDebugger) GetThreads

func (d *DAPDebugger) GetThreads() []*Thread

func (*DAPDebugger) GetVariablesByReference

func (d *DAPDebugger) GetVariablesByReference(ref int) (interface{}, bool)

func (*DAPDebugger) GetVariablesReference

func (d *DAPDebugger) GetVariablesReference(v interface{}) (int, bool)

func (*DAPDebugger) Halt

func (d *DAPDebugger) Halt() error

func (*DAPDebugger) InCallbackState

func (d *DAPDebugger) InCallbackState()

func (*DAPDebugger) Init

func (d *DAPDebugger) Init() func(g *yakvm.Debugger)

func (*DAPDebugger) InitWGAdd

func (d *DAPDebugger) InitWGAdd()

func (*DAPDebugger) IsFinished

func (d *DAPDebugger) IsFinished() bool

func (*DAPDebugger) OutCallbackState

func (d *DAPDebugger) OutCallbackState()

func (*DAPDebugger) RemoveObserveBreakPoint

func (d *DAPDebugger) RemoveObserveBreakPoint(expr string) error

func (*DAPDebugger) RemoveObserveExpression

func (d *DAPDebugger) RemoveObserveExpression(expr string) error

func (*DAPDebugger) Restart

func (d *DAPDebugger) Restart() bool

func (*DAPDebugger) SetBreakPoint

func (d *DAPDebugger) SetBreakPoint(path string, lineIndex int, condition, hitCondition string) (int, error)

func (*DAPDebugger) SetDescription

func (d *DAPDebugger) SetDescription(desc string)

func (*DAPDebugger) SetRestart

func (d *DAPDebugger) SetRestart(b bool)

func (*DAPDebugger) StepIn

func (d *DAPDebugger) StepIn() error

func (*DAPDebugger) StepNext

func (d *DAPDebugger) StepNext() error

func (*DAPDebugger) StepOut

func (d *DAPDebugger) StepOut() error

func (*DAPDebugger) VMPanic

func (d *DAPDebugger) VMPanic() *yakvm.VMPanic

func (*DAPDebugger) WaitInit

func (d *DAPDebugger) WaitInit()

func (*DAPDebugger) WaitProgramStart

func (d *DAPDebugger) WaitProgramStart()

type DAPServer

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

func NewDAPServer

func NewDAPServer(config *DAPServerConfig) *DAPServer

func StartDAPServer

func StartDAPServer(ip string, port any) (*DAPServer, chan struct{}, error)

func (*DAPServer) Start

func (s *DAPServer) Start()

func (*DAPServer) Stop

func (s *DAPServer) Stop()

type DAPServerConfig

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

type DebugSession

type DebugSession struct {

	// wg
	LaunchWg sync.WaitGroup
	// contains filtered or unexported fields
}

func NewDebugSession

func NewDebugSession(conn net.Conn, config *DAPServerConfig) *DebugSession

func (*DebugSession) Close

func (ds *DebugSession) Close()

func (*DebugSession) ConvertVariable

func (ds *DebugSession) ConvertVariable(v interface{}) int

func (*DebugSession) GetConvertedVariable

func (ds *DebugSession) GetConvertedVariable(ref int) (interface{}, bool)

func (*DebugSession) GetConvertedVariableRef

func (ds *DebugSession) GetConvertedVariableRef(v interface{}) int

func (*DebugSession) GetEvaluateName

func (ds *DebugSession) GetEvaluateName(v interface{}) string

获取handleValue对应的ref,然后在从保存的dap.Variable中拿到变量名

func (*DebugSession) RunProgramInDebugMode

func (ds *DebugSession) RunProgramInDebugMode(request *dap.LaunchRequest, debug bool, program string, args []string)

func (*DebugSession) WaitProgramStart

func (ds *DebugSession) WaitProgramStart()

type GernerateFuncTyp

type GernerateFuncTyp func() (path string)

type LaunchConfig

type LaunchConfig struct {
	// Acceptable values are:
	//   "debug":
	//   "exec": executes a yak script and begins a debug session.
	// Default is "exec".
	Mode string `json:"mode,omitempty"`

	// Path to the program folder (or any go file within that folder)
	// when in `debug` or `test` mode, and to the pre-built binary file
	// to debug in `exec` mode.
	Program string `json:"program,omitempty"`

	// Command line arguments passed to the debugged program.
	// Relative paths used in Args will be interpreted as paths relative
	// to `cwd`.
	Args []string `json:"args,omitempty"`

	// Working directory of the program being debugged.
	// If a relative path is provided, it will be interpreted as
	// a relative path to Delve's working directory. This is
	Cwd string `json:"cwd,omitempty"`

	// NoDebug is used to run the program without debugging.
	NoDebug bool `json:"noDebug,omitempty"`

	// Env specifies optional environment variables for Delve server
	// in addition to the environment variables Delve initially
	// started with.
	// Variables with 'nil' values can be used to unset the named
	// environment variables.
	// Values are interpreted verbatim. Variable substitution or
	// reference to other environment variables is not supported.
	Env map[string]*string `json:"env,omitempty"`

	// The output mode specifies how to handle the program's output.
	OutputMode string `json:"outputMode,omitempty"`

	// Automatically stop program after launch or attach.
	StopOnEntry bool `json:"stopOnEntry,omitempty"`

	// StackTraceDepth is the maximum length of the returned list of stack frames.
	StackTraceDepth int `cfgName:"stackTraceDepth"`
}

LaunchConfig is the collection of launch request attributes recognized by DAP implementation.

type MapKey

type MapKey struct {
	Key    reflect.Value
	IKey   interface{}
	KeyStr string
}

type ScopeKV

type ScopeKV struct {
	Key   string
	Value *yakvm.Value
}

type Source

type Source struct {
	Name    string // 文件名
	AbsPath string // 完整路径
}

type Thread

type Thread struct {
	Id   int
	Name string
}

Jump to

Keyboard shortcuts

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