Skip to content

Conversation

@da-viper
Copy link
Contributor

Majority of the time users are less interested on the memory address of a type. It is mostly useful for pointer types (the memory address is shown).
It makes the view more bloated without adding useful information.

can always fall back to the debug console or watch pane to view the information if necessary.

Memory Address No Memory Address

majority of the time users are less interested on the memory address
of a type. It is mostly useful for pointer types (the memory address
is shown). It makes the view more bloated without adding useful
information.
@da-viper da-viper requested a review from ashgti December 17, 2025 14:49
@da-viper da-viper changed the title [lldb-dap] do not show memory address on types with no summary [lldb-dap] Do not show memory address on types with no summary Dec 17, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 17, 2025

@llvm/pr-subscribers-lldb

Author: Ebuka Ezike (da-viper)

Changes

Majority of the time users are less interested on the memory address of a type. It is mostly useful for pointer types (the memory address is shown).
It makes the view more bloated without adding useful information.

can always fall back to the debug console or watch pane to view the information if necessary.

Memory Address No Memory Address

Full diff: https://github.com/llvm/llvm-project/pull/172670.diff

3 Files Affected:

  • (modified) lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py (+2-10)
  • (modified) lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py (+5-5)
  • (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+2-7)
diff --git a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
index 95573780e94bd..95ad0f06d9a06 100644
--- a/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
+++ b/lldb/test/API/tools/lldb-dap/evaluate/TestDAP_evaluate.py
@@ -168,11 +168,7 @@ def run_test_evaluate_expressions(
         else:
             self.assertEvaluate(
                 "struct1",
-                (
-                    re.escape("{foo:15}")
-                    if enableAutoVariableSummaries
-                    else "my_struct @ 0x"
-                ),
+                (re.escape("{foo:15}") if enableAutoVariableSummaries else "my_struct"),
                 want_varref=True,
             )
             self.assertEvaluate(
@@ -243,11 +239,7 @@ def run_test_evaluate_expressions(
         else:
             self.assertEvaluate(
                 "struct1",
-                (
-                    re.escape("{foo:15}")
-                    if enableAutoVariableSummaries
-                    else "my_struct @ 0x"
-                ),
+                (re.escape("{foo:15}") if enableAutoVariableSummaries else "my_struct"),
                 want_type="my_struct",
                 want_varref=True,
             )
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 977d6ce9dac8a..05445af40aea5 100644
--- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
+++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py
@@ -255,7 +255,7 @@ def do_test_scopes_variables_setVariable_evaluate(
                     "result": (
                         "{x:11, y:22, buffer:{...}}"
                         if enableAutoVariableSummaries
-                        else "PointType @ 0x"
+                        else "PointType"
                     )
                 },
                 "hasVariablesReference": True,
@@ -266,7 +266,7 @@ def do_test_scopes_variables_setVariable_evaluate(
                     "result": (
                         "{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...}"
                         if enableAutoVariableSummaries
-                        else "int[16] @ 0x"
+                        else "int[16]"
                     )
                 },
                 "hasVariablesReference": True,
@@ -502,7 +502,7 @@ def do_test_scopes_and_evaluate_expansion(self, enableAutoVariableSummaries: boo
                         "result": (
                             "{x:11, y:22, buffer:{...}}"
                             if enableAutoVariableSummaries
-                            else "PointType @ 0x"
+                            else "PointType"
                         )
                     },
                     "missing": ["indexedVariables"],
@@ -514,7 +514,7 @@ def do_test_scopes_and_evaluate_expansion(self, enableAutoVariableSummaries: boo
                         "result": (
                             "{x:11, y:22, buffer:{...}}"
                             if enableAutoVariableSummaries
-                            else "PointType @ 0x"
+                            else "PointType"
                         )
                     },
                     "missing": ["indexedVariables"],
@@ -526,7 +526,7 @@ def do_test_scopes_and_evaluate_expansion(self, enableAutoVariableSummaries: boo
                         "result": (
                             "{x:11, y:22, buffer:{...}}"
                             if enableAutoVariableSummaries
-                            else "PointType @ 0x"
+                            else "PointType"
                         )
                     },
                     "missing": ["indexedVariables"],
diff --git a/lldb/tools/lldb-dap/JSONUtils.cpp b/lldb/tools/lldb-dap/JSONUtils.cpp
index 1f9719110cedb..1beee416bf333 100644
--- a/lldb/tools/lldb-dap/JSONUtils.cpp
+++ b/lldb/tools/lldb-dap/JSONUtils.cpp
@@ -814,13 +814,8 @@ VariableDescription::VariableDescription(lldb::SBValue v,
       os_display_value << *effective_summary;
 
       // As last resort, we print its type and address if available.
-    } else {
-      if (!raw_display_type_name.empty()) {
-        os_display_value << raw_display_type_name;
-        lldb::addr_t address = v.GetLoadAddress();
-        if (address != LLDB_INVALID_ADDRESS)
-          os_display_value << " @ " << llvm::format_hex(address, 0);
-      }
+    } else if (!raw_display_type_name.empty()) {
+      os_display_value << raw_display_type_name;
     }
   }
 

@ashgti
Copy link
Contributor

ashgti commented Dec 17, 2025

Just curious, what does this look like if you enable "debug.showVariableTypes": true? That should add the type to the variables UI.

For example, at a breakpoint in lldb/test/API/tools/lldb-dap/variables/main.cpp line 39, I see Screenshot 2025-12-17 at 11 08 27 AM Which makes things somewhat redundant...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants