diff options
author | Tom Tromey <tromey@adacore.com> | 2023-06-21 06:23:20 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2023-07-07 13:56:52 -0600 |
commit | de5dfbe91cbc60b41eec08089192eb1d16bbb749 (patch) | |
tree | a4c6c7501b9e9401e08c9f2d9fc23fd85c8e9afc /gdb/python | |
parent | 73aa9ef81be869176814cac635723e920f7ca612 (diff) | |
download | gdb-de5dfbe91cbc60b41eec08089192eb1d16bbb749.zip gdb-de5dfbe91cbc60b41eec08089192eb1d16bbb749.tar.gz gdb-de5dfbe91cbc60b41eec08089192eb1d16bbb749.tar.bz2 |
Fix result of DAP setExpression
A co-worker, Andry, noticed that the DAP setExpression implementation
returned the wrong fields -- it used "result" rather than "value", and
included "memoryReference", which isn't in the spec (an odd oversight,
IMO).
This patch fixes the problems.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/lib/gdb/dap/evaluate.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gdb/python/lib/gdb/dap/evaluate.py b/gdb/python/lib/gdb/dap/evaluate.py index 651a404..5e3ebf7 100644 --- a/gdb/python/lib/gdb/dap/evaluate.py +++ b/gdb/python/lib/gdb/dap/evaluate.py @@ -53,6 +53,18 @@ def _eval_for_hover(expr, frame_id): return _evaluate(expr, frame_id) +class _SetResult(VariableReference): + def __init__(self, value): + super().__init__(None, value, "value") + + def to_object(self): + result = super().to_object() + # This is not specified in the setExpression result. + if "memoryReference" in result: + del result["memoryReference"] + return result + + # Helper function to perform an assignment. @in_gdb_thread def _set_expression(expression, value, frame_id): @@ -64,7 +76,7 @@ def _set_expression(expression, value, frame_id): lhs = gdb.parse_and_eval(expression, global_context=global_context) rhs = gdb.parse_and_eval(value, global_context=global_context) lhs.assign(rhs) - return EvaluateResult(lhs).to_object() + return _SetResult(lhs).to_object() # Helper function to evaluate a gdb command in a certain frame. |