================ @@ -1085,6 +1085,19 @@ std::string VariableDescription::GetResult(llvm::StringRef context) { return description.trim().str(); } +lldb::addr_t GetMemoryReference(lldb::SBValue v) { + if (!v.GetType().IsPointerType() && !v.GetType().IsArrayType()) { + return LLDB_INVALID_ADDRESS; + } + + lldb::SBValue deref = v.Dereference(); + if (!deref.IsValid()) { + return LLDB_INVALID_ADDRESS; + } + + return deref.GetLoadAddress(); ---------------- vogelsgesang wrote:
I addressed the stylistic parts of this comment (`std::optional`, don't check if `Derefence()` succeeded, ...). I am not 100% sure regarding the proposed semantic changes, though, in particular about ``` if (v_type.IsPointerType() || v_type.IsReferenceType()) v = v.Dereference(); ``` This change would lead to a test case failure in the newly added memory tests. The `int not_a_ptr` would now have a memory reference associated. To my understanding of the intended debugging semantics of the DAP, it should not have an associated memory reference, though, since it is not a pointer or pointer-like type 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