[Lldb-commits] [lldb] [lldb-dap] Support inspecting memory (PR #104317)
Adrian Vogelsgesang via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 15 04:13:01 PDT 2024
================
@@ -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
More information about the lldb-commits
mailing list