19from typing
import Optional
21from .frames
import select_frame
22from .server
import capability, request, client_bool_capability
23from .startup
import in_gdb_thread
24from .varref
import find_variable, VariableReference, apply_format
29 super().
__init__(
None, value,
"result")
35 with apply_format(value_format):
37 if frame_id
is not None:
38 select_frame(frame_id)
39 global_context =
False
40 val = gdb.parse_and_eval(expr, global_context=global_context)
42 return ref.to_object()
52 return _evaluate(expr, frame_id, value_format)
57 super().
__init__(
None, value,
"value")
63 with apply_format(value_format):
65 if frame_id
is not None:
66 select_frame(frame_id)
67 global_context =
False
68 lhs = gdb.parse_and_eval(expression, global_context=global_context)
69 rhs = gdb.parse_and_eval(value, global_context=global_context)
77 if frame_id
is not None:
78 select_frame(frame_id)
79 val = gdb.execute(command, from_tty=
True, to_string=
True)
82 "variablesReference": 0,
87@capability("supportsEvaluateForHovers")
88@capability("supportsValueFormattingOptions")
92 frameId: Optional[int] =
None,
93 context: str =
"variables",
97 if context
in (
"watch",
"variables"):
99 return _evaluate(expression, frameId, format)
100 elif context ==
"hover":
102 elif context ==
"repl":
104 return _repl(expression, frameId)
106 raise Exception(
'unknown evaluate context "' + context +
'"')
111 with apply_format(value_format):
112 var = find_variable(ref)
113 children = var.fetch_children(start, count)
114 return [x.to_object()
for x
in children]
121 *, variablesReference: int, start: int = 0, count: int = 0, format=
None, **args
125 if not client_bool_capability(
"supportsVariablePaging"):
128 return {
"variables":
_variables(variablesReference, start, count, format)}
131@capability("supportsSetExpression")
132@request("setExpression")
134 *, expression: str, value: str, frameId: Optional[int] =
None, format=
None, **args
142 with apply_format(value_format):
143 var = find_variable(ref)
144 lhs = var.find_child_by_name(name)
145 rhs = gdb.parse_and_eval(value)
147 return lhs.to_object()
150@capability("supportsSetVariable")
151@request("setVariable")
153 *, variablesReference: int, name: str, value: str, format=
None, **args
155 return _set_variable(variablesReference, name, value, format)
_variables(ref, start, count, value_format)
eval_request(*str expression, Optional[int] frameId=None, str context="variables", format=None, **args)
_evaluate(expr, frame_id, value_format)
variables(*int variablesReference, int start=0, int count=0, format=None, **args)
_eval_for_hover(expr, frame_id, value_format)
_set_expression(expression, value, frame_id, value_format)
set_variable(*int variablesReference, str name, str value, format=None, **args)
_set_variable(ref, name, value, value_format)
set_expression(*str expression, str value, Optional[int] frameId=None, format=None, **args)
with_parameter(name, value)