package debugger
import (
"fmt"
"github.com/chromedp/cdproto/runtime"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
type BreakpointID string
func (t BreakpointID ) String () string {
return string (t )
}
type CallFrameID string
func (t CallFrameID ) String () string {
return string (t )
}
type Location struct {
ScriptID runtime .ScriptID `json:"scriptId"`
LineNumber int64 `json:"lineNumber"`
ColumnNumber int64 `json:"columnNumber,omitempty"`
}
type ScriptPosition struct {
LineNumber int64 `json:"lineNumber"`
ColumnNumber int64 `json:"columnNumber"`
}
type LocationRange struct {
ScriptID runtime .ScriptID `json:"scriptId"`
Start *ScriptPosition `json:"start"`
End *ScriptPosition `json:"end"`
}
type CallFrame struct {
CallFrameID CallFrameID `json:"callFrameId"`
FunctionName string `json:"functionName"`
FunctionLocation *Location `json:"functionLocation,omitempty"`
Location *Location `json:"location"`
ScopeChain []*Scope `json:"scopeChain"`
This *runtime .RemoteObject `json:"this"`
ReturnValue *runtime .RemoteObject `json:"returnValue,omitempty"`
CanBeRestarted bool `json:"canBeRestarted,omitempty"`
}
type Scope struct {
Type ScopeType `json:"type"`
Object *runtime .RemoteObject `json:"object"`
Name string `json:"name,omitempty"`
StartLocation *Location `json:"startLocation,omitempty"`
EndLocation *Location `json:"endLocation,omitempty"`
}
type SearchMatch struct {
LineNumber float64 `json:"lineNumber"`
LineContent string `json:"lineContent"`
}
type BreakLocation struct {
ScriptID runtime .ScriptID `json:"scriptId"`
LineNumber int64 `json:"lineNumber"`
ColumnNumber int64 `json:"columnNumber,omitempty"`
Type BreakLocationType `json:"type,omitempty"`
}
type WasmDisassemblyChunk struct {
Lines []string `json:"lines"`
BytecodeOffsets []int64 `json:"bytecodeOffsets"`
}
type ScriptLanguage string
func (t ScriptLanguage ) String () string {
return string (t )
}
const (
ScriptLanguageJavaScript ScriptLanguage = "JavaScript"
ScriptLanguageWebAssembly ScriptLanguage = "WebAssembly"
)
func (t ScriptLanguage ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t ScriptLanguage ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *ScriptLanguage ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch ScriptLanguage (v ) {
case ScriptLanguageJavaScript :
*t = ScriptLanguageJavaScript
case ScriptLanguageWebAssembly :
*t = ScriptLanguageWebAssembly
default :
in .AddError (fmt .Errorf ("unknown ScriptLanguage value: %v" , v ))
}
}
func (t *ScriptLanguage ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
type DebugSymbols struct {
Type DebugSymbolsType `json:"type"`
ExternalURL string `json:"externalURL,omitempty"`
}
type ScopeType string
func (t ScopeType ) String () string {
return string (t )
}
const (
ScopeTypeGlobal ScopeType = "global"
ScopeTypeLocal ScopeType = "local"
ScopeTypeWith ScopeType = "with"
ScopeTypeClosure ScopeType = "closure"
ScopeTypeCatch ScopeType = "catch"
ScopeTypeBlock ScopeType = "block"
ScopeTypeScript ScopeType = "script"
ScopeTypeEval ScopeType = "eval"
ScopeTypeModule ScopeType = "module"
ScopeTypeWasmExpressionStack ScopeType = "wasm-expression-stack"
)
func (t ScopeType ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t ScopeType ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *ScopeType ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch ScopeType (v ) {
case ScopeTypeGlobal :
*t = ScopeTypeGlobal
case ScopeTypeLocal :
*t = ScopeTypeLocal
case ScopeTypeWith :
*t = ScopeTypeWith
case ScopeTypeClosure :
*t = ScopeTypeClosure
case ScopeTypeCatch :
*t = ScopeTypeCatch
case ScopeTypeBlock :
*t = ScopeTypeBlock
case ScopeTypeScript :
*t = ScopeTypeScript
case ScopeTypeEval :
*t = ScopeTypeEval
case ScopeTypeModule :
*t = ScopeTypeModule
case ScopeTypeWasmExpressionStack :
*t = ScopeTypeWasmExpressionStack
default :
in .AddError (fmt .Errorf ("unknown ScopeType value: %v" , v ))
}
}
func (t *ScopeType ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
type BreakLocationType string
func (t BreakLocationType ) String () string {
return string (t )
}
const (
BreakLocationTypeDebuggerStatement BreakLocationType = "debuggerStatement"
BreakLocationTypeCall BreakLocationType = "call"
BreakLocationTypeReturn BreakLocationType = "return"
)
func (t BreakLocationType ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t BreakLocationType ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *BreakLocationType ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch BreakLocationType (v ) {
case BreakLocationTypeDebuggerStatement :
*t = BreakLocationTypeDebuggerStatement
case BreakLocationTypeCall :
*t = BreakLocationTypeCall
case BreakLocationTypeReturn :
*t = BreakLocationTypeReturn
default :
in .AddError (fmt .Errorf ("unknown BreakLocationType value: %v" , v ))
}
}
func (t *BreakLocationType ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
type DebugSymbolsType string
func (t DebugSymbolsType ) String () string {
return string (t )
}
const (
DebugSymbolsTypeNone DebugSymbolsType = "None"
DebugSymbolsTypeSourceMap DebugSymbolsType = "SourceMap"
DebugSymbolsTypeEmbeddedDWARF DebugSymbolsType = "EmbeddedDWARF"
DebugSymbolsTypeExternalDWARF DebugSymbolsType = "ExternalDWARF"
)
func (t DebugSymbolsType ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t DebugSymbolsType ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *DebugSymbolsType ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch DebugSymbolsType (v ) {
case DebugSymbolsTypeNone :
*t = DebugSymbolsTypeNone
case DebugSymbolsTypeSourceMap :
*t = DebugSymbolsTypeSourceMap
case DebugSymbolsTypeEmbeddedDWARF :
*t = DebugSymbolsTypeEmbeddedDWARF
case DebugSymbolsTypeExternalDWARF :
*t = DebugSymbolsTypeExternalDWARF
default :
in .AddError (fmt .Errorf ("unknown DebugSymbolsType value: %v" , v ))
}
}
func (t *DebugSymbolsType ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
type PausedReason string
func (t PausedReason ) String () string {
return string (t )
}
const (
PausedReasonAmbiguous PausedReason = "ambiguous"
PausedReasonAssert PausedReason = "assert"
PausedReasonCSPViolation PausedReason = "CSPViolation"
PausedReasonDebugCommand PausedReason = "debugCommand"
PausedReasonDOM PausedReason = "DOM"
PausedReasonEventListener PausedReason = "EventListener"
PausedReasonException PausedReason = "exception"
PausedReasonInstrumentation PausedReason = "instrumentation"
PausedReasonOOM PausedReason = "OOM"
PausedReasonOther PausedReason = "other"
PausedReasonPromiseRejection PausedReason = "promiseRejection"
PausedReasonXHR PausedReason = "XHR"
PausedReasonStep PausedReason = "step"
)
func (t PausedReason ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t PausedReason ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *PausedReason ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch PausedReason (v ) {
case PausedReasonAmbiguous :
*t = PausedReasonAmbiguous
case PausedReasonAssert :
*t = PausedReasonAssert
case PausedReasonCSPViolation :
*t = PausedReasonCSPViolation
case PausedReasonDebugCommand :
*t = PausedReasonDebugCommand
case PausedReasonDOM :
*t = PausedReasonDOM
case PausedReasonEventListener :
*t = PausedReasonEventListener
case PausedReasonException :
*t = PausedReasonException
case PausedReasonInstrumentation :
*t = PausedReasonInstrumentation
case PausedReasonOOM :
*t = PausedReasonOOM
case PausedReasonOther :
*t = PausedReasonOther
case PausedReasonPromiseRejection :
*t = PausedReasonPromiseRejection
case PausedReasonXHR :
*t = PausedReasonXHR
case PausedReasonStep :
*t = PausedReasonStep
default :
in .AddError (fmt .Errorf ("unknown PausedReason value: %v" , v ))
}
}
func (t *PausedReason ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
type ContinueToLocationTargetCallFrames string
func (t ContinueToLocationTargetCallFrames ) String () string {
return string (t )
}
const (
ContinueToLocationTargetCallFramesAny ContinueToLocationTargetCallFrames = "any"
ContinueToLocationTargetCallFramesCurrent ContinueToLocationTargetCallFrames = "current"
)
func (t ContinueToLocationTargetCallFrames ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t ContinueToLocationTargetCallFrames ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *ContinueToLocationTargetCallFrames ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch ContinueToLocationTargetCallFrames (v ) {
case ContinueToLocationTargetCallFramesAny :
*t = ContinueToLocationTargetCallFramesAny
case ContinueToLocationTargetCallFramesCurrent :
*t = ContinueToLocationTargetCallFramesCurrent
default :
in .AddError (fmt .Errorf ("unknown ContinueToLocationTargetCallFrames value: %v" , v ))
}
}
func (t *ContinueToLocationTargetCallFrames ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
type RestartFrameMode string
func (t RestartFrameMode ) String () string {
return string (t )
}
const (
RestartFrameModeStepInto RestartFrameMode = "StepInto"
)
func (t RestartFrameMode ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t RestartFrameMode ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *RestartFrameMode ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch RestartFrameMode (v ) {
case RestartFrameModeStepInto :
*t = RestartFrameModeStepInto
default :
in .AddError (fmt .Errorf ("unknown RestartFrameMode value: %v" , v ))
}
}
func (t *RestartFrameMode ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
type SetInstrumentationBreakpointInstrumentation string
func (t SetInstrumentationBreakpointInstrumentation ) String () string {
return string (t )
}
const (
SetInstrumentationBreakpointInstrumentationBeforeScriptExecution SetInstrumentationBreakpointInstrumentation = "beforeScriptExecution"
SetInstrumentationBreakpointInstrumentationBeforeScriptWithSourceMapExecution SetInstrumentationBreakpointInstrumentation = "beforeScriptWithSourceMapExecution"
)
func (t SetInstrumentationBreakpointInstrumentation ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t SetInstrumentationBreakpointInstrumentation ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *SetInstrumentationBreakpointInstrumentation ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch SetInstrumentationBreakpointInstrumentation (v ) {
case SetInstrumentationBreakpointInstrumentationBeforeScriptExecution :
*t = SetInstrumentationBreakpointInstrumentationBeforeScriptExecution
case SetInstrumentationBreakpointInstrumentationBeforeScriptWithSourceMapExecution :
*t = SetInstrumentationBreakpointInstrumentationBeforeScriptWithSourceMapExecution
default :
in .AddError (fmt .Errorf ("unknown SetInstrumentationBreakpointInstrumentation value: %v" , v ))
}
}
func (t *SetInstrumentationBreakpointInstrumentation ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
type ExceptionsState string
func (t ExceptionsState ) String () string {
return string (t )
}
const (
ExceptionsStateNone ExceptionsState = "none"
ExceptionsStateCaught ExceptionsState = "caught"
ExceptionsStateUncaught ExceptionsState = "uncaught"
ExceptionsStateAll ExceptionsState = "all"
)
func (t ExceptionsState ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t ExceptionsState ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *ExceptionsState ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch ExceptionsState (v ) {
case ExceptionsStateNone :
*t = ExceptionsStateNone
case ExceptionsStateCaught :
*t = ExceptionsStateCaught
case ExceptionsStateUncaught :
*t = ExceptionsStateUncaught
case ExceptionsStateAll :
*t = ExceptionsStateAll
default :
in .AddError (fmt .Errorf ("unknown ExceptionsState value: %v" , v ))
}
}
func (t *ExceptionsState ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
type SetScriptSourceStatus string
func (t SetScriptSourceStatus ) String () string {
return string (t )
}
const (
SetScriptSourceStatusOk SetScriptSourceStatus = "Ok"
SetScriptSourceStatusCompileError SetScriptSourceStatus = "CompileError"
SetScriptSourceStatusBlockedByActiveGenerator SetScriptSourceStatus = "BlockedByActiveGenerator"
SetScriptSourceStatusBlockedByActiveFunction SetScriptSourceStatus = "BlockedByActiveFunction"
SetScriptSourceStatusBlockedByTopLevelEsModuleChange SetScriptSourceStatus = "BlockedByTopLevelEsModuleChange"
)
func (t SetScriptSourceStatus ) MarshalEasyJSON (out *jwriter .Writer ) {
out .String (string (t ))
}
func (t SetScriptSourceStatus ) MarshalJSON () ([]byte , error ) {
return easyjson .Marshal (t )
}
func (t *SetScriptSourceStatus ) UnmarshalEasyJSON (in *jlexer .Lexer ) {
v := in .String ()
switch SetScriptSourceStatus (v ) {
case SetScriptSourceStatusOk :
*t = SetScriptSourceStatusOk
case SetScriptSourceStatusCompileError :
*t = SetScriptSourceStatusCompileError
case SetScriptSourceStatusBlockedByActiveGenerator :
*t = SetScriptSourceStatusBlockedByActiveGenerator
case SetScriptSourceStatusBlockedByActiveFunction :
*t = SetScriptSourceStatusBlockedByActiveFunction
case SetScriptSourceStatusBlockedByTopLevelEsModuleChange :
*t = SetScriptSourceStatusBlockedByTopLevelEsModuleChange
default :
in .AddError (fmt .Errorf ("unknown SetScriptSourceStatus value: %v" , v ))
}
}
func (t *SetScriptSourceStatus ) UnmarshalJSON (buf []byte ) error {
return easyjson .Unmarshal (buf , t )
}
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .