| 1 | package interpscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.21 context/" |
| 5 | "errorsscip-go gomod github.com/golang/go/src go1.21 errors/" |
| 6 | "fmtscip-go gomod github.com/golang/go/src go1.21 fmt/" |
| 7 | "go/tokenscip-go gomod github.com/golang/go/src go1.21 `go/token`/" |
| 8 | "reflectscip-go gomod github.com/golang/go/src go1.21 reflect/" |
| 9 | "sortscip-go gomod github.com/golang/go/src go1.21 sort/" |
| 10 | "syncscip-go gomod github.com/golang/go/src go1.21 sync/" |
| 11 | ) |
| 12 | |
| 13 | var ( |
| 14 | // ErrNotLive indicates that the specified ID does not refer to a (live) Go |
| 15 | // routine. |
| 16 | ErrNotLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/ErrNotLive. = errorsscip-go gomod github.com/golang/go/src go1.21 errors/.Newscip-go gomod github.com/golang/go/src go1.21 errors/New().("not live") |
| 17 | |
| 18 | // ErrRunning indicates that the specified Go routine is running. |
| 19 | ErrRunningscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/ErrRunning. = errorsscip-go gomod github.com/golang/go/src go1.21 errors/.Newscip-go gomod github.com/golang/go/src go1.21 errors/New().("running") |
| 20 | |
| 21 | // ErrNotRunning indicates that the specified Go routine is running. |
| 22 | ErrNotRunningscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/ErrNotRunning. = errorsscip-go gomod github.com/golang/go/src go1.21 errors/.Newscip-go gomod github.com/golang/go/src go1.21 errors/New().("not running") |
| 23 | ) |
| 24 | |
| 25 | var rNodeTypescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/rNodeType. = reflectscip-go gomod github.com/golang/go/src go1.21 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.21 reflect/TypeOf().((*nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#)(nil)).Elemscip-go gomod github.com/golang/go/src go1.21 reflect/Type#Elem().() |
| 26 | |
| 27 | // A Debugger can be used to debug a Yaegi program. |
| 28 | type Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger# struct { |
| 29 | interpscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#interp. *Interpreterscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter# |
| 30 | eventsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#events. func(*DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#) |
| 31 | contextscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#context. contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context# |
| 32 | cancelscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#cancel. contextscip-go gomod github.com/golang/go/src go1.21 context/.CancelFuncscip-go gomod github.com/golang/go/src go1.21 context/CancelFunc# |
| 33 | |
| 34 | gWaitscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gWait. *syncscip-go gomod github.com/golang/go/src go1.21 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.21 sync/WaitGroup# |
| 35 | gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock. *syncscip-go gomod github.com/golang/go/src go1.21 sync/.Mutexscip-go gomod github.com/golang/go/src go1.21 sync/Mutex# |
| 36 | gIDscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gID. int |
| 37 | gLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLive. map[int]*debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine# |
| 38 | |
| 39 | resultscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#result. reflectscip-go gomod github.com/golang/go/src go1.21 reflect/.Valuescip-go gomod github.com/golang/go/src go1.21 reflect/Value# |
| 40 | errscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#err. error |
| 41 | } |
| 42 | |
| 43 | // go routine debug state. |
| 44 | type debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine# struct { |
| 45 | idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#id. int |
| 46 | |
| 47 | modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. DebugEventReasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEventReason# |
| 48 | runningscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#running. bool |
| 49 | resumescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#resume. chan struct{} |
| 50 | |
| 51 | fDepthscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fDepth. int |
| 52 | fStepscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fStep. int |
| 53 | } |
| 54 | |
| 55 | // node debug state. |
| 56 | type nodeDebugDatascip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/nodeDebugData# struct { |
| 57 | programscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/nodeDebugData#program. *Programscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Program# |
| 58 | breakOnLinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/nodeDebugData#breakOnLine. bool |
| 59 | breakOnCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/nodeDebugData#breakOnCall. bool |
| 60 | } |
| 61 | |
| 62 | // frame debug state. |
| 63 | type frameDebugDatascip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData# struct { |
| 64 | gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g. *debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine# |
| 65 | nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#node. *nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node# |
| 66 | namescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#name. string |
| 67 | kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#kind. frameKindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameKind# |
| 68 | scopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#scope. *scopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/scope# |
| 69 | } |
| 70 | |
| 71 | // frame kind. |
| 72 | type frameKindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameKind# int |
| 73 | |
| 74 | const ( |
| 75 | // interpreter root frame. |
| 76 | frameRootscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameRoot. frameKindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameKind# = iota + 1 |
| 77 | |
| 78 | // function call frame. |
| 79 | frameCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameCall. |
| 80 | |
| 81 | // closure capture frame. |
| 82 | frameClosurescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameClosure. |
| 83 | ) |
| 84 | |
| 85 | // DebugOptions are the debugger options. |
| 86 | type DebugOptionsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugOptions# struct { |
| 87 | // If true, Go routine IDs start at 1 instead of 0. |
| 88 | GoRoutineStartAt1scip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugOptions#GoRoutineStartAt1. bool |
| 89 | } |
| 90 | |
| 91 | // A DebugEvent is an event generated by a debugger. |
| 92 | type DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent# struct { |
| 93 | debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#debugger. *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger# |
| 94 | reasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#reason. DebugEventReasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEventReason# |
| 95 | framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame. *framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame# |
| 96 | } |
| 97 | |
| 98 | // DebugFrame provides access to stack frame information while debugging a |
| 99 | // program. |
| 100 | type DebugFramescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame# struct { |
| 101 | eventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#event. *DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent# |
| 102 | framesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#frames. []*framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame# |
| 103 | } |
| 104 | |
| 105 | // DebugFrameScope provides access to scoped variables while debugging a |
| 106 | // program. |
| 107 | type DebugFrameScopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope# struct { |
| 108 | framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#frame. *framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame# |
| 109 | } |
| 110 | |
| 111 | // DebugVariable is the name and value of a variable from a debug session. |
| 112 | type DebugVariablescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugVariable# struct { |
| 113 | Namescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugVariable#Name. string |
| 114 | Valuescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugVariable#Value. reflectscip-go gomod github.com/golang/go/src go1.21 reflect/.Valuescip-go gomod github.com/golang/go/src go1.21 reflect/Value# |
| 115 | } |
| 116 | |
| 117 | // DebugGoRoutine provides access to information about a Go routine while |
| 118 | // debugging a program. |
| 119 | type DebugGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine# struct { |
| 120 | idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#id. int |
| 121 | } |
| 122 | |
| 123 | // Breakpoint is the result of attempting to set a breakpoint. |
| 124 | type Breakpointscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint# struct { |
| 125 | // Valid indicates whether the breakpoint was successfully set. |
| 126 | Validscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint#Valid. bool |
| 127 | |
| 128 | // Position indicates the source position of the breakpoint. |
| 129 | Positionscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint#Position. tokenscip-go gomod github.com/golang/go/src go1.21 `go/token`/.Positionscip-go gomod github.com/golang/go/src go1.21 `go/token`/Position# |
| 130 | } |
| 131 | |
| 132 | // DebugEventReason is the reason a debug event occurred. |
| 133 | type DebugEventReasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEventReason# int |
| 134 | |
| 135 | const ( |
| 136 | // continue execution normally. |
| 137 | debugRunscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRun. DebugEventReasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEventReason# = iota |
| 138 | |
| 139 | // DebugPause is emitted when a pause request is completed. Can be used with |
| 140 | // Interrupt to request a pause. |
| 141 | DebugPausescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugPause. |
| 142 | |
| 143 | // DebugBreak is emitted when a debug target hits a breakpoint. |
| 144 | DebugBreakscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugBreak. |
| 145 | |
| 146 | // DebugEntry is emitted when a debug target starts executing. Can be used |
| 147 | // with Step to produce a corresponding event when execution starts. |
| 148 | DebugEntryscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEntry. |
| 149 | |
| 150 | // DebugStepInto is emitted when a stepInto request is completed. Can be |
| 151 | // used with Step or Interrupt to request a stepInto. |
| 152 | DebugStepIntoscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugStepInto. |
| 153 | |
| 154 | // DebugStepOver is emitted when a stepOver request is completed. Can be |
| 155 | // used with Step or Interrupt to request a stepOver. |
| 156 | DebugStepOverscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugStepOver. |
| 157 | |
| 158 | // DebugStepOut is emitted when a stepOut request is completed. Can be used |
| 159 | // with Step or Interrupt to request a stepOut. |
| 160 | DebugStepOutscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugStepOut. |
| 161 | |
| 162 | // DebugTerminate is emitted when a debug target terminates. Can be used |
| 163 | // with Interrupt to attempt to terminate the program. |
| 164 | DebugTerminatescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugTerminate. |
| 165 | |
| 166 | // DebugEnterGoRoutine is emitted when a Go routine is entered. |
| 167 | DebugEnterGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEnterGoRoutine. |
| 168 | |
| 169 | // DebugExitGoRoutine is emitted when a Go routine is exited. |
| 170 | DebugExitGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugExitGoRoutine. |
| 171 | ) |
| 172 | |
| 173 | // Debug initializes a debugger for the given program. |
| 174 | // |
| 175 | // The program will not start running until Step or Continue has been called. If |
| 176 | // Step is called with DebugEntry, an entry event will be generated before the |
| 177 | // first statement is executed. Otherwise, the debugger will behave as usual. |
| 178 | func (interp *Interpreterscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#) Debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#Debug().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, prog *Programscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Program#, events func(*DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#), opts *DebugOptionsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugOptions#) *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger# { |
| 179 | dbg := new(Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) |
| 180 | dbg.interpscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#interp. = interp |
| 181 | dbg.eventsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#events. = events |
| 182 | dbg.contextscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#context., dbg.cancelscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#cancel. = contextscip-go gomod github.com/golang/go/src go1.21 context/.WithCancelscip-go gomod github.com/golang/go/src go1.21 context/WithCancel().(ctx) |
| 183 | dbg.gWaitscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gWait. = new(syncscip-go gomod github.com/golang/go/src go1.21 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.21 sync/WaitGroup#) |
| 184 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock. = new(syncscip-go gomod github.com/golang/go/src go1.21 sync/.Mutexscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#) |
| 185 | dbg.gLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLive. = make(map[int]*debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#, 1) |
| 186 | |
| 187 | if opts == nil { |
| 188 | opts = new(DebugOptionsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugOptions#) |
| 189 | } |
| 190 | if opts.GoRoutineStartAt1scip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugOptions#GoRoutineStartAt1. { |
| 191 | dbg.gIDscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gID. = 1 |
| 192 | } |
| 193 | |
| 194 | mainG := dbg.enterGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#enterGoRoutine().() |
| 195 | mainG.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. = DebugEntryscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEntry. |
| 196 | |
| 197 | interp.debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#debugger. = dbg |
| 198 | interp.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#frame..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. = &frameDebugDatascip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#{kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#kind.: frameRootscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameRoot., gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g.: mainG} |
| 199 | |
| 200 | prog.rootscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Program#root..Walkscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#Walk().(func(n *nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#) bool { |
| 201 | n.setProgramscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#setProgram().(prog) |
| 202 | return true |
| 203 | }, nil) |
| 204 | |
| 205 | go func() { |
| 206 | defer func() { interp.debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#debugger. = nil }() |
| 207 | defer events(&DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#{reasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#reason.: DebugTerminatescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugTerminate.}) |
| 208 | defer dbg.cancelscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#cancel.() |
| 209 | |
| 210 | <-mainG.resumescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#resume. |
| 211 | dbg.eventsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#events.(&DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#{dbg, DebugEnterGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEnterGoRoutine., interp.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#frame.}) |
| 212 | dbg.resultscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#result., dbg.errscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#err. = interp.ExecuteWithContextscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#ExecuteWithContext().(ctx, prog) |
| 213 | dbg.exitGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#exitGoRoutine().(mainG) |
| 214 | dbg.eventsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#events.(&DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#{dbg, DebugExitGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugExitGoRoutine., interp.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#frame.}) |
| 215 | dbg.gWaitscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gWait..Waitscip-go gomod github.com/golang/go/src go1.21 sync/WaitGroup#Wait().() |
| 216 | }() |
| 217 | |
| 218 | return dbg |
| 219 | } |
| 220 | |
| 221 | // Wait blocks until all Go routines launched by the program have terminated. |
| 222 | // Wait returns the results of `(*Interpreter).Execute`. |
| 223 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) Waitscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#Wait().() (reflectscip-go gomod github.com/golang/go/src go1.21 reflect/.Valuescip-go gomod github.com/golang/go/src go1.21 reflect/Value#, error) { |
| 224 | <-dbg.contextscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#context..Donescip-go gomod github.com/golang/go/src go1.21 context/Context#Done().() |
| 225 | return dbg.resultscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#result., dbg.errscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#err. |
| 226 | } |
| 227 | |
| 228 | // mark entry into a go routine. |
| 229 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) enterGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#enterGoRoutine().() *debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine# { |
| 230 | g := new(debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#) |
| 231 | g.resumescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#resume. = make(chan struct{}) |
| 232 | |
| 233 | dbg.gWaitscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gWait..Addscip-go gomod github.com/golang/go/src go1.21 sync/WaitGroup#Add().(1) |
| 234 | |
| 235 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Lockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Lock().() |
| 236 | g.idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#id. = dbg.gIDscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gID. |
| 237 | dbg.gIDscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gID.++ |
| 238 | dbg.gLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLive.[g.idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#id.] = g |
| 239 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Unlockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Unlock().() |
| 240 | |
| 241 | return g |
| 242 | } |
| 243 | |
| 244 | // mark exit from a go routine. |
| 245 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) exitGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#exitGoRoutine().(g *debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#) { |
| 246 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Lockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Lock().() |
| 247 | delete(dbg.gLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLive., g.idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#id.) |
| 248 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Unlockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Unlock().() |
| 249 | |
| 250 | dbg.gWaitscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gWait..Donescip-go gomod github.com/golang/go/src go1.21 sync/WaitGroup#Done().() |
| 251 | } |
| 252 | |
| 253 | // get the state for a given go routine, if it's live. |
| 254 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) getGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#getGoRoutine().(id int) (*debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#, bool) { |
| 255 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Lockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Lock().() |
| 256 | g, ok := dbg.gLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLive.[id] |
| 257 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Unlockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Unlock().() |
| 258 | return g, ok |
| 259 | } |
| 260 | |
| 261 | // mark entry into a function call. |
| 262 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) enterCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#enterCall().(nFunc, nCall *nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#, f *framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#) { |
| 263 | if f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. != nil { |
| 264 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g..fDepthscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fDepth.++ |
| 265 | return |
| 266 | } |
| 267 | |
| 268 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. = new(frameDebugDatascip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#) |
| 269 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g. = f.ancscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#anc..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g. |
| 270 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..scopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#scope. = nFunc.scopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#scope. |
| 271 | |
| 272 | switch nFunc.kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#kind. { |
| 273 | case funcLitscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/funcLit.: |
| 274 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#kind. = frameCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameCall. |
| 275 | |
| 276 | case funcDeclscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/funcDecl.: |
| 277 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#kind. = frameCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameCall. |
| 278 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..namescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#name. = nFunc.childscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#child.[1].identscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#ident. |
| 279 | } |
| 280 | |
| 281 | if nCall != nil && nCall.ancscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#anc..kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#kind. == goStmtscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/goStmt. { |
| 282 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g. = dbg.enterGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#enterGoRoutine().() |
| 283 | dbg.eventsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#events.(&DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#{dbg, DebugEnterGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEnterGoRoutine., f}) |
| 284 | } |
| 285 | |
| 286 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g..fDepthscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fDepth.++ |
| 287 | } |
| 288 | |
| 289 | // mark exit from a function call. |
| 290 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) exitCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#exitCall().(nFunc, nCall *nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#, f *framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#) { |
| 291 | _ = nFunc // ignore unused, so exitCall can have the same signature as enterCall |
| 292 | |
| 293 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g..fDepthscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fDepth.-- |
| 294 | |
| 295 | if nCall != nil && nCall.ancscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#anc..kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#kind. == goStmtscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/goStmt. { |
| 296 | dbg.exitGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#exitGoRoutine().(f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g.) |
| 297 | dbg.eventsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#events.(&DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#{dbg, DebugExitGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugExitGoRoutine., f}) |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | // called by the interpreter prior to executing the node. |
| 302 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) execscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#exec().(n *nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#, f *framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#) (stop bool) { |
| 303 | f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#node. = n |
| 304 | |
| 305 | if n != nil && n.posscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#pos. == tokenscip-go gomod github.com/golang/go/src go1.21 `go/token`/.NoPosscip-go gomod github.com/golang/go/src go1.21 `go/token`/NoPos. { |
| 306 | return false |
| 307 | } |
| 308 | |
| 309 | g := f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g. |
| 310 | defer func() { g.runningscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#running. = true }() |
| 311 | |
| 312 | e := &DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#{dbg, g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode., f} |
| 313 | switch { |
| 314 | case g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. == DebugTerminatescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugTerminate.: |
| 315 | dbg.cancelscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#cancel.() |
| 316 | return true |
| 317 | |
| 318 | case n.shouldBreakscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#shouldBreak().(): |
| 319 | e.reasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#reason. = DebugBreakscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugBreak. |
| 320 | |
| 321 | case g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. == debugRunscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRun.: |
| 322 | return false |
| 323 | |
| 324 | case g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. == DebugStepOutscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugStepOut.: |
| 325 | if g.fDepthscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fDepth. >= g.fStepscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fStep. { |
| 326 | return false |
| 327 | } |
| 328 | |
| 329 | case g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. == DebugStepOverscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugStepOver.: |
| 330 | if g.fDepthscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fDepth. > g.fStepscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fStep. { |
| 331 | return false |
| 332 | } |
| 333 | } |
| 334 | dbg.eventsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#events.(e) |
| 335 | |
| 336 | g.runningscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#running. = false |
| 337 | select { |
| 338 | case <-g.resumescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#resume.: |
| 339 | return false |
| 340 | case <-dbg.contextscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#context..Donescip-go gomod github.com/golang/go/src go1.21 context/Context#Done().(): |
| 341 | return true |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | // Continue continues execution of the specified Go routine. Continue returns |
| 346 | // ErrNotLive if there is no Go routine with the corresponding ID, or if it is not |
| 347 | // live. |
| 348 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) Continuescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#Continue().(id int) error { |
| 349 | g, ok := dbg.getGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#getGoRoutine().(id) |
| 350 | if !ok { |
| 351 | return ErrNotLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/ErrNotLive. |
| 352 | } |
| 353 | |
| 354 | g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. = debugRunscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRun. |
| 355 | g.resumescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#resume. <- struct{}{} |
| 356 | return nil |
| 357 | } |
| 358 | |
| 359 | // update the exec mode of this routine. |
| 360 | func (g *debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#) setModescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#setMode().(reason DebugEventReasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEventReason#) { |
| 361 | if g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. == DebugTerminatescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugTerminate. { |
| 362 | return |
| 363 | } |
| 364 | |
| 365 | if g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. == DebugEntryscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEntry. && reason == DebugEntryscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEntry. { |
| 366 | return |
| 367 | } |
| 368 | |
| 369 | switch reason { |
| 370 | case DebugStepIntoscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugStepInto., DebugStepOverscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugStepOver., DebugStepOutscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugStepOut.: |
| 371 | g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode., g.fStepscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fStep. = reason, g.fDepthscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#fDepth. |
| 372 | default: |
| 373 | g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. = DebugPausescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugPause. |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | // Step issues a stepInto, stepOver, or stepOut request to a stopped Go routine. |
| 378 | // Step returns ErrRunning if the Go routine is running. Step returns ErrNotLive |
| 379 | // if there is no Go routine with the corresponding ID, or if it is not live. |
| 380 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) Stepscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#Step().(id int, reason DebugEventReasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEventReason#) error { |
| 381 | g, ok := dbg.getGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#getGoRoutine().(id) |
| 382 | if !ok { |
| 383 | return ErrNotLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/ErrNotLive. |
| 384 | } |
| 385 | |
| 386 | if g.runningscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#running. { |
| 387 | return ErrRunningscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/ErrRunning. |
| 388 | } |
| 389 | |
| 390 | g.setModescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#setMode().(reason) |
| 391 | g.resumescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#resume. <- struct{}{} |
| 392 | return nil |
| 393 | } |
| 394 | |
| 395 | // Interrupt issues a stepInto, stepOver, or stepOut request to a running Go |
| 396 | // routine. Interrupt returns ErrRunning if the Go routine is running. Interrupt |
| 397 | // returns ErrNotLive if there is no Go routine with the corresponding ID, or if |
| 398 | // it is not live. |
| 399 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) Interruptscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#Interrupt().(id int, reason DebugEventReasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEventReason#) bool { |
| 400 | g, ok := dbg.getGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#getGoRoutine().(id) |
| 401 | if !ok { |
| 402 | return false |
| 403 | } |
| 404 | |
| 405 | g.setModescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#setMode().(reason) |
| 406 | return true |
| 407 | } |
| 408 | |
| 409 | // Terminate attempts to terminate the program. |
| 410 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) Terminatescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#Terminate().() { |
| 411 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Lockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Lock().() |
| 412 | g := dbg.gLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLive. |
| 413 | dbg.gLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLive. = nil |
| 414 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Unlockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Unlock().() |
| 415 | |
| 416 | for _, g := range g { |
| 417 | g.modescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#mode. = DebugTerminatescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugTerminate. |
| 418 | close(g.resumescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#resume.) |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | // BreakpointTarget is the target of a request to set breakpoints. |
| 423 | type BreakpointTargetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/BreakpointTarget# func(*Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#, func(*nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#)) |
| 424 | |
| 425 | // PathBreakpointTarget is used to set breapoints on compiled code by path. This |
| 426 | // can be used to set breakpoints on code compiled with EvalPath, or source |
| 427 | // packages loaded by Yaegi. |
| 428 | func PathBreakpointTargetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/PathBreakpointTarget().(path string) BreakpointTargetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/BreakpointTarget# { |
| 429 | return func(dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#, cb func(*nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#)) { |
| 430 | for _, r := range dbg.interpscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#interp..rootsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#roots. { |
| 431 | f := dbg.interpscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#interp..fsetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#fset..Filescip-go gomod github.com/golang/go/src go1.21 `go/token`/FileSet#File().(r.posscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#pos.) |
| 432 | if f != nil && f.Namescip-go gomod github.com/golang/go/src go1.21 `go/token`/File#Name().() == path { |
| 433 | cb(r) |
| 434 | return |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | // ProgramBreakpointTarget is used to set breakpoints on a Program. |
| 441 | func ProgramBreakpointTargetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/ProgramBreakpointTarget().(prog *Programscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Program#) BreakpointTargetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/BreakpointTarget# { |
| 442 | return func(_ *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#, cb func(*nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#)) { |
| 443 | cb(prog.rootscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Program#root.) |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | // AllBreakpointTarget is used to set breakpoints on all compiled code. Do not |
| 448 | // use with LineBreakpoint. |
| 449 | func AllBreakpointTargetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/AllBreakpointTarget().() BreakpointTargetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/BreakpointTarget# { |
| 450 | return func(dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#, cb func(*nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#)) { |
| 451 | for _, r := range dbg.interpscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#interp..rootsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#roots. { |
| 452 | cb(r) |
| 453 | } |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | type breakpointSetupscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup# struct { |
| 458 | rootsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#roots. []*nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node# |
| 459 | linesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#lines. map[int]int |
| 460 | funcsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#funcs. map[string]int |
| 461 | } |
| 462 | |
| 463 | // BreakpointRequest is a request to set a breakpoint. |
| 464 | type BreakpointRequestscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/BreakpointRequest# func(*breakpointSetupscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#, int) |
| 465 | |
| 466 | // LineBreakpoint requests a breakpoint on the given line. |
| 467 | func LineBreakpointscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/LineBreakpoint().(line int) BreakpointRequestscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/BreakpointRequest# { |
| 468 | return func(b *breakpointSetupscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#, i int) { |
| 469 | b.linesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#lines.[line] = i |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | // FunctionBreakpoint requests a breakpoint on the named function. |
| 474 | func FunctionBreakpointscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/FunctionBreakpoint().(name string) BreakpointRequestscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/BreakpointRequest# { |
| 475 | return func(b *breakpointSetupscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#, i int) { |
| 476 | b.funcsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#funcs.[name] = i |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | // SetBreakpoints sets breakpoints for the given target. The returned array has |
| 481 | // an entry for every request, in order. If a given breakpoint request cannot be |
| 482 | // satisfied, the corresponding entry will be marked invalid. If the target |
| 483 | // cannot be found, all entries will be marked invalid. |
| 484 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) SetBreakpointsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#SetBreakpoints().(target BreakpointTargetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/BreakpointTarget#, requests ...BreakpointRequestscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/BreakpointRequest#) []Breakpointscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint# { |
| 485 | // start with all breakpoints unverified |
| 486 | results := make([]Breakpointscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint#, len(requests)) |
| 487 | |
| 488 | // prepare all the requests |
| 489 | setup := new(breakpointSetupscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#) |
| 490 | target(dbg, func(root *nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#) { |
| 491 | setup.rootsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#roots. = append(setup.rootsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#roots., root) |
| 492 | setup.linesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#lines. = make(map[int]int, len(requests)) |
| 493 | setup.funcsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#funcs. = make(map[string]int, len(requests)) |
| 494 | for i, rq := range requests { |
| 495 | rq(setup, i) |
| 496 | } |
| 497 | }) |
| 498 | |
| 499 | // find breakpoints |
| 500 | for _, root := range setup.rootsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#roots. { |
| 501 | root.Walkscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#Walk().(func(n *nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#) bool { |
| 502 | // function breakpoints |
| 503 | if len(setup.funcsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#funcs.) > 0 && n.kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#kind. == funcDeclscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/funcDecl. { |
| 504 | // reset stale breakpoints |
| 505 | n.startscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#start..setBreakOnCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#setBreakOnCall().(false) |
| 506 | |
| 507 | if i, ok := setup.funcsscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#funcs.[n.childscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#child.[1].identscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#ident.]; ok && !results[i].Validscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint#Valid. { |
| 508 | results[i].Validscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint#Valid. = true |
| 509 | results[i].Positionscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint#Position. = dbg.interpscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#interp..fsetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#fset..Positionscip-go gomod github.com/golang/go/src go1.21 `go/token`/FileSet#Position().(n.startscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#start..posscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#pos.) |
| 510 | n.startscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#start..setBreakOnCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#setBreakOnCall().(true) |
| 511 | return true |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | // line breakpoints |
| 516 | if len(setup.linesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#lines.) > 0 && n.posscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#pos..IsValidscip-go gomod github.com/golang/go/src go1.21 `go/token`/Pos#IsValid().() && n.actionscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#action. != aNopscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/aNop. && getExecscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/getExec().(n) != nil { |
| 517 | // reset stale breakpoints |
| 518 | n.setBreakOnLinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#setBreakOnLine().(false) |
| 519 | |
| 520 | pos := dbg.interpscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#interp..fsetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#fset..Positionscip-go gomod github.com/golang/go/src go1.21 `go/token`/FileSet#Position().(n.posscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#pos.) |
| 521 | if i, ok := setup.linesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/breakpointSetup#lines.[pos.Linescip-go gomod github.com/golang/go/src go1.21 `go/token`/Position#Line.]; ok && !results[i].Validscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint#Valid. { |
| 522 | results[i].Validscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint#Valid. = true |
| 523 | results[i].Positionscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Breakpoint#Position. = pos |
| 524 | n.setBreakOnLinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#setBreakOnLine().(true) |
| 525 | return true |
| 526 | } |
| 527 | } |
| 528 | |
| 529 | return true |
| 530 | }, nil) |
| 531 | } |
| 532 | |
| 533 | return results |
| 534 | } |
| 535 | |
| 536 | // GoRoutines returns an array of live Go routines. |
| 537 | func (dbg *Debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#) GoRoutinesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#GoRoutines().() []*DebugGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine# { |
| 538 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Lockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Lock().() |
| 539 | r := make([]*DebugGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#, 0, len(dbg.gLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLive.)) |
| 540 | for id := range dbg.gLivescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLive. { |
| 541 | r = append(r, &DebugGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#{id}) |
| 542 | } |
| 543 | dbg.gLockscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#gLock..Unlockscip-go gomod github.com/golang/go/src go1.21 sync/Mutex#Unlock().() |
| 544 | sortscip-go gomod github.com/golang/go/src go1.21 sort/.Slicescip-go gomod github.com/golang/go/src go1.21 sort/Slice().(r, func(i, j int) bool { return r[i].idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#id. < r[j].idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#id. }) |
| 545 | return r |
| 546 | } |
| 547 | |
| 548 | // ID returns the ID of the Go routine. |
| 549 | func (r *DebugGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#) IDscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#ID().() int { return r.idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#id. } |
| 550 | |
| 551 | // Name returns "Goroutine {ID}". |
| 552 | func (r *DebugGoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#) Namescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#Name().() string { return fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("Goroutine %d", r.idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugGoRoutine#id.) } |
| 553 | |
| 554 | // GoRoutine returns the ID of the Go routine that generated the event. |
| 555 | func (evt *DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#) GoRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#GoRoutine().() int { |
| 556 | if evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. == nil { |
| 557 | return 0 |
| 558 | } |
| 559 | return evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g..idscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine#id. |
| 560 | } |
| 561 | |
| 562 | // Reason returns the reason for the event. |
| 563 | func (evt *DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#) Reasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#Reason().() DebugEventReasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEventReason# { |
| 564 | return evt.reasonscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#reason. |
| 565 | } |
| 566 | |
| 567 | // Walk the stack trace frames. The root frame is included if and only if it is |
| 568 | // the only frame. Closure frames are rolled up into the following call frame. |
| 569 | func (evt *DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#) walkFramesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#walkFrames().(fn func([]*framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#) bool) { |
| 570 | if evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame. == evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame..rootscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#root. { |
| 571 | fn([]*framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#{evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame.}) |
| 572 | return |
| 573 | } |
| 574 | |
| 575 | var g *debugRoutinescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/debugRoutine# |
| 576 | if evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. != nil { |
| 577 | g = evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g. |
| 578 | } |
| 579 | |
| 580 | var frames []*framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame# |
| 581 | for f := evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame.; f != nil && f != f.rootscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#root. && (f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. == nil || f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..gscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#g. == g); f = f.ancscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#anc. { |
| 582 | if f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. == nil || f.debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#kind. != frameCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameCall. { |
| 583 | frames = append(frames, f) |
| 584 | continue |
| 585 | } |
| 586 | |
| 587 | if len(frames) > 0 { |
| 588 | if !fn(frames) { |
| 589 | return |
| 590 | } |
| 591 | } |
| 592 | |
| 593 | frames = frames[:0] |
| 594 | frames = append(frames, f) |
| 595 | } |
| 596 | |
| 597 | if len(frames) > 0 { |
| 598 | fn(frames) |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | // FrameDepth returns the number of call frames in the stack trace. |
| 603 | func (evt *DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#) FrameDepthscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#FrameDepth().() int { |
| 604 | if evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame. == evt.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#frame..rootscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#root. { |
| 605 | return 1 |
| 606 | } |
| 607 | |
| 608 | var n int |
| 609 | evt.walkFramesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#walkFrames().(func([]*framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#) bool { n++; return true }) |
| 610 | return n |
| 611 | } |
| 612 | |
| 613 | // Frames returns the call frames in the range [start, end). |
| 614 | func (evt *DebugEventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#) Framesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#Frames().(start, end int) []*DebugFramescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame# { |
| 615 | count := end - start |
| 616 | if count < 0 { |
| 617 | return nil |
| 618 | } |
| 619 | |
| 620 | frames := []*DebugFramescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#{} |
| 621 | evt.walkFramesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#walkFrames().(func(f []*framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#) bool { |
| 622 | df := &DebugFramescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#{evt, make([]*framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#, len(f))} |
| 623 | copy(df.framesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#frames., f) |
| 624 | frames = append(frames, df) |
| 625 | return len(frames) < count |
| 626 | }) |
| 627 | return frames |
| 628 | } |
| 629 | |
| 630 | // Name returns the name of the stack frame. For function calls to named |
| 631 | // functions, this is the function name. |
| 632 | func (f *DebugFramescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#) Namescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#Name().() string { |
| 633 | d := f.framesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#frames.[0].debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. |
| 634 | if d == nil { |
| 635 | return "<unknown>" |
| 636 | } |
| 637 | switch d.kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#kind. { |
| 638 | case frameRootscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameRoot.: |
| 639 | return "<init>" |
| 640 | case frameClosurescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameClosure.: |
| 641 | return "<closure>" |
| 642 | case frameCallscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameCall.: |
| 643 | if d.namescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#name. == "" { |
| 644 | return "<anonymous>" |
| 645 | } |
| 646 | return d.namescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#name. |
| 647 | default: |
| 648 | return "<unknown>" |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | // Position returns the current position of the frame. This is effectively the |
| 653 | // program counter/link register. May return `Position{}`. |
| 654 | func (f *DebugFramescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#) Positionscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#Position().() tokenscip-go gomod github.com/golang/go/src go1.21 `go/token`/.Positionscip-go gomod github.com/golang/go/src go1.21 `go/token`/Position# { |
| 655 | d := f.framesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#frames.[0].debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. |
| 656 | if d == nil || d.nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#node. == nil { |
| 657 | return tokenscip-go gomod github.com/golang/go/src go1.21 `go/token`/.Positionscip-go gomod github.com/golang/go/src go1.21 `go/token`/Position#{} |
| 658 | } |
| 659 | return f.eventscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#event..debuggerscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugEvent#debugger..interpscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Debugger#interp..fsetscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Interpreter#fset..Positionscip-go gomod github.com/golang/go/src go1.21 `go/token`/FileSet#Position().(d.nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#node..posscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#pos.) |
| 660 | } |
| 661 | |
| 662 | // Program returns the program associated with the current position of the |
| 663 | // frame. May return nil. |
| 664 | func (f *DebugFramescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#) Programscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#Program().() *Programscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/Program# { |
| 665 | d := f.framesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#frames.[0].debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. |
| 666 | if d == nil || d.nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#node. == nil { |
| 667 | return nil |
| 668 | } |
| 669 | |
| 670 | return d.nodescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#node..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/node#debug..programscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/nodeDebugData#program. |
| 671 | } |
| 672 | |
| 673 | // Scopes returns the variable scopes of the frame. |
| 674 | func (f *DebugFramescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#) Scopesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#Scopes().() []*DebugFrameScopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope# { |
| 675 | s := make([]*DebugFrameScopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#, len(f.framesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#frames.)) |
| 676 | for i, f := range f.framesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrame#frames. { |
| 677 | s[i] = &DebugFrameScopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#{f} |
| 678 | } |
| 679 | return s |
| 680 | } |
| 681 | |
| 682 | // IsClosure returns true if this is the capture scope of a closure. |
| 683 | func (f *DebugFrameScopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#) IsClosurescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#IsClosure().() bool { |
| 684 | return f.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#frame..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. != nil && f.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#frame..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug..kindscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#kind. == frameClosurescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameClosure. |
| 685 | } |
| 686 | |
| 687 | // Variables returns the names and values of the variables of the scope. |
| 688 | func (f *DebugFrameScopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#) Variablesscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#Variables().() []*DebugVariablescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugVariable# { |
| 689 | d := f.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#frame..debugscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#debug. |
| 690 | if d == nil || d.scopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#scope. == nil { |
| 691 | return nil |
| 692 | } |
| 693 | |
| 694 | index := map[int]string{} |
| 695 | scanScopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/scanScope().(d.scopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frameDebugData#scope., index) |
| 696 | |
| 697 | m := make([]*DebugVariablescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugVariable#, 0, len(f.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#frame..datascip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#data.)) |
| 698 | for i, v := range f.framescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugFrameScope#frame..datascip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/frame#data. { |
| 699 | if typ := v.Typescip-go gomod github.com/golang/go/src go1.21 reflect/Value#Type().(); typ.AssignableToscip-go gomod github.com/golang/go/src go1.21 reflect/Type#AssignableTo().(rNodeTypescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/rNodeType.) || typ.Kindscip-go gomod github.com/golang/go/src go1.21 reflect/Type#Kind().() == reflectscip-go gomod github.com/golang/go/src go1.21 reflect/.Ptrscip-go gomod github.com/golang/go/src go1.21 reflect/Ptr. && typ.Elemscip-go gomod github.com/golang/go/src go1.21 reflect/Type#Elem().().AssignableToscip-go gomod github.com/golang/go/src go1.21 reflect/Type#AssignableTo().(rNodeTypescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/rNodeType.) { |
| 700 | continue |
| 701 | } |
| 702 | name, ok := index[i] |
| 703 | if !ok { |
| 704 | continue |
| 705 | } |
| 706 | |
| 707 | m = append(m, &DebugVariablescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/DebugVariable#{name, v}) |
| 708 | } |
| 709 | return m |
| 710 | } |
| 711 | |
| 712 | func scanScopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/scanScope().(sc *scopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/scope#, index map[int]string) { |
| 713 | for name, sym := range sc.symscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/scope#sym. { |
| 714 | if _, ok := index[sym.indexscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/symbol#index.]; ok { |
| 715 | continue |
| 716 | } |
| 717 | index[sym.indexscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/symbol#index.] = name |
| 718 | } |
| 719 | |
| 720 | for _, ch := range sc.childscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/scope#child. { |
| 721 | if ch.defscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/scope#def. != sc.defscip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/scope#def. { |
| 722 | continue |
| 723 | } |
| 724 | scanScopescip-go gomod github.com/traefik/yaegi . `github.com/traefik/yaegi/interp`/scanScope().(ch, index) |
| 725 | } |
| 726 | } |