[Lldb-commits] [lldb] Bugfix: Not showing the synthetic children of values behind pointers (PR #117755)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 26 10:05:46 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Sergey Kuznetsov (skuznetsov)
<details>
<summary>Changes</summary>
This bug fix for the situation that was extensively discussed at LLVM Discourse thread: https://discourse.llvm.org/t/synthetic-data-providers-and-lldb-dap/
---
Full diff: https://github.com/llvm/llvm-project/pull/117755.diff
1 Files Affected:
- (modified) lldb/tools/lldb-dap/lldb-dap.cpp (+7)
``````````diff
diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp
index 3bfc578806021e..b86994f60f04e5 100644
--- a/lldb/tools/lldb-dap/lldb-dap.cpp
+++ b/lldb/tools/lldb-dap/lldb-dap.cpp
@@ -4020,6 +4020,10 @@ void request_variables(DAP &dap, const llvm::json::Object &request) {
std::optional<std::string> custom_name = {}) {
if (!child.IsValid())
return;
+ if (child.IsSynthetic() && (child.GetType().IsPointerType() || child.GetType().IsReferenceType())) {
+ // Dereference to access synthetic children behind pointers/references
+ child = child.Dereference();
+ }
bool is_permanent =
dap.variables.IsPermanentVariableReference(variablesReference);
int64_t var_ref = dap.variables.InsertVariable(child, is_permanent);
@@ -4028,6 +4032,9 @@ void request_variables(DAP &dap, const llvm::json::Object &request) {
dap.enable_synthetic_child_debugging,
/*is_name_duplicated=*/false, custom_name));
};
+ if (variable.GetType().IsPointerType() || variable.GetType().IsReferenceType()) {
+ variable = variable.Dereference();
+ }
const int64_t num_children = variable.GetNumChildren();
int64_t end_idx = start + ((count == 0) ? num_children : count);
int64_t i = start;
``````````
</details>
https://github.com/llvm/llvm-project/pull/117755
More information about the lldb-commits
mailing list