Skip to content

Commit 125c4db

Browse files
authored
[lldb][lldb-dap] setVariable request should send the correct response (#130773)
The display value was incorrectly sent as "result" instead of "value".
1 parent 2dc123b commit 125c4db

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,20 @@ def do_test_scopes_variables_setVariable_evaluate(
313313

314314
# Set a variable value whose name is synthetic, like a variable index
315315
# and verify the value by reading it
316-
self.dap_server.request_setVariable(varRef, "[0]", 100)
316+
variable_value = 100
317+
response = self.dap_server.request_setVariable(varRef, "[0]", variable_value)
318+
# Verify dap sent the correct response
319+
verify_response = {
320+
"type": "int",
321+
"value": str(variable_value),
322+
"variablesReference": 0,
323+
}
324+
for key, value in verify_response.items():
325+
self.assertEqual(value, response["body"][key])
326+
317327
response = self.dap_server.request_variables(varRef, start=0, count=1)
318328
self.verify_variables(
319-
make_buffer_verify_dict(0, 1, 100), response["body"]["variables"]
329+
make_buffer_verify_dict(0, 1, variable_value), response["body"]["variables"]
320330
)
321331

322332
# Set a variable value whose name is a real child value, like "pt.x"

lldb/tools/lldb-dap/Handler/SetVariableRequestHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ void SetVariableRequestHandler::operator()(
146146
bool success = variable.SetValueFromCString(value.data(), error);
147147
if (success) {
148148
VariableDescription desc(variable, dap.enable_auto_variable_summaries);
149-
EmplaceSafeString(body, "result", desc.display_value);
149+
EmplaceSafeString(body, "value", desc.display_value);
150150
EmplaceSafeString(body, "type", desc.display_type_name);
151151

152152
// We don't know the index of the variable in our dap.variables

0 commit comments

Comments
 (0)