Skip to content

Commit e269c2b

Browse files
authored
[lldb] Show value for libcxx and libstdcxx summary and remove pointer value in libcxx container summary (#125294)
This has two changes: 1. Set show value for libcxx and libstdcxx summary provider. This will print the pointer value for both pointer type and reference type. 2. Remove pointer value printing in libcxx container summary. Discussion: https://discourse.llvm.org/t/lldb-hides-raw-pointer-value-for-libcxx-and-libstdcxx-pointer-types-in-summary-string/84226
1 parent a29ed04 commit e269c2b

File tree

7 files changed

+44
-42
lines changed

7 files changed

+44
-42
lines changed

lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
641641
.SetSkipPointers(false)
642642
.SetSkipReferences(false)
643643
.SetDontShowChildren(true)
644-
.SetDontShowValue(true)
644+
.SetDontShowValue(false)
645645
.SetShowMembersOneLiner(false)
646646
.SetHideItemNames(false);
647647

@@ -1204,7 +1204,7 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
12041204
.SetSkipPointers(false)
12051205
.SetSkipReferences(false)
12061206
.SetDontShowChildren(true)
1207-
.SetDontShowValue(true)
1207+
.SetDontShowValue(false)
12081208
.SetShowMembersOneLiner(false)
12091209
.SetHideItemNames(false);
12101210

lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,12 +430,6 @@ size_t lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::
430430

431431
bool lldb_private::formatters::LibcxxContainerSummaryProvider(
432432
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
433-
if (valobj.IsPointerType()) {
434-
uint64_t value = valobj.GetValueAsUnsigned(0);
435-
if (!value)
436-
return false;
437-
stream.Printf("0x%016" PRIx64 " ", value);
438-
}
439433
return FormatEntity::FormatStringRef("size=${svar%#}", stream, nullptr,
440434
nullptr, nullptr, &valobj, false, false);
441435
}

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/TestDataFormatterLibcxxDeque.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,27 @@
99

1010

1111
class LibcxxDequeDataFormatterTestCase(TestBase):
12-
def check_numbers(self, var_name):
12+
def check_numbers(self, var_name, show_ptr=False):
13+
patterns = []
14+
substrs = [
15+
"[0] = 1",
16+
"[1] = 12",
17+
"[2] = 123",
18+
"[3] = 1234",
19+
"[4] = 12345",
20+
"[5] = 123456",
21+
"[6] = 1234567",
22+
"}",
23+
]
24+
if show_ptr:
25+
patterns = [var_name + " = 0x.* size=7"]
26+
else:
27+
substrs.insert(0, var_name + " = size=7")
1328
self.expect(
1429
"frame variable " + var_name,
15-
substrs=[
16-
var_name + " = size=7",
17-
"[0] = 1",
18-
"[1] = 12",
19-
"[2] = 123",
20-
"[3] = 1234",
21-
"[4] = 12345",
22-
"[5] = 123456",
23-
"[6] = 1234567",
24-
"}",
25-
],
30+
patterns=patterns,
31+
substrs=substrs,
2632
)
27-
2833
self.expect_expr(
2934
var_name,
3035
result_summary="size=7",
@@ -75,7 +80,7 @@ def test_ref_and_ptr(self):
7580
)
7681

7782
# The reference should display the same was as the value did
78-
self.check_numbers("ref")
83+
self.check_numbers("ref", True)
7984

8085
# The pointer should just show the right number of elements:
8186
self.expect("frame variable ptr", substrs=["ptr =", " size=7"])

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/span/TestDataFormatterLibcxxSpan.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,4 @@ def test_ref_and_ptr(self):
172172

173173
# The pointer should just show the right number of elements:
174174

175-
ptrAddr = self.findVariable("ptr").GetValue()
176-
self.expect_expr(
177-
"ptr", result_type="std::span<int, 5> *", result_summary=f"{ptrAddr} size=5"
178-
)
175+
self.expect("frame variable ptr", patterns=["ptr = 0x.*", " size=5"])

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_with_run_command(self):
4747

4848
self.expect(
4949
"frame variable v1_ref",
50-
substrs=["v1_ref = Active Type = int : {", "Value = 12", "}"],
50+
patterns=["v1_ref = 0x.* Active Type = int : {", "Value = 12", "}"],
5151
)
5252

5353
self.expect(

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,28 @@
1010

1111

1212
class LibcxxVectorDataFormatterTestCase(TestBase):
13-
def check_numbers(self, var_name):
13+
def check_numbers(self, var_name, show_ptr=False):
14+
patterns = []
15+
substrs = [
16+
"[0] = 1",
17+
"[1] = 12",
18+
"[2] = 123",
19+
"[3] = 1234",
20+
"[4] = 12345",
21+
"[5] = 123456",
22+
"[6] = 1234567",
23+
"}",
24+
]
25+
if show_ptr:
26+
patterns = [var_name + " = 0x.* size=7"]
27+
else:
28+
substrs.insert(0, var_name + " = size=7")
29+
1430
self.expect(
1531
"frame variable " + var_name,
16-
substrs=[
17-
var_name + " = size=7",
18-
"[0] = 1",
19-
"[1] = 12",
20-
"[2] = 123",
21-
"[3] = 1234",
22-
"[4] = 12345",
23-
"[5] = 123456",
24-
"[6] = 1234567",
25-
"}",
26-
],
32+
patterns=patterns,
33+
substrs=substrs,
2734
)
28-
2935
self.expect_expr(
3036
var_name,
3137
result_summary="size=7",
@@ -174,7 +180,7 @@ def test_ref_and_ptr(self):
174180
)
175181

176182
# The reference should display the same was as the value did
177-
self.check_numbers("ref")
183+
self.check_numbers("ref", True)
178184

179185
# The pointer should just show the right number of elements:
180186

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/variant/TestDataFormatterLibStdcxxVariant.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_with_run_command(self):
3030
for name in ["v1_ref", "v1_typedef_ref"]:
3131
self.expect(
3232
"frame variable " + name,
33-
substrs=[name + " = Active Type = int : {", "Value = 12", "}"],
33+
patterns=[name + " = 0x.* Active Type = int : {", "Value = 12", "}"],
3434
)
3535

3636
self.expect(

0 commit comments

Comments
 (0)