[Lldb-commits] [lldb] fa40c36 - [lldb-dap] Mark return value as readonly (#186329)

via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 16 02:43:52 PDT 2026


Author: Sergei Druzhkov
Date: 2026-03-16T12:43:47+03:00
New Revision: fa40c361fc4a13d246099fb158d562f2d22e60ae

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

LOG: [lldb-dap] Mark return value as readonly (#186329)

Marked return value as readonly to give VS Code a hint that this
variable doesn't support `setVariable` request.

Added: 
    

Modified: 
    lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
    lldb/tools/lldb-dap/ProtocolUtils.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 6e0514a0019a4..020d87d63aaf2 100644
--- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
+++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
@@ -733,7 +733,7 @@ def test_return_variables(self):
 
         return_name = "(Return Value)"
         verify_locals = {
-            return_name: {"equals": {"type": "int", "value": "300"}},
+            return_name: {"equals": {"type": "int", "value": "300"}, "readOnly": True},
             "argc": {},
             "argv": {},
             "pt": {"readOnly": True},

diff  --git a/lldb/tools/lldb-dap/ProtocolUtils.cpp b/lldb/tools/lldb-dap/ProtocolUtils.cpp
index 99bd5abf0b756..bc997b1da9bd7 100644
--- a/lldb/tools/lldb-dap/ProtocolUtils.cpp
+++ b/lldb/tools/lldb-dap/ProtocolUtils.cpp
@@ -300,7 +300,8 @@ Variable CreateVariable(lldb::SBValue v, var_ref_t var_ref, bool format_hex,
     var.memoryReference = addr;
 
   bool is_readonly = v.GetType().IsAggregateType() ||
-                     v.GetValueType() == lldb::eValueTypeRegisterSet;
+                     v.GetValueType() == lldb::eValueTypeRegisterSet ||
+                     var.name == "(Return Value)";
   if (is_readonly) {
     if (!var.presentationHint)
       var.presentationHint = {VariablePresentationHint()};


        


More information about the lldb-commits mailing list