diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
4 files changed, 45 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/Makefile b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/Makefile new file mode 100644 index 00000000000..224ecc3c2f5 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/Makefile @@ -0,0 +1,3 @@ +C_SOURCES := a.c b.c + +include Makefile.rules diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/TestDataFormatterCaching.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/TestDataFormatterCaching.py new file mode 100644 index 00000000000..8b906506a5b --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/TestDataFormatterCaching.py @@ -0,0 +1,27 @@ +import lldb +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +import lldbsuite.test.lldbutil as lldbutil + + +class TestDataFormatterCaching(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + def setUp(self): + TestBase.setUp(self) + + def test_with_run_command(self): + """ + Test that hardcoded summary formatter matches aren't improperly cached. + """ + self.build() + target, process, thread, bkpt = lldbutil.run_to_source_breakpoint( + self, 'break here', lldb.SBFileSpec('a.c')) + valobj = self.frame().FindVariable('f') + self.assertEqual(valobj.GetValue(), '4') + bkpt_b = target.BreakpointCreateBySourceRegex('break here', + lldb.SBFileSpec('b.c')) + lldbutil.continue_to_breakpoint(process, bkpt_b) + valobj = self.frame().FindVariable('f4') + self.assertEqual(valobj.GetSummary(), '(1, 2, 3, 4)') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/a.c b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/a.c new file mode 100644 index 00000000000..ab0b6f5bd5e --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/a.c @@ -0,0 +1,7 @@ +typedef float float4; + +int main() { + float4 f = 4.0f; + // break here + return a(); +} diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/b.c b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/b.c new file mode 100644 index 00000000000..0d37c54aa33 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-caching/b.c @@ -0,0 +1,8 @@ +typedef float float4 __attribute__((ext_vector_type(4))); +void stop() {} +int a() { + float4 f4 = {1, 2, 3, 4}; + // break here + stop(); + return 0; +} |