[Lldb-commits] [lldb] 125c4db - [lldb][lldb-dap] setVariable request should send the correct response (#130773)

via lldb-commits lldb-commits at lists.llvm.org
Sun Mar 16 16:28:28 PDT 2025


Author: Ebuka Ezike
Date: 2025-03-16T23:28:25Z
New Revision: 125c4db7301875cae928406043f02ed5b1133195

URL: https://github.com/llvm/llvm-project/commit/125c4db7301875cae928406043f02ed5b1133195
DIFF: https://github.com/llvm/llvm-project/commit/125c4db7301875cae928406043f02ed5b1133195.diff

LOG: [lldb][lldb-dap] setVariable request should send the correct response (#130773)

The display value was incorrectly sent as "result" instead of "value".

Added: 
    

Modified: 
    lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
    lldb/tools/lldb-dap/Handler/SetVariableRequestHandler.cpp

Removed: 
    


################################################################################
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 3ab1bb32fd18e..a7896b7fefa29 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


        


More information about the lldb-commits mailing list