================
@@ -1085,6 +1084,17 @@ std::string 
VariableDescription::GetResult(llvm::StringRef context) {
   return description.trim().str();
 }
 
+std::optional<lldb::addr_t> GetMemoryReference(lldb::SBValue v) {
+  if (!v.GetType().IsPointerType() && !v.GetType().IsArrayType())
+    return std::nullopt;
+
----------------
vogelsgesang wrote:

The proposed code would led to `my_value` and `my_ptr` having the same 
`memoryReference` in the following code snippet:

```
   int my_value;
   int* my_ptr = &my_value;
```

Also, when entering `my_value` and `&my_value` into the debug console, I would 
get the same memory references back. As a user, I would find this very 
confusing.

As such, I do prefer the current semantics, where `my_value` does not have a 
memory reference. If users want to get to that memory location, they can use 
`&my_value`

(Also, I noticed that the current code did not work for arrays. Hence, I 
removed the `IsArrayType`)

https://github.com/llvm/llvm-project/pull/104317
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to