How to use decorate method of is Package

Best Is code snippet using is.decorate

Run Is automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

starlark_mapping.go

Source: starlark_mapping.go Github

copy
1// DO NOT EDIT: auto-generated using _scripts/gen-starlark-bindings.go
2
3package starbind
4
5import (
6	"fmt"
7	"github.com/go-delve/delve/service/api"
8	"github.com/go-delve/delve/service/rpc2"
9	"go.starlark.net/starlark"
10)
11
12func (env *Env) starlarkPredeclare() starlark.StringDict {
13	r := starlark.StringDict{}
14
15	r["amend_breakpoint"] = starlark.NewBuiltin("amend_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
16		if err := isCancelled(thread); err != nil {
17			return starlark.None, decorateError(thread, err)
18		}
19		var rpcArgs rpc2.AmendBreakpointIn
20		var rpcRet rpc2.AmendBreakpointOut
21		if len(args) > 0 && args[0] != starlark.None {
22			err := unmarshalStarlarkValue(args[0], &rpcArgs.Breakpoint, "Breakpoint")
23			if err != nil {
24				return starlark.None, decorateError(thread, err)
25			}
26		}
27		for _, kv := range kwargs {
28			var err error
29			switch kv[0].(starlark.String) {
30			case "Breakpoint":
31				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Breakpoint, "Breakpoint")
32			default:
33				err = fmt.Errorf("unknown argument %q", kv[0])
34			}
35			if err != nil {
36				return starlark.None, decorateError(thread, err)
37			}
38		}
39		err := env.ctx.Client().CallAPI("AmendBreakpoint", &rpcArgs, &rpcRet)
40		if err != nil {
41			return starlark.None, err
42		}
43		return env.interfaceToStarlarkValue(rpcRet), nil
44	})
45	r["ancestors"] = starlark.NewBuiltin("ancestors", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
46		if err := isCancelled(thread); err != nil {
47			return starlark.None, decorateError(thread, err)
48		}
49		var rpcArgs rpc2.AncestorsIn
50		var rpcRet rpc2.AncestorsOut
51		if len(args) > 0 && args[0] != starlark.None {
52			err := unmarshalStarlarkValue(args[0], &rpcArgs.GoroutineID, "GoroutineID")
53			if err != nil {
54				return starlark.None, decorateError(thread, err)
55			}
56		}
57		if len(args) > 1 && args[1] != starlark.None {
58			err := unmarshalStarlarkValue(args[1], &rpcArgs.NumAncestors, "NumAncestors")
59			if err != nil {
60				return starlark.None, decorateError(thread, err)
61			}
62		}
63		if len(args) > 2 && args[2] != starlark.None {
64			err := unmarshalStarlarkValue(args[2], &rpcArgs.Depth, "Depth")
65			if err != nil {
66				return starlark.None, decorateError(thread, err)
67			}
68		}
69		for _, kv := range kwargs {
70			var err error
71			switch kv[0].(starlark.String) {
72			case "GoroutineID":
73				err = unmarshalStarlarkValue(kv[1], &rpcArgs.GoroutineID, "GoroutineID")
74			case "NumAncestors":
75				err = unmarshalStarlarkValue(kv[1], &rpcArgs.NumAncestors, "NumAncestors")
76			case "Depth":
77				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Depth, "Depth")
78			default:
79				err = fmt.Errorf("unknown argument %q", kv[0])
80			}
81			if err != nil {
82				return starlark.None, decorateError(thread, err)
83			}
84		}
85		err := env.ctx.Client().CallAPI("Ancestors", &rpcArgs, &rpcRet)
86		if err != nil {
87			return starlark.None, err
88		}
89		return env.interfaceToStarlarkValue(rpcRet), nil
90	})
91	r["attached_to_existing_process"] = starlark.NewBuiltin("attached_to_existing_process", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
92		if err := isCancelled(thread); err != nil {
93			return starlark.None, decorateError(thread, err)
94		}
95		var rpcArgs rpc2.AttachedToExistingProcessIn
96		var rpcRet rpc2.AttachedToExistingProcessOut
97		err := env.ctx.Client().CallAPI("AttachedToExistingProcess", &rpcArgs, &rpcRet)
98		if err != nil {
99			return starlark.None, err
100		}
101		return env.interfaceToStarlarkValue(rpcRet), nil
102	})
103	r["cancel_next"] = starlark.NewBuiltin("cancel_next", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
104		if err := isCancelled(thread); err != nil {
105			return starlark.None, decorateError(thread, err)
106		}
107		var rpcArgs rpc2.CancelNextIn
108		var rpcRet rpc2.CancelNextOut
109		err := env.ctx.Client().CallAPI("CancelNext", &rpcArgs, &rpcRet)
110		if err != nil {
111			return starlark.None, err
112		}
113		return env.interfaceToStarlarkValue(rpcRet), nil
114	})
115	r["checkpoint"] = starlark.NewBuiltin("checkpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
116		if err := isCancelled(thread); err != nil {
117			return starlark.None, decorateError(thread, err)
118		}
119		var rpcArgs rpc2.CheckpointIn
120		var rpcRet rpc2.CheckpointOut
121		if len(args) > 0 && args[0] != starlark.None {
122			err := unmarshalStarlarkValue(args[0], &rpcArgs.Where, "Where")
123			if err != nil {
124				return starlark.None, decorateError(thread, err)
125			}
126		}
127		for _, kv := range kwargs {
128			var err error
129			switch kv[0].(starlark.String) {
130			case "Where":
131				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Where, "Where")
132			default:
133				err = fmt.Errorf("unknown argument %q", kv[0])
134			}
135			if err != nil {
136				return starlark.None, decorateError(thread, err)
137			}
138		}
139		err := env.ctx.Client().CallAPI("Checkpoint", &rpcArgs, &rpcRet)
140		if err != nil {
141			return starlark.None, err
142		}
143		return env.interfaceToStarlarkValue(rpcRet), nil
144	})
145	r["clear_breakpoint"] = starlark.NewBuiltin("clear_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
146		if err := isCancelled(thread); err != nil {
147			return starlark.None, decorateError(thread, err)
148		}
149		var rpcArgs rpc2.ClearBreakpointIn
150		var rpcRet rpc2.ClearBreakpointOut
151		if len(args) > 0 && args[0] != starlark.None {
152			err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")
153			if err != nil {
154				return starlark.None, decorateError(thread, err)
155			}
156		}
157		if len(args) > 1 && args[1] != starlark.None {
158			err := unmarshalStarlarkValue(args[1], &rpcArgs.Name, "Name")
159			if err != nil {
160				return starlark.None, decorateError(thread, err)
161			}
162		}
163		for _, kv := range kwargs {
164			var err error
165			switch kv[0].(starlark.String) {
166			case "Id":
167				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")
168			case "Name":
169				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name")
170			default:
171				err = fmt.Errorf("unknown argument %q", kv[0])
172			}
173			if err != nil {
174				return starlark.None, decorateError(thread, err)
175			}
176		}
177		err := env.ctx.Client().CallAPI("ClearBreakpoint", &rpcArgs, &rpcRet)
178		if err != nil {
179			return starlark.None, err
180		}
181		return env.interfaceToStarlarkValue(rpcRet), nil
182	})
183	r["clear_checkpoint"] = starlark.NewBuiltin("clear_checkpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
184		if err := isCancelled(thread); err != nil {
185			return starlark.None, decorateError(thread, err)
186		}
187		var rpcArgs rpc2.ClearCheckpointIn
188		var rpcRet rpc2.ClearCheckpointOut
189		if len(args) > 0 && args[0] != starlark.None {
190			err := unmarshalStarlarkValue(args[0], &rpcArgs.ID, "ID")
191			if err != nil {
192				return starlark.None, decorateError(thread, err)
193			}
194		}
195		for _, kv := range kwargs {
196			var err error
197			switch kv[0].(starlark.String) {
198			case "ID":
199				err = unmarshalStarlarkValue(kv[1], &rpcArgs.ID, "ID")
200			default:
201				err = fmt.Errorf("unknown argument %q", kv[0])
202			}
203			if err != nil {
204				return starlark.None, decorateError(thread, err)
205			}
206		}
207		err := env.ctx.Client().CallAPI("ClearCheckpoint", &rpcArgs, &rpcRet)
208		if err != nil {
209			return starlark.None, err
210		}
211		return env.interfaceToStarlarkValue(rpcRet), nil
212	})
213	r["raw_command"] = starlark.NewBuiltin("raw_command", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
214		if err := isCancelled(thread); err != nil {
215			return starlark.None, decorateError(thread, err)
216		}
217		var rpcArgs api.DebuggerCommand
218		var rpcRet rpc2.CommandOut
219		if len(args) > 0 && args[0] != starlark.None {
220			err := unmarshalStarlarkValue(args[0], &rpcArgs.Name, "Name")
221			if err != nil {
222				return starlark.None, decorateError(thread, err)
223			}
224		}
225		if len(args) > 1 && args[1] != starlark.None {
226			err := unmarshalStarlarkValue(args[1], &rpcArgs.ThreadID, "ThreadID")
227			if err != nil {
228				return starlark.None, decorateError(thread, err)
229			}
230		}
231		if len(args) > 2 && args[2] != starlark.None {
232			err := unmarshalStarlarkValue(args[2], &rpcArgs.GoroutineID, "GoroutineID")
233			if err != nil {
234				return starlark.None, decorateError(thread, err)
235			}
236		}
237		if len(args) > 3 && args[3] != starlark.None {
238			err := unmarshalStarlarkValue(args[3], &rpcArgs.ReturnInfoLoadConfig, "ReturnInfoLoadConfig")
239			if err != nil {
240				return starlark.None, decorateError(thread, err)
241			}
242		} else {
243			cfg := env.ctx.LoadConfig()
244			rpcArgs.ReturnInfoLoadConfig = &cfg
245		}
246		if len(args) > 4 && args[4] != starlark.None {
247			err := unmarshalStarlarkValue(args[4], &rpcArgs.Expr, "Expr")
248			if err != nil {
249				return starlark.None, decorateError(thread, err)
250			}
251		}
252		if len(args) > 5 && args[5] != starlark.None {
253			err := unmarshalStarlarkValue(args[5], &rpcArgs.UnsafeCall, "UnsafeCall")
254			if err != nil {
255				return starlark.None, decorateError(thread, err)
256			}
257		}
258		for _, kv := range kwargs {
259			var err error
260			switch kv[0].(starlark.String) {
261			case "Name":
262				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name")
263			case "ThreadID":
264				err = unmarshalStarlarkValue(kv[1], &rpcArgs.ThreadID, "ThreadID")
265			case "GoroutineID":
266				err = unmarshalStarlarkValue(kv[1], &rpcArgs.GoroutineID, "GoroutineID")
267			case "ReturnInfoLoadConfig":
268				err = unmarshalStarlarkValue(kv[1], &rpcArgs.ReturnInfoLoadConfig, "ReturnInfoLoadConfig")
269			case "Expr":
270				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Expr, "Expr")
271			case "UnsafeCall":
272				err = unmarshalStarlarkValue(kv[1], &rpcArgs.UnsafeCall, "UnsafeCall")
273			default:
274				err = fmt.Errorf("unknown argument %q", kv[0])
275			}
276			if err != nil {
277				return starlark.None, decorateError(thread, err)
278			}
279		}
280		err := env.ctx.Client().CallAPI("Command", &rpcArgs, &rpcRet)
281		if err != nil {
282			return starlark.None, err
283		}
284		return env.interfaceToStarlarkValue(rpcRet), nil
285	})
286	r["create_breakpoint"] = starlark.NewBuiltin("create_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
287		if err := isCancelled(thread); err != nil {
288			return starlark.None, decorateError(thread, err)
289		}
290		var rpcArgs rpc2.CreateBreakpointIn
291		var rpcRet rpc2.CreateBreakpointOut
292		if len(args) > 0 && args[0] != starlark.None {
293			err := unmarshalStarlarkValue(args[0], &rpcArgs.Breakpoint, "Breakpoint")
294			if err != nil {
295				return starlark.None, decorateError(thread, err)
296			}
297		}
298		for _, kv := range kwargs {
299			var err error
300			switch kv[0].(starlark.String) {
301			case "Breakpoint":
302				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Breakpoint, "Breakpoint")
303			default:
304				err = fmt.Errorf("unknown argument %q", kv[0])
305			}
306			if err != nil {
307				return starlark.None, decorateError(thread, err)
308			}
309		}
310		err := env.ctx.Client().CallAPI("CreateBreakpoint", &rpcArgs, &rpcRet)
311		if err != nil {
312			return starlark.None, err
313		}
314		return env.interfaceToStarlarkValue(rpcRet), nil
315	})
316	r["create_watchpoint"] = starlark.NewBuiltin("create_watchpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
317		if err := isCancelled(thread); err != nil {
318			return starlark.None, decorateError(thread, err)
319		}
320		var rpcArgs rpc2.CreateWatchpointIn
321		var rpcRet rpc2.CreateWatchpointOut
322		if len(args) > 0 && args[0] != starlark.None {
323			err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")
324			if err != nil {
325				return starlark.None, decorateError(thread, err)
326			}
327		} else {
328			rpcArgs.Scope = env.ctx.Scope()
329		}
330		if len(args) > 1 && args[1] != starlark.None {
331			err := unmarshalStarlarkValue(args[1], &rpcArgs.Expr, "Expr")
332			if err != nil {
333				return starlark.None, decorateError(thread, err)
334			}
335		}
336		if len(args) > 2 && args[2] != starlark.None {
337			err := unmarshalStarlarkValue(args[2], &rpcArgs.Type, "Type")
338			if err != nil {
339				return starlark.None, decorateError(thread, err)
340			}
341		}
342		for _, kv := range kwargs {
343			var err error
344			switch kv[0].(starlark.String) {
345			case "Scope":
346				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")
347			case "Expr":
348				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Expr, "Expr")
349			case "Type":
350				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Type, "Type")
351			default:
352				err = fmt.Errorf("unknown argument %q", kv[0])
353			}
354			if err != nil {
355				return starlark.None, decorateError(thread, err)
356			}
357		}
358		err := env.ctx.Client().CallAPI("CreateWatchpoint", &rpcArgs, &rpcRet)
359		if err != nil {
360			return starlark.None, err
361		}
362		return env.interfaceToStarlarkValue(rpcRet), nil
363	})
364	r["detach"] = starlark.NewBuiltin("detach", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
365		if err := isCancelled(thread); err != nil {
366			return starlark.None, decorateError(thread, err)
367		}
368		var rpcArgs rpc2.DetachIn
369		var rpcRet rpc2.DetachOut
370		if len(args) > 0 && args[0] != starlark.None {
371			err := unmarshalStarlarkValue(args[0], &rpcArgs.Kill, "Kill")
372			if err != nil {
373				return starlark.None, decorateError(thread, err)
374			}
375		}
376		for _, kv := range kwargs {
377			var err error
378			switch kv[0].(starlark.String) {
379			case "Kill":
380				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Kill, "Kill")
381			default:
382				err = fmt.Errorf("unknown argument %q", kv[0])
383			}
384			if err != nil {
385				return starlark.None, decorateError(thread, err)
386			}
387		}
388		err := env.ctx.Client().CallAPI("Detach", &rpcArgs, &rpcRet)
389		if err != nil {
390			return starlark.None, err
391		}
392		return env.interfaceToStarlarkValue(rpcRet), nil
393	})
394	r["disassemble"] = starlark.NewBuiltin("disassemble", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
395		if err := isCancelled(thread); err != nil {
396			return starlark.None, decorateError(thread, err)
397		}
398		var rpcArgs rpc2.DisassembleIn
399		var rpcRet rpc2.DisassembleOut
400		if len(args) > 0 && args[0] != starlark.None {
401			err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")
402			if err != nil {
403				return starlark.None, decorateError(thread, err)
404			}
405		} else {
406			rpcArgs.Scope = env.ctx.Scope()
407		}
408		if len(args) > 1 && args[1] != starlark.None {
409			err := unmarshalStarlarkValue(args[1], &rpcArgs.StartPC, "StartPC")
410			if err != nil {
411				return starlark.None, decorateError(thread, err)
412			}
413		}
414		if len(args) > 2 && args[2] != starlark.None {
415			err := unmarshalStarlarkValue(args[2], &rpcArgs.EndPC, "EndPC")
416			if err != nil {
417				return starlark.None, decorateError(thread, err)
418			}
419		}
420		if len(args) > 3 && args[3] != starlark.None {
421			err := unmarshalStarlarkValue(args[3], &rpcArgs.Flavour, "Flavour")
422			if err != nil {
423				return starlark.None, decorateError(thread, err)
424			}
425		}
426		for _, kv := range kwargs {
427			var err error
428			switch kv[0].(starlark.String) {
429			case "Scope":
430				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")
431			case "StartPC":
432				err = unmarshalStarlarkValue(kv[1], &rpcArgs.StartPC, "StartPC")
433			case "EndPC":
434				err = unmarshalStarlarkValue(kv[1], &rpcArgs.EndPC, "EndPC")
435			case "Flavour":
436				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Flavour, "Flavour")
437			default:
438				err = fmt.Errorf("unknown argument %q", kv[0])
439			}
440			if err != nil {
441				return starlark.None, decorateError(thread, err)
442			}
443		}
444		err := env.ctx.Client().CallAPI("Disassemble", &rpcArgs, &rpcRet)
445		if err != nil {
446			return starlark.None, err
447		}
448		return env.interfaceToStarlarkValue(rpcRet), nil
449	})
450	r["dump_cancel"] = starlark.NewBuiltin("dump_cancel", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
451		if err := isCancelled(thread); err != nil {
452			return starlark.None, decorateError(thread, err)
453		}
454		var rpcArgs rpc2.DumpCancelIn
455		var rpcRet rpc2.DumpCancelOut
456		err := env.ctx.Client().CallAPI("DumpCancel", &rpcArgs, &rpcRet)
457		if err != nil {
458			return starlark.None, err
459		}
460		return env.interfaceToStarlarkValue(rpcRet), nil
461	})
462	r["dump_start"] = starlark.NewBuiltin("dump_start", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
463		if err := isCancelled(thread); err != nil {
464			return starlark.None, decorateError(thread, err)
465		}
466		var rpcArgs rpc2.DumpStartIn
467		var rpcRet rpc2.DumpStartOut
468		if len(args) > 0 && args[0] != starlark.None {
469			err := unmarshalStarlarkValue(args[0], &rpcArgs.Destination, "Destination")
470			if err != nil {
471				return starlark.None, decorateError(thread, err)
472			}
473		}
474		for _, kv := range kwargs {
475			var err error
476			switch kv[0].(starlark.String) {
477			case "Destination":
478				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Destination, "Destination")
479			default:
480				err = fmt.Errorf("unknown argument %q", kv[0])
481			}
482			if err != nil {
483				return starlark.None, decorateError(thread, err)
484			}
485		}
486		err := env.ctx.Client().CallAPI("DumpStart", &rpcArgs, &rpcRet)
487		if err != nil {
488			return starlark.None, err
489		}
490		return env.interfaceToStarlarkValue(rpcRet), nil
491	})
492	r["dump_wait"] = starlark.NewBuiltin("dump_wait", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
493		if err := isCancelled(thread); err != nil {
494			return starlark.None, decorateError(thread, err)
495		}
496		var rpcArgs rpc2.DumpWaitIn
497		var rpcRet rpc2.DumpWaitOut
498		if len(args) > 0 && args[0] != starlark.None {
499			err := unmarshalStarlarkValue(args[0], &rpcArgs.Wait, "Wait")
500			if err != nil {
501				return starlark.None, decorateError(thread, err)
502			}
503		}
504		for _, kv := range kwargs {
505			var err error
506			switch kv[0].(starlark.String) {
507			case "Wait":
508				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Wait, "Wait")
509			default:
510				err = fmt.Errorf("unknown argument %q", kv[0])
511			}
512			if err != nil {
513				return starlark.None, decorateError(thread, err)
514			}
515		}
516		err := env.ctx.Client().CallAPI("DumpWait", &rpcArgs, &rpcRet)
517		if err != nil {
518			return starlark.None, err
519		}
520		return env.interfaceToStarlarkValue(rpcRet), nil
521	})
522	r["eval"] = starlark.NewBuiltin("eval", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
523		if err := isCancelled(thread); err != nil {
524			return starlark.None, decorateError(thread, err)
525		}
526		var rpcArgs rpc2.EvalIn
527		var rpcRet rpc2.EvalOut
528		if len(args) > 0 && args[0] != starlark.None {
529			err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")
530			if err != nil {
531				return starlark.None, decorateError(thread, err)
532			}
533		} else {
534			rpcArgs.Scope = env.ctx.Scope()
535		}
536		if len(args) > 1 && args[1] != starlark.None {
537			err := unmarshalStarlarkValue(args[1], &rpcArgs.Expr, "Expr")
538			if err != nil {
539				return starlark.None, decorateError(thread, err)
540			}
541		}
542		if len(args) > 2 && args[2] != starlark.None {
543			err := unmarshalStarlarkValue(args[2], &rpcArgs.Cfg, "Cfg")
544			if err != nil {
545				return starlark.None, decorateError(thread, err)
546			}
547		} else {
548			cfg := env.ctx.LoadConfig()
549			rpcArgs.Cfg = &cfg
550		}
551		for _, kv := range kwargs {
552			var err error
553			switch kv[0].(starlark.String) {
554			case "Scope":
555				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")
556			case "Expr":
557				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Expr, "Expr")
558			case "Cfg":
559				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")
560			default:
561				err = fmt.Errorf("unknown argument %q", kv[0])
562			}
563			if err != nil {
564				return starlark.None, decorateError(thread, err)
565			}
566		}
567		err := env.ctx.Client().CallAPI("Eval", &rpcArgs, &rpcRet)
568		if err != nil {
569			return starlark.None, err
570		}
571		return env.interfaceToStarlarkValue(rpcRet), nil
572	})
573	r["examine_memory"] = starlark.NewBuiltin("examine_memory", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
574		if err := isCancelled(thread); err != nil {
575			return starlark.None, decorateError(thread, err)
576		}
577		var rpcArgs rpc2.ExamineMemoryIn
578		var rpcRet rpc2.ExaminedMemoryOut
579		if len(args) > 0 && args[0] != starlark.None {
580			err := unmarshalStarlarkValue(args[0], &rpcArgs.Address, "Address")
581			if err != nil {
582				return starlark.None, decorateError(thread, err)
583			}
584		}
585		if len(args) > 1 && args[1] != starlark.None {
586			err := unmarshalStarlarkValue(args[1], &rpcArgs.Length, "Length")
587			if err != nil {
588				return starlark.None, decorateError(thread, err)
589			}
590		}
591		for _, kv := range kwargs {
592			var err error
593			switch kv[0].(starlark.String) {
594			case "Address":
595				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Address, "Address")
596			case "Length":
597				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Length, "Length")
598			default:
599				err = fmt.Errorf("unknown argument %q", kv[0])
600			}
601			if err != nil {
602				return starlark.None, decorateError(thread, err)
603			}
604		}
605		err := env.ctx.Client().CallAPI("ExamineMemory", &rpcArgs, &rpcRet)
606		if err != nil {
607			return starlark.None, err
608		}
609		return env.interfaceToStarlarkValue(rpcRet), nil
610	})
611	r["find_location"] = starlark.NewBuiltin("find_location", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
612		if err := isCancelled(thread); err != nil {
613			return starlark.None, decorateError(thread, err)
614		}
615		var rpcArgs rpc2.FindLocationIn
616		var rpcRet rpc2.FindLocationOut
617		if len(args) > 0 && args[0] != starlark.None {
618			err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")
619			if err != nil {
620				return starlark.None, decorateError(thread, err)
621			}
622		} else {
623			rpcArgs.Scope = env.ctx.Scope()
624		}
625		if len(args) > 1 && args[1] != starlark.None {
626			err := unmarshalStarlarkValue(args[1], &rpcArgs.Loc, "Loc")
627			if err != nil {
628				return starlark.None, decorateError(thread, err)
629			}
630		}
631		if len(args) > 2 && args[2] != starlark.None {
632			err := unmarshalStarlarkValue(args[2], &rpcArgs.IncludeNonExecutableLines, "IncludeNonExecutableLines")
633			if err != nil {
634				return starlark.None, decorateError(thread, err)
635			}
636		}
637		if len(args) > 3 && args[3] != starlark.None {
638			err := unmarshalStarlarkValue(args[3], &rpcArgs.SubstitutePathRules, "SubstitutePathRules")
639			if err != nil {
640				return starlark.None, decorateError(thread, err)
641			}
642		}
643		for _, kv := range kwargs {
644			var err error
645			switch kv[0].(starlark.String) {
646			case "Scope":
647				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")
648			case "Loc":
649				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Loc, "Loc")
650			case "IncludeNonExecutableLines":
651				err = unmarshalStarlarkValue(kv[1], &rpcArgs.IncludeNonExecutableLines, "IncludeNonExecutableLines")
652			case "SubstitutePathRules":
653				err = unmarshalStarlarkValue(kv[1], &rpcArgs.SubstitutePathRules, "SubstitutePathRules")
654			default:
655				err = fmt.Errorf("unknown argument %q", kv[0])
656			}
657			if err != nil {
658				return starlark.None, decorateError(thread, err)
659			}
660		}
661		err := env.ctx.Client().CallAPI("FindLocation", &rpcArgs, &rpcRet)
662		if err != nil {
663			return starlark.None, err
664		}
665		return env.interfaceToStarlarkValue(rpcRet), nil
666	})
667	r["function_return_locations"] = starlark.NewBuiltin("function_return_locations", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
668		if err := isCancelled(thread); err != nil {
669			return starlark.None, decorateError(thread, err)
670		}
671		var rpcArgs rpc2.FunctionReturnLocationsIn
672		var rpcRet rpc2.FunctionReturnLocationsOut
673		if len(args) > 0 && args[0] != starlark.None {
674			err := unmarshalStarlarkValue(args[0], &rpcArgs.FnName, "FnName")
675			if err != nil {
676				return starlark.None, decorateError(thread, err)
677			}
678		}
679		for _, kv := range kwargs {
680			var err error
681			switch kv[0].(starlark.String) {
682			case "FnName":
683				err = unmarshalStarlarkValue(kv[1], &rpcArgs.FnName, "FnName")
684			default:
685				err = fmt.Errorf("unknown argument %q", kv[0])
686			}
687			if err != nil {
688				return starlark.None, decorateError(thread, err)
689			}
690		}
691		err := env.ctx.Client().CallAPI("FunctionReturnLocations", &rpcArgs, &rpcRet)
692		if err != nil {
693			return starlark.None, err
694		}
695		return env.interfaceToStarlarkValue(rpcRet), nil
696	})
697	r["get_breakpoint"] = starlark.NewBuiltin("get_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
698		if err := isCancelled(thread); err != nil {
699			return starlark.None, decorateError(thread, err)
700		}
701		var rpcArgs rpc2.GetBreakpointIn
702		var rpcRet rpc2.GetBreakpointOut
703		if len(args) > 0 && args[0] != starlark.None {
704			err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")
705			if err != nil {
706				return starlark.None, decorateError(thread, err)
707			}
708		}
709		if len(args) > 1 && args[1] != starlark.None {
710			err := unmarshalStarlarkValue(args[1], &rpcArgs.Name, "Name")
711			if err != nil {
712				return starlark.None, decorateError(thread, err)
713			}
714		}
715		for _, kv := range kwargs {
716			var err error
717			switch kv[0].(starlark.String) {
718			case "Id":
719				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")
720			case "Name":
721				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name")
722			default:
723				err = fmt.Errorf("unknown argument %q", kv[0])
724			}
725			if err != nil {
726				return starlark.None, decorateError(thread, err)
727			}
728		}
729		err := env.ctx.Client().CallAPI("GetBreakpoint", &rpcArgs, &rpcRet)
730		if err != nil {
731			return starlark.None, err
732		}
733		return env.interfaceToStarlarkValue(rpcRet), nil
734	})
735	r["get_thread"] = starlark.NewBuiltin("get_thread", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
736		if err := isCancelled(thread); err != nil {
737			return starlark.None, decorateError(thread, err)
738		}
739		var rpcArgs rpc2.GetThreadIn
740		var rpcRet rpc2.GetThreadOut
741		if len(args) > 0 && args[0] != starlark.None {
742			err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")
743			if err != nil {
744				return starlark.None, decorateError(thread, err)
745			}
746		}
747		for _, kv := range kwargs {
748			var err error
749			switch kv[0].(starlark.String) {
750			case "Id":
751				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")
752			default:
753				err = fmt.Errorf("unknown argument %q", kv[0])
754			}
755			if err != nil {
756				return starlark.None, decorateError(thread, err)
757			}
758		}
759		err := env.ctx.Client().CallAPI("GetThread", &rpcArgs, &rpcRet)
760		if err != nil {
761			return starlark.None, err
762		}
763		return env.interfaceToStarlarkValue(rpcRet), nil
764	})
765	r["is_multiclient"] = starlark.NewBuiltin("is_multiclient", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
766		if err := isCancelled(thread); err != nil {
767			return starlark.None, decorateError(thread, err)
768		}
769		var rpcArgs rpc2.IsMulticlientIn
770		var rpcRet rpc2.IsMulticlientOut
771		err := env.ctx.Client().CallAPI("IsMulticlient", &rpcArgs, &rpcRet)
772		if err != nil {
773			return starlark.None, err
774		}
775		return env.interfaceToStarlarkValue(rpcRet), nil
776	})
777	r["last_modified"] = starlark.NewBuiltin("last_modified", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
778		if err := isCancelled(thread); err != nil {
779			return starlark.None, decorateError(thread, err)
780		}
781		var rpcArgs rpc2.LastModifiedIn
782		var rpcRet rpc2.LastModifiedOut
783		err := env.ctx.Client().CallAPI("LastModified", &rpcArgs, &rpcRet)
784		if err != nil {
785			return starlark.None, err
786		}
787		return env.interfaceToStarlarkValue(rpcRet), nil
788	})
789	r["breakpoints"] = starlark.NewBuiltin("breakpoints", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
790		if err := isCancelled(thread); err != nil {
791			return starlark.None, decorateError(thread, err)
792		}
793		var rpcArgs rpc2.ListBreakpointsIn
794		var rpcRet rpc2.ListBreakpointsOut
795		err := env.ctx.Client().CallAPI("ListBreakpoints", &rpcArgs, &rpcRet)
796		if err != nil {
797			return starlark.None, err
798		}
799		return env.interfaceToStarlarkValue(rpcRet), nil
800	})
801	r["checkpoints"] = starlark.NewBuiltin("checkpoints", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
802		if err := isCancelled(thread); err != nil {
803			return starlark.None, decorateError(thread, err)
804		}
805		var rpcArgs rpc2.ListCheckpointsIn
806		var rpcRet rpc2.ListCheckpointsOut
807		err := env.ctx.Client().CallAPI("ListCheckpoints", &rpcArgs, &rpcRet)
808		if err != nil {
809			return starlark.None, err
810		}
811		return env.interfaceToStarlarkValue(rpcRet), nil
812	})
813	r["dynamic_libraries"] = starlark.NewBuiltin("dynamic_libraries", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
814		if err := isCancelled(thread); err != nil {
815			return starlark.None, decorateError(thread, err)
816		}
817		var rpcArgs rpc2.ListDynamicLibrariesIn
818		var rpcRet rpc2.ListDynamicLibrariesOut
819		err := env.ctx.Client().CallAPI("ListDynamicLibraries", &rpcArgs, &rpcRet)
820		if err != nil {
821			return starlark.None, err
822		}
823		return env.interfaceToStarlarkValue(rpcRet), nil
824	})
825	r["function_args"] = starlark.NewBuiltin("function_args", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
826		if err := isCancelled(thread); err != nil {
827			return starlark.None, decorateError(thread, err)
828		}
829		var rpcArgs rpc2.ListFunctionArgsIn
830		var rpcRet rpc2.ListFunctionArgsOut
831		if len(args) > 0 && args[0] != starlark.None {
832			err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")
833			if err != nil {
834				return starlark.None, decorateError(thread, err)
835			}
836		} else {
837			rpcArgs.Scope = env.ctx.Scope()
838		}
839		if len(args) > 1 && args[1] != starlark.None {
840			err := unmarshalStarlarkValue(args[1], &rpcArgs.Cfg, "Cfg")
841			if err != nil {
842				return starlark.None, decorateError(thread, err)
843			}
844		} else {
845			rpcArgs.Cfg = env.ctx.LoadConfig()
846		}
847		for _, kv := range kwargs {
848			var err error
849			switch kv[0].(starlark.String) {
850			case "Scope":
851				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")
852			case "Cfg":
853				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")
854			default:
855				err = fmt.Errorf("unknown argument %q", kv[0])
856			}
857			if err != nil {
858				return starlark.None, decorateError(thread, err)
859			}
860		}
861		err := env.ctx.Client().CallAPI("ListFunctionArgs", &rpcArgs, &rpcRet)
862		if err != nil {
863			return starlark.None, err
864		}
865		return env.interfaceToStarlarkValue(rpcRet), nil
866	})
867	r["functions"] = starlark.NewBuiltin("functions", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
868		if err := isCancelled(thread); err != nil {
869			return starlark.None, decorateError(thread, err)
870		}
871		var rpcArgs rpc2.ListFunctionsIn
872		var rpcRet rpc2.ListFunctionsOut
873		if len(args) > 0 && args[0] != starlark.None {
874			err := unmarshalStarlarkValue(args[0], &rpcArgs.Filter, "Filter")
875			if err != nil {
876				return starlark.None, decorateError(thread, err)
877			}
878		}
879		for _, kv := range kwargs {
880			var err error
881			switch kv[0].(starlark.String) {
882			case "Filter":
883				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filter, "Filter")
884			default:
885				err = fmt.Errorf("unknown argument %q", kv[0])
886			}
887			if err != nil {
888				return starlark.None, decorateError(thread, err)
889			}
890		}
891		err := env.ctx.Client().CallAPI("ListFunctions", &rpcArgs, &rpcRet)
892		if err != nil {
893			return starlark.None, err
894		}
895		return env.interfaceToStarlarkValue(rpcRet), nil
896	})
897	r["goroutines"] = starlark.NewBuiltin("goroutines", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
898		if err := isCancelled(thread); err != nil {
899			return starlark.None, decorateError(thread, err)
900		}
901		var rpcArgs rpc2.ListGoroutinesIn
902		var rpcRet rpc2.ListGoroutinesOut
903		if len(args) > 0 && args[0] != starlark.None {
904			err := unmarshalStarlarkValue(args[0], &rpcArgs.Start, "Start")
905			if err != nil {
906				return starlark.None, decorateError(thread, err)
907			}
908		}
909		if len(args) > 1 && args[1] != starlark.None {
910			err := unmarshalStarlarkValue(args[1], &rpcArgs.Count, "Count")
911			if err != nil {
912				return starlark.None, decorateError(thread, err)
913			}
914		}
915		if len(args) > 2 && args[2] != starlark.None {
916			err := unmarshalStarlarkValue(args[2], &rpcArgs.Filters, "Filters")
917			if err != nil {
918				return starlark.None, decorateError(thread, err)
919			}
920		}
921		if len(args) > 3 && args[3] != starlark.None {
922			err := unmarshalStarlarkValue(args[3], &rpcArgs.GoroutineGroupingOptions, "GoroutineGroupingOptions")
923			if err != nil {
924				return starlark.None, decorateError(thread, err)
925			}
926		}
927		for _, kv := range kwargs {
928			var err error
929			switch kv[0].(starlark.String) {
930			case "Start":
931				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Start, "Start")
932			case "Count":
933				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Count, "Count")
934			case "Filters":
935				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filters, "Filters")
936			case "GoroutineGroupingOptions":
937				err = unmarshalStarlarkValue(kv[1], &rpcArgs.GoroutineGroupingOptions, "GoroutineGroupingOptions")
938			default:
939				err = fmt.Errorf("unknown argument %q", kv[0])
940			}
941			if err != nil {
942				return starlark.None, decorateError(thread, err)
943			}
944		}
945		err := env.ctx.Client().CallAPI("ListGoroutines", &rpcArgs, &rpcRet)
946		if err != nil {
947			return starlark.None, err
948		}
949		return env.interfaceToStarlarkValue(rpcRet), nil
950	})
951	r["local_vars"] = starlark.NewBuiltin("local_vars", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
952		if err := isCancelled(thread); err != nil {
953			return starlark.None, decorateError(thread, err)
954		}
955		var rpcArgs rpc2.ListLocalVarsIn
956		var rpcRet rpc2.ListLocalVarsOut
957		if len(args) > 0 && args[0] != starlark.None {
958			err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")
959			if err != nil {
960				return starlark.None, decorateError(thread, err)
961			}
962		} else {
963			rpcArgs.Scope = env.ctx.Scope()
964		}
965		if len(args) > 1 && args[1] != starlark.None {
966			err := unmarshalStarlarkValue(args[1], &rpcArgs.Cfg, "Cfg")
967			if err != nil {
968				return starlark.None, decorateError(thread, err)
969			}
970		} else {
971			rpcArgs.Cfg = env.ctx.LoadConfig()
972		}
973		for _, kv := range kwargs {
974			var err error
975			switch kv[0].(starlark.String) {
976			case "Scope":
977				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")
978			case "Cfg":
979				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")
980			default:
981				err = fmt.Errorf("unknown argument %q", kv[0])
982			}
983			if err != nil {
984				return starlark.None, decorateError(thread, err)
985			}
986		}
987		err := env.ctx.Client().CallAPI("ListLocalVars", &rpcArgs, &rpcRet)
988		if err != nil {
989			return starlark.None, err
990		}
991		return env.interfaceToStarlarkValue(rpcRet), nil
992	})
993	r["package_vars"] = starlark.NewBuiltin("package_vars", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
994		if err := isCancelled(thread); err != nil {
995			return starlark.None, decorateError(thread, err)
996		}
997		var rpcArgs rpc2.ListPackageVarsIn
998		var rpcRet rpc2.ListPackageVarsOut
999		if len(args) > 0 && args[0] != starlark.None {
1000			err := unmarshalStarlarkValue(args[0], &rpcArgs.Filter, "Filter")
1001			if err != nil {
1002				return starlark.None, decorateError(thread, err)
1003			}
1004		}
1005		if len(args) > 1 && args[1] != starlark.None {
1006			err := unmarshalStarlarkValue(args[1], &rpcArgs.Cfg, "Cfg")
1007			if err != nil {
1008				return starlark.None, decorateError(thread, err)
1009			}
1010		} else {
1011			rpcArgs.Cfg = env.ctx.LoadConfig()
1012		}
1013		for _, kv := range kwargs {
1014			var err error
1015			switch kv[0].(starlark.String) {
1016			case "Filter":
1017				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filter, "Filter")
1018			case "Cfg":
1019				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")
1020			default:
1021				err = fmt.Errorf("unknown argument %q", kv[0])
1022			}
1023			if err != nil {
1024				return starlark.None, decorateError(thread, err)
1025			}
1026		}
1027		err := env.ctx.Client().CallAPI("ListPackageVars", &rpcArgs, &rpcRet)
1028		if err != nil {
1029			return starlark.None, err
1030		}
1031		return env.interfaceToStarlarkValue(rpcRet), nil
1032	})
1033	r["packages_build_info"] = starlark.NewBuiltin("packages_build_info", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1034		if err := isCancelled(thread); err != nil {
1035			return starlark.None, decorateError(thread, err)
1036		}
1037		var rpcArgs rpc2.ListPackagesBuildInfoIn
1038		var rpcRet rpc2.ListPackagesBuildInfoOut
1039		if len(args) > 0 && args[0] != starlark.None {
1040			err := unmarshalStarlarkValue(args[0], &rpcArgs.IncludeFiles, "IncludeFiles")
1041			if err != nil {
1042				return starlark.None, decorateError(thread, err)
1043			}
1044		}
1045		for _, kv := range kwargs {
1046			var err error
1047			switch kv[0].(starlark.String) {
1048			case "IncludeFiles":
1049				err = unmarshalStarlarkValue(kv[1], &rpcArgs.IncludeFiles, "IncludeFiles")
1050			default:
1051				err = fmt.Errorf("unknown argument %q", kv[0])
1052			}
1053			if err != nil {
1054				return starlark.None, decorateError(thread, err)
1055			}
1056		}
1057		err := env.ctx.Client().CallAPI("ListPackagesBuildInfo", &rpcArgs, &rpcRet)
1058		if err != nil {
1059			return starlark.None, err
1060		}
1061		return env.interfaceToStarlarkValue(rpcRet), nil
1062	})
1063	r["registers"] = starlark.NewBuiltin("registers", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1064		if err := isCancelled(thread); err != nil {
1065			return starlark.None, decorateError(thread, err)
1066		}
1067		var rpcArgs rpc2.ListRegistersIn
1068		var rpcRet rpc2.ListRegistersOut
1069		if len(args) > 0 && args[0] != starlark.None {
1070			err := unmarshalStarlarkValue(args[0], &rpcArgs.ThreadID, "ThreadID")
1071			if err != nil {
1072				return starlark.None, decorateError(thread, err)
1073			}
1074		}
1075		if len(args) > 1 && args[1] != starlark.None {
1076			err := unmarshalStarlarkValue(args[1], &rpcArgs.IncludeFp, "IncludeFp")
1077			if err != nil {
1078				return starlark.None, decorateError(thread, err)
1079			}
1080		}
1081		if len(args) > 2 && args[2] != starlark.None {
1082			err := unmarshalStarlarkValue(args[2], &rpcArgs.Scope, "Scope")
1083			if err != nil {
1084				return starlark.None, decorateError(thread, err)
1085			}
1086		} else {
1087			scope := env.ctx.Scope()
1088			rpcArgs.Scope = &scope
1089		}
1090		for _, kv := range kwargs {
1091			var err error
1092			switch kv[0].(starlark.String) {
1093			case "ThreadID":
1094				err = unmarshalStarlarkValue(kv[1], &rpcArgs.ThreadID, "ThreadID")
1095			case "IncludeFp":
1096				err = unmarshalStarlarkValue(kv[1], &rpcArgs.IncludeFp, "IncludeFp")
1097			case "Scope":
1098				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")
1099			default:
1100				err = fmt.Errorf("unknown argument %q", kv[0])
1101			}
1102			if err != nil {
1103				return starlark.None, decorateError(thread, err)
1104			}
1105		}
1106		err := env.ctx.Client().CallAPI("ListRegisters", &rpcArgs, &rpcRet)
1107		if err != nil {
1108			return starlark.None, err
1109		}
1110		return env.interfaceToStarlarkValue(rpcRet), nil
1111	})
1112	r["sources"] = starlark.NewBuiltin("sources", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1113		if err := isCancelled(thread); err != nil {
1114			return starlark.None, decorateError(thread, err)
1115		}
1116		var rpcArgs rpc2.ListSourcesIn
1117		var rpcRet rpc2.ListSourcesOut
1118		if len(args) > 0 && args[0] != starlark.None {
1119			err := unmarshalStarlarkValue(args[0], &rpcArgs.Filter, "Filter")
1120			if err != nil {
1121				return starlark.None, decorateError(thread, err)
1122			}
1123		}
1124		for _, kv := range kwargs {
1125			var err error
1126			switch kv[0].(starlark.String) {
1127			case "Filter":
1128				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filter, "Filter")
1129			default:
1130				err = fmt.Errorf("unknown argument %q", kv[0])
1131			}
1132			if err != nil {
1133				return starlark.None, decorateError(thread, err)
1134			}
1135		}
1136		err := env.ctx.Client().CallAPI("ListSources", &rpcArgs, &rpcRet)
1137		if err != nil {
1138			return starlark.None, err
1139		}
1140		return env.interfaceToStarlarkValue(rpcRet), nil
1141	})
1142	r["threads"] = starlark.NewBuiltin("threads", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1143		if err := isCancelled(thread); err != nil {
1144			return starlark.None, decorateError(thread, err)
1145		}
1146		var rpcArgs rpc2.ListThreadsIn
1147		var rpcRet rpc2.ListThreadsOut
1148		err := env.ctx.Client().CallAPI("ListThreads", &rpcArgs, &rpcRet)
1149		if err != nil {
1150			return starlark.None, err
1151		}
1152		return env.interfaceToStarlarkValue(rpcRet), nil
1153	})
1154	r["types"] = starlark.NewBuiltin("types", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1155		if err := isCancelled(thread); err != nil {
1156			return starlark.None, decorateError(thread, err)
1157		}
1158		var rpcArgs rpc2.ListTypesIn
1159		var rpcRet rpc2.ListTypesOut
1160		if len(args) > 0 && args[0] != starlark.None {
1161			err := unmarshalStarlarkValue(args[0], &rpcArgs.Filter, "Filter")
1162			if err != nil {
1163				return starlark.None, decorateError(thread, err)
1164			}
1165		}
1166		for _, kv := range kwargs {
1167			var err error
1168			switch kv[0].(starlark.String) {
1169			case "Filter":
1170				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Filter, "Filter")
1171			default:
1172				err = fmt.Errorf("unknown argument %q", kv[0])
1173			}
1174			if err != nil {
1175				return starlark.None, decorateError(thread, err)
1176			}
1177		}
1178		err := env.ctx.Client().CallAPI("ListTypes", &rpcArgs, &rpcRet)
1179		if err != nil {
1180			return starlark.None, err
1181		}
1182		return env.interfaceToStarlarkValue(rpcRet), nil
1183	})
1184	r["process_pid"] = starlark.NewBuiltin("process_pid", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1185		if err := isCancelled(thread); err != nil {
1186			return starlark.None, decorateError(thread, err)
1187		}
1188		var rpcArgs rpc2.ProcessPidIn
1189		var rpcRet rpc2.ProcessPidOut
1190		err := env.ctx.Client().CallAPI("ProcessPid", &rpcArgs, &rpcRet)
1191		if err != nil {
1192			return starlark.None, err
1193		}
1194		return env.interfaceToStarlarkValue(rpcRet), nil
1195	})
1196	r["recorded"] = starlark.NewBuiltin("recorded", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1197		if err := isCancelled(thread); err != nil {
1198			return starlark.None, decorateError(thread, err)
1199		}
1200		var rpcArgs rpc2.RecordedIn
1201		var rpcRet rpc2.RecordedOut
1202		err := env.ctx.Client().CallAPI("Recorded", &rpcArgs, &rpcRet)
1203		if err != nil {
1204			return starlark.None, err
1205		}
1206		return env.interfaceToStarlarkValue(rpcRet), nil
1207	})
1208	r["restart"] = starlark.NewBuiltin("restart", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1209		if err := isCancelled(thread); err != nil {
1210			return starlark.None, decorateError(thread, err)
1211		}
1212		var rpcArgs rpc2.RestartIn
1213		var rpcRet rpc2.RestartOut
1214		if len(args) > 0 && args[0] != starlark.None {
1215			err := unmarshalStarlarkValue(args[0], &rpcArgs.Position, "Position")
1216			if err != nil {
1217				return starlark.None, decorateError(thread, err)
1218			}
1219		}
1220		if len(args) > 1 && args[1] != starlark.None {
1221			err := unmarshalStarlarkValue(args[1], &rpcArgs.ResetArgs, "ResetArgs")
1222			if err != nil {
1223				return starlark.None, decorateError(thread, err)
1224			}
1225		}
1226		if len(args) > 2 && args[2] != starlark.None {
1227			err := unmarshalStarlarkValue(args[2], &rpcArgs.NewArgs, "NewArgs")
1228			if err != nil {
1229				return starlark.None, decorateError(thread, err)
1230			}
1231		}
1232		if len(args) > 3 && args[3] != starlark.None {
1233			err := unmarshalStarlarkValue(args[3], &rpcArgs.Rerecord, "Rerecord")
1234			if err != nil {
1235				return starlark.None, decorateError(thread, err)
1236			}
1237		}
1238		if len(args) > 4 && args[4] != starlark.None {
1239			err := unmarshalStarlarkValue(args[4], &rpcArgs.Rebuild, "Rebuild")
1240			if err != nil {
1241				return starlark.None, decorateError(thread, err)
1242			}
1243		}
1244		if len(args) > 5 && args[5] != starlark.None {
1245			err := unmarshalStarlarkValue(args[5], &rpcArgs.NewRedirects, "NewRedirects")
1246			if err != nil {
1247				return starlark.None, decorateError(thread, err)
1248			}
1249		}
1250		for _, kv := range kwargs {
1251			var err error
1252			switch kv[0].(starlark.String) {
1253			case "Position":
1254				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Position, "Position")
1255			case "ResetArgs":
1256				err = unmarshalStarlarkValue(kv[1], &rpcArgs.ResetArgs, "ResetArgs")
1257			case "NewArgs":
1258				err = unmarshalStarlarkValue(kv[1], &rpcArgs.NewArgs, "NewArgs")
1259			case "Rerecord":
1260				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Rerecord, "Rerecord")
1261			case "Rebuild":
1262				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Rebuild, "Rebuild")
1263			case "NewRedirects":
1264				err = unmarshalStarlarkValue(kv[1], &rpcArgs.NewRedirects, "NewRedirects")
1265			default:
1266				err = fmt.Errorf("unknown argument %q", kv[0])
1267			}
1268			if err != nil {
1269				return starlark.None, decorateError(thread, err)
1270			}
1271		}
1272		err := env.ctx.Client().CallAPI("Restart", &rpcArgs, &rpcRet)
1273		if err != nil {
1274			return starlark.None, err
1275		}
1276		return env.interfaceToStarlarkValue(rpcRet), nil
1277	})
1278	r["set_expr"] = starlark.NewBuiltin("set_expr", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1279		if err := isCancelled(thread); err != nil {
1280			return starlark.None, decorateError(thread, err)
1281		}
1282		var rpcArgs rpc2.SetIn
1283		var rpcRet rpc2.SetOut
1284		if len(args) > 0 && args[0] != starlark.None {
1285			err := unmarshalStarlarkValue(args[0], &rpcArgs.Scope, "Scope")
1286			if err != nil {
1287				return starlark.None, decorateError(thread, err)
1288			}
1289		} else {
1290			rpcArgs.Scope = env.ctx.Scope()
1291		}
1292		if len(args) > 1 && args[1] != starlark.None {
1293			err := unmarshalStarlarkValue(args[1], &rpcArgs.Symbol, "Symbol")
1294			if err != nil {
1295				return starlark.None, decorateError(thread, err)
1296			}
1297		}
1298		if len(args) > 2 && args[2] != starlark.None {
1299			err := unmarshalStarlarkValue(args[2], &rpcArgs.Value, "Value")
1300			if err != nil {
1301				return starlark.None, decorateError(thread, err)
1302			}
1303		}
1304		for _, kv := range kwargs {
1305			var err error
1306			switch kv[0].(starlark.String) {
1307			case "Scope":
1308				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Scope, "Scope")
1309			case "Symbol":
1310				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Symbol, "Symbol")
1311			case "Value":
1312				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Value, "Value")
1313			default:
1314				err = fmt.Errorf("unknown argument %q", kv[0])
1315			}
1316			if err != nil {
1317				return starlark.None, decorateError(thread, err)
1318			}
1319		}
1320		err := env.ctx.Client().CallAPI("Set", &rpcArgs, &rpcRet)
1321		if err != nil {
1322			return starlark.None, err
1323		}
1324		return env.interfaceToStarlarkValue(rpcRet), nil
1325	})
1326	r["stacktrace"] = starlark.NewBuiltin("stacktrace", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1327		if err := isCancelled(thread); err != nil {
1328			return starlark.None, decorateError(thread, err)
1329		}
1330		var rpcArgs rpc2.StacktraceIn
1331		var rpcRet rpc2.StacktraceOut
1332		if len(args) > 0 && args[0] != starlark.None {
1333			err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")
1334			if err != nil {
1335				return starlark.None, decorateError(thread, err)
1336			}
1337		}
1338		if len(args) > 1 && args[1] != starlark.None {
1339			err := unmarshalStarlarkValue(args[1], &rpcArgs.Depth, "Depth")
1340			if err != nil {
1341				return starlark.None, decorateError(thread, err)
1342			}
1343		}
1344		if len(args) > 2 && args[2] != starlark.None {
1345			err := unmarshalStarlarkValue(args[2], &rpcArgs.Full, "Full")
1346			if err != nil {
1347				return starlark.None, decorateError(thread, err)
1348			}
1349		}
1350		if len(args) > 3 && args[3] != starlark.None {
1351			err := unmarshalStarlarkValue(args[3], &rpcArgs.Defers, "Defers")
1352			if err != nil {
1353				return starlark.None, decorateError(thread, err)
1354			}
1355		}
1356		if len(args) > 4 && args[4] != starlark.None {
1357			err := unmarshalStarlarkValue(args[4], &rpcArgs.Opts, "Opts")
1358			if err != nil {
1359				return starlark.None, decorateError(thread, err)
1360			}
1361		}
1362		if len(args) > 5 && args[5] != starlark.None {
1363			err := unmarshalStarlarkValue(args[5], &rpcArgs.Cfg, "Cfg")
1364			if err != nil {
1365				return starlark.None, decorateError(thread, err)
1366			}
1367		}
1368		for _, kv := range kwargs {
1369			var err error
1370			switch kv[0].(starlark.String) {
1371			case "Id":
1372				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")
1373			case "Depth":
1374				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Depth, "Depth")
1375			case "Full":
1376				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Full, "Full")
1377			case "Defers":
1378				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Defers, "Defers")
1379			case "Opts":
1380				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Opts, "Opts")
1381			case "Cfg":
1382				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Cfg, "Cfg")
1383			default:
1384				err = fmt.Errorf("unknown argument %q", kv[0])
1385			}
1386			if err != nil {
1387				return starlark.None, decorateError(thread, err)
1388			}
1389		}
1390		err := env.ctx.Client().CallAPI("Stacktrace", &rpcArgs, &rpcRet)
1391		if err != nil {
1392			return starlark.None, err
1393		}
1394		return env.interfaceToStarlarkValue(rpcRet), nil
1395	})
1396	r["state"] = starlark.NewBuiltin("state", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1397		if err := isCancelled(thread); err != nil {
1398			return starlark.None, decorateError(thread, err)
1399		}
1400		var rpcArgs rpc2.StateIn
1401		var rpcRet rpc2.StateOut
1402		if len(args) > 0 && args[0] != starlark.None {
1403			err := unmarshalStarlarkValue(args[0], &rpcArgs.NonBlocking, "NonBlocking")
1404			if err != nil {
1405				return starlark.None, decorateError(thread, err)
1406			}
1407		}
1408		for _, kv := range kwargs {
1409			var err error
1410			switch kv[0].(starlark.String) {
1411			case "NonBlocking":
1412				err = unmarshalStarlarkValue(kv[1], &rpcArgs.NonBlocking, "NonBlocking")
1413			default:
1414				err = fmt.Errorf("unknown argument %q", kv[0])
1415			}
1416			if err != nil {
1417				return starlark.None, decorateError(thread, err)
1418			}
1419		}
1420		err := env.ctx.Client().CallAPI("State", &rpcArgs, &rpcRet)
1421		if err != nil {
1422			return starlark.None, err
1423		}
1424		return env.interfaceToStarlarkValue(rpcRet), nil
1425	})
1426	r["toggle_breakpoint"] = starlark.NewBuiltin("toggle_breakpoint", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
1427		if err := isCancelled(thread); err != nil {
1428			return starlark.None, decorateError(thread, err)
1429		}
1430		var rpcArgs rpc2.ToggleBreakpointIn
1431		var rpcRet rpc2.ToggleBreakpointOut
1432		if len(args) > 0 && args[0] != starlark.None {
1433			err := unmarshalStarlarkValue(args[0], &rpcArgs.Id, "Id")
1434			if err != nil {
1435				return starlark.None, decorateError(thread, err)
1436			}
1437		}
1438		if len(args) > 1 && args[1] != starlark.None {
1439			err := unmarshalStarlarkValue(args[1], &rpcArgs.Name, "Name")
1440			if err != nil {
1441				return starlark.None, decorateError(thread, err)
1442			}
1443		}
1444		for _, kv := range kwargs {
1445			var err error
1446			switch kv[0].(starlark.String) {
1447			case "Id":
1448				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")
1449			case "Name":
1450				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name")
1451			default:
1452				err = fmt.Errorf("unknown argument %q", kv[0])
1453			}
1454			if err != nil {
1455				return starlark.None, decorateError(thread, err)
1456			}
1457		}
1458		err := env.ctx.Client().CallAPI("ToggleBreakpoint", &rpcArgs, &rpcRet)
1459		if err != nil {
1460			return starlark.None, err
1461		}
1462		return env.interfaceToStarlarkValue(rpcRet), nil
1463	})
1464	return r
1465}
1466
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Trigger decorate code on LambdaTest Cloud Grid

Execute automation tests with decorate on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)