This improves the handling of `$` (dollar) characters in summary strings in the
following ways:
1. When a `$` is not followed by an open paren (`{`), it should be treated as a literal
character and preserved in the output. Previously, the dollar would be consumed by the
parser and not shown in the output.
2. When a `$` is the last character of a format string, this change eliminates the
infinite loop lldb would enter into.
rdar://131392446
19 lines
806 B
Python
19 lines
806 B
Python
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test import lldbutil
|
|
|
|
|
|
class TestCase(TestBase):
|
|
def test_summary_string_with_bare_dollar_char(self):
|
|
self.build()
|
|
lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c"))
|
|
self.runCmd("type summary add --summary-string '$ $CASH $' --no-value Dollars")
|
|
self.expect("v cash", startstr="(Dollars) cash = $ $CASH $")
|
|
|
|
def test_summary_string_with_bare_dollar_char_before_var(self):
|
|
self.build()
|
|
lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c"))
|
|
self.runCmd("type summary add --summary-string '$${var}' --no-value Dollars")
|
|
self.expect("v cash", startstr="(Dollars) cash = $99")
|