Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
.SetSkipPointers(false)
.SetSkipReferences(false)
.SetDontShowChildren(true)
.SetDontShowValue(true)
.SetDontShowValue(false)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false);

Expand Down Expand Up @@ -1204,7 +1204,7 @@ static void LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
.SetSkipPointers(false)
.SetSkipReferences(false)
.SetDontShowChildren(true)
.SetDontShowValue(true)
.SetDontShowValue(false)
.SetShowMembersOneLiner(false)
.SetHideItemNames(false);

Expand Down
6 changes: 0 additions & 6 deletions lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,6 @@ size_t lldb_private::formatters::LibcxxUniquePtrSyntheticFrontEnd::

bool lldb_private::formatters::LibcxxContainerSummaryProvider(
ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
if (valobj.IsPointerType()) {
uint64_t value = valobj.GetValueAsUnsigned(0);
if (!value)
return false;
stream.Printf("0x%016" PRIx64 " ", value);
}
return FormatEntity::FormatStringRef("size=${svar%#}", stream, nullptr,
nullptr, nullptr, &valobj, false, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,37 @@


class LibcxxDequeDataFormatterTestCase(TestBase):
def check_numbers(self, var_name):
self.expect(
"frame variable " + var_name,
substrs=[
var_name + " = size=7",
"[0] = 1",
"[1] = 12",
"[2] = 123",
"[3] = 1234",
"[4] = 12345",
"[5] = 123456",
"[6] = 1234567",
"}",
],
)

def check_numbers(self, var_name, show_ptr = False):
if show_ptr:
self.expect(
"frame variable " + var_name,
patterns=[var_name + " = 0x.* size=7"],
substrs=[
"[0] = 1",
"[1] = 12",
"[2] = 123",
"[3] = 1234",
"[4] = 12345",
"[5] = 123456",
"[6] = 1234567",
"}",
],
)
else:
self.expect(
"frame variable " + var_name,
substrs=[
var_name + " = size=7",
"[0] = 1",
"[1] = 12",
"[2] = 123",
"[3] = 1234",
"[4] = 12345",
"[5] = 123456",
"[6] = 1234567",
"}",
],
)
self.expect_expr(
var_name,
result_summary="size=7",
Expand Down Expand Up @@ -75,7 +90,7 @@ def test_ref_and_ptr(self):
)

# The reference should display the same was as the value did
self.check_numbers("ref")
self.check_numbers("ref", True)

# The pointer should just show the right number of elements:
self.expect("frame variable ptr", substrs=["ptr =", " size=7"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,4 @@ def test_ref_and_ptr(self):

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

ptrAddr = self.findVariable("ptr").GetValue()
self.expect_expr(
"ptr", result_type="std::span<int, 5> *", result_summary=f"{ptrAddr} size=5"
)
self.expect("frame variable ptr", patterns=["ptr = 0x.*", " size=5"])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SBValue::GetValue essentially uses the summary string provided by summary provider. So it returns "size=5" after I removed the pointer value in libcxx container summary.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, but you can still use expect_expr to match this. You just need to say result_summary=re.compile("your_pattern")

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_with_run_command(self):

self.expect(
"frame variable v1_ref",
substrs=["v1_ref = Active Type = int : {", "Value = 12", "}"],
patterns=["v1_ref = 0x.* Active Type = int : {", "Value = 12", "}"],
)

self.expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,37 @@


class LibcxxVectorDataFormatterTestCase(TestBase):
def check_numbers(self, var_name):
self.expect(
"frame variable " + var_name,
substrs=[
var_name + " = size=7",
"[0] = 1",
"[1] = 12",
"[2] = 123",
"[3] = 1234",
"[4] = 12345",
"[5] = 123456",
"[6] = 1234567",
"}",
],
)

def check_numbers(self, var_name, show_ptr = False):
if show_ptr:
self.expect(
"frame variable " + var_name,
patterns=[var_name + " = 0x.* size=7"],
substrs=[
"[0] = 1",
"[1] = 12",
"[2] = 123",
"[3] = 1234",
"[4] = 12345",
"[5] = 123456",
"[6] = 1234567",
"}",
],
)
else:
self.expect(
"frame variable " + var_name,
substrs=[
var_name + " = size=7",
"[0] = 1",
"[1] = 12",
"[2] = 123",
"[3] = 1234",
"[4] = 12345",
"[5] = 123456",
"[6] = 1234567",
"}",
],
)
self.expect_expr(
var_name,
result_summary="size=7",
Expand Down Expand Up @@ -174,7 +189,7 @@ def test_ref_and_ptr(self):
)

# The reference should display the same was as the value did
self.check_numbers("ref")
self.check_numbers("ref", True)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_with_run_command(self):
for name in ["v1_ref", "v1_typedef_ref"]:
self.expect(
"frame variable " + name,
substrs=[name + " = Active Type = int : {", "Value = 12", "}"],
patterns=[name + " = 0x.* Active Type = int : {", "Value = 12", "}"],
)

self.expect(
Expand Down
Loading