[Lldb-commits] [lldb] [lldb] Fix ForwardListFrontEnd::CalculateNumChildren (PR #139805)
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Tue May 13 15:51:24 PDT 2025
https://github.com/kastiglione created https://github.com/llvm/llvm-project/pull/139805
Fixes the calculation of the number of children for `std::forward_list` to no longer be
capped. The calculation was capped by the value of `target.max-children-count`.
This resulted in at least the following problems:
1. The summary formatter would display the incorrect size when the size was greater than
`max-child-count`.
2. The elision marker (`...`) would not be shown when the number of elements was greater
than `max-child-count`.
>From beeb0d9d29e098e4a7063541f657e4ec65db285d Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Tue, 13 May 2025 15:45:44 -0700
Subject: [PATCH] [lldb] Fix ForwardListFrontEnd::CalculateNumChildren
Fixes the calculation of the number of children for `std::forward_list` to no longer be
capped. The calculation was capped by the value of `target.max-children-count`.
This resulted in at least the following problems:
1. The summary formatter would display the incorrect size when the size was greater than
`max-child-count`.
2. The elision marker (`...`) would not be shown when the number of elements was greater
than `max-child-count`.
---
lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp | 2 +-
.../TestDataFormatterGenericForwardList.py | 11 ++++++-----
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
index 30db5f15c388f..e3c200da6a0f5 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp
@@ -251,7 +251,7 @@ llvm::Expected<uint32_t> ForwardListFrontEnd::CalculateNumChildren() {
ListEntry current(m_head);
m_count = 0;
- while (current && m_count < m_list_capping_size) {
+ while (current) {
++m_count;
current = current.next();
}
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
index 185a24cf6dce3..1639d7275b407 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/forward_list/TestDataFormatterGenericForwardList.py
@@ -53,13 +53,14 @@ def do_test(self, stdlib_type):
substrs=["target.max-children-count (unsigned) = 256"],
)
+ self.runCmd("settings set target.max-children-count 256", check=False)
self.expect(
"frame variable thousand_elts",
matching=False,
- substrs=["[256]", "[333]", "[444]", "[555]", "[666]", "..."],
+ substrs=["[256]", "[333]", "[444]", "[555]", "[666]"],
)
- self.runCmd("settings set target.max-children-count 3", check=False)
+ self.runCmd("settings set target.max-children-count 3", check=False)
self.expect(
"frame variable thousand_elts",
matching=False,
@@ -73,7 +74,7 @@ def do_test(self, stdlib_type):
self.expect(
"frame variable thousand_elts",
matching=True,
- substrs=["size=256", "[0]", "[1]", "[2]", "..."],
+ substrs=["size=1000", "[0]", "[1]", "[2]", "..."],
)
def do_test_ptr_and_ref(self, stdlib_type):
@@ -138,7 +139,7 @@ def do_test_ptr_and_ref(self, stdlib_type):
"frame variable ref",
matching=True,
substrs=[
- "size=256",
+ "size=1000",
"[0] = 999",
"[1] = 998",
"[2] = 997",
@@ -149,7 +150,7 @@ def do_test_ptr_and_ref(self, stdlib_type):
"frame variable *ptr",
matching=True,
substrs=[
- "size=256",
+ "size=1000",
"[0] = 999",
"[1] = 998",
"[2] = 997",
More information about the lldb-commits
mailing list