aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/functionalities
diff options
context:
space:
mode:
authorMichael Buch <michaelbuch12@gmail.com>2026-01-06 08:41:10 +0000
committerGitHub <noreply@github.com>2026-01-06 08:41:10 +0000
commitdca088023e2b126e67989070d8d47aeea44b414f (patch)
tree8c8812ad42fd80dda8b095571fb3fd98a4c11a80 /lldb/test/API/functionalities
parent8a8447fd0fc00ca8c41cc7265f60ee9a2fb342a3 (diff)
downloadllvm-dca088023e2b126e67989070d8d47aeea44b414f.tar.gz
llvm-dca088023e2b126e67989070d8d47aeea44b414f.tar.bz2
llvm-dca088023e2b126e67989070d8d47aeea44b414f.zip
[lldb][Format] Unwrap references to C-strings when printing C-string summaries (#174398)
Depends on: * https://github.com/llvm/llvm-project/pull/174385 (only last commit is relevant for this review) The `${var%s}` format isn't capable of formatting references to C-strings. So the summary for those becomes `<no value available>`. This patch prevents the system C-string formatter from applying to references, which means the summary for such types will be empty. This prompts LLDB to instead print the child, which is the referenced C-string. Before: ``` (lldb) v ref (const char *&) ref = 0x000000016fdfe960 <no value available> ``` After: ``` (lldb) v ref (const char *&) ref = 0x000000016fdfec40 (&ref = "hi") ``` An alternative would be to support references in the `ValueObject` dump methods. We assume C-string are pointers/arrays in a lot of places, so such a fix would be a more intrusive undertaking, and I'm not sure we would want to support references there in the first place. So for now I went with the fallback logic in this PR.
Diffstat (limited to 'lldb/test/API/functionalities')
-rw-r--r--lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py b/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py
index 3747bb4f1e2f..2a91b455b3c2 100644
--- a/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py
+++ b/lldb/test/API/functionalities/data-formatter/stringprinter/TestStringPrinter.py
@@ -51,15 +51,17 @@ class TestStringPrinter(TestBase):
# FIXME: make "b.data" and "c.data" work sanely
+ self.expect("frame variable ref", substrs=['(&ref = "Hello")'])
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("frame variable refref", substrs=['(&refref = "Hi")'])
self.expect_var_path(
"refref",
- summary="<no value available>",
+ summary=None,
children=[ValueCheck(name="&refref", summary='"Hi"')],
)