Skip to content

[lldb][lldb-dap] setVariable request should send the correct response #130773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,20 @@ def do_test_scopes_variables_setVariable_evaluate(

# Set a variable value whose name is synthetic, like a variable index
# and verify the value by reading it
self.dap_server.request_setVariable(varRef, "[0]", 100)
variable_value = 100
response = self.dap_server.request_setVariable(varRef, "[0]", variable_value)
# Verify dap sent the correct response
verify_response = {
"type": "int",
"value": str(variable_value),
"variablesReference": 0,
}
for key, value in verify_response.items():
self.assertEqual(value, response["body"][key])

response = self.dap_server.request_variables(varRef, start=0, count=1)
self.verify_variables(
make_buffer_verify_dict(0, 1, 100), response["body"]["variables"]
make_buffer_verify_dict(0, 1, variable_value), response["body"]["variables"]
)

# Set a variable value whose name is a real child value, like "pt.x"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ void SetVariableRequestHandler::operator()(
bool success = variable.SetValueFromCString(value.data(), error);
if (success) {
VariableDescription desc(variable, dap.enable_auto_variable_summaries);
EmplaceSafeString(body, "result", desc.display_value);
EmplaceSafeString(body, "value", desc.display_value);
EmplaceSafeString(body, "type", desc.display_type_name);

// We don't know the index of the variable in our dap.variables
Expand Down
Loading