-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[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
Conversation
@llvm/pr-subscribers-lldb Author: Ebuka Ezike (da-viper) ChangesFull diff: https://github.com/llvm/llvm-project/pull/130773.diff 2 Files Affected:
diff --git a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
index ee5b49de14d98..286bf3390a440 100644
--- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
+++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
@@ -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"
diff --git a/lldb/tools/lldb-dap/Handler/SetVariableRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/SetVariableRequestHandler.cpp
index 7d2f13f0a327e..8b46490d6f4f2 100644
--- a/lldb/tools/lldb-dap/Handler/SetVariableRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/SetVariableRequestHandler.cpp
@@ -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
|
@da-viper do you have commit access by now? Can you merge this by yourself (after potentially waiting for other reviews) |
No, how do I get it ? |
Yes I do have access now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please try to write a little summary of the problem in the commit description before you merge this. Something like:
The display value was incorrectly sent as "result" instead of "value".
A good description is really helpful when someone is looking through a list of commits.
The display value was incorrectly sent as "result" instead of "value".
3c39668
to
1a70dca
Compare
The display value was incorrectly sent as "result" instead of "value".