[Lldb-commits] [lldb] [lldb][Format] Unwrap references to C-strings when printing C-string summaries (PR #174398)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 5 08:27:53 PST 2026
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/174398
>From 4111c7e5d19797ed9152eac947e1777701994624 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Mon, 5 Jan 2026 11:03:34 +0000
Subject: [PATCH 1/2] [lldb][Format] Unwrap references to C-strings when
printing C-string summaries
---
lldb/source/DataFormatters/FormatManager.cpp | 2 +-
.../data-formatter/stringprinter/TestStringPrinter.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp
index 8595f81964fd4..6d3faa5742d63 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -720,7 +720,7 @@ void FormatManager::LoadSystemFormatters() {
TypeSummaryImpl::Flags string_flags;
string_flags.SetCascades(true)
.SetSkipPointers(true)
- .SetSkipReferences(false)
+ .SetSkipReferences(true)
.SetDontShowChildren(true)
.SetDontShowValue(false)
.SetShowMembersOneLiner(false)
diff --git a/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py b/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py
index 3747bb4f1e2fd..eaf8e15552664 100644
--- a/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py
+++ b/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py
@@ -53,13 +53,13 @@ def test(self):
self.expect_var_path(
"ref",
- summary="<no value available>",
+ summary=None,
children=[ValueCheck(name="&ref", summary='"Hello"')],
)
# FIXME: should LLDB use "&&refref" for the name here?
self.expect_var_path(
"refref",
- summary="<no value available>",
+ summary=None,
children=[ValueCheck(name="&refref", summary='"Hi"')],
)
>From 4dc1f6ff080ac1a6d049d6b48228463e10ec54b7 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Mon, 5 Jan 2026 16:27:31 +0000
Subject: [PATCH 2/2] fixup! rebase; adjust tests
---
.../data-formatter/stringprinter/TestStringPrinter.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py b/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py
index eaf8e15552664..2a91b455b3c2a 100644
--- a/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py
+++ b/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py
@@ -51,6 +51,7 @@ def test(self):
# FIXME: make "b.data" and "c.data" work sanely
+ self.expect("frame variable ref", substrs=['(&ref = "Hello")'])
self.expect_var_path(
"ref",
summary=None,
@@ -58,6 +59,7 @@ def test(self):
)
# FIXME: should LLDB use "&&refref" for the name here?
+ self.expect("frame variable refref", substrs=['(&refref = "Hi")'])
self.expect_var_path(
"refref",
summary=None,
More information about the lldb-commits
mailing list