diff options
author | shafik <syaghmour@apple.com> | 2019-11-12 11:23:38 -0800 |
---|---|---|
committer | shafik <syaghmour@apple.com> | 2019-11-12 11:30:18 -0800 |
commit | 91e94a7015f14f78809e875c43acbd341d081479 (patch) | |
tree | 262e3237ca8625aee0bfe5b6ea7b21bfb03b94e6 /lldb/packages/Python/lldbsuite/test | |
parent | 7af6025bd12eb086341c3076b760b053a9c2625f (diff) | |
download | bcm5719-llvm-91e94a7015f14f78809e875c43acbd341d081479.tar.gz bcm5719-llvm-91e94a7015f14f78809e875c43acbd341d081479.zip |
[LLDB][Formatters] Re-enable std::function formatter with fixes to improve non-cached lookup performance
Performance issues lead to the libc++ std::function formatter to be disabled. We addressed some of those performance issues by adding caching see D67111
This PR fixes the first lookup performance by not using FindSymbolsMatchingRegExAndType(...) and instead finding the compilation unit the std::function wrapped callable should be in and then searching for the callable directly in the CU.
Differential Revision: https://reviews.llvm.org/D69913
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
3 files changed, 19 insertions, 15 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py index a0cf19b3bed..ea03084cbe6 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py @@ -17,24 +17,22 @@ class LibCxxFunctionTestCase(TestBase): # Run frame var for a variable twice. Verify we do not hit the cache # the first time but do the second time. - def run_frame_var_check_cache_use(self, variable, result_to_match): + def run_frame_var_check_cache_use(self, variable, result_to_match, skip_find_function=False): self.runCmd("log timers reset") self.expect("frame variable " + variable, substrs=[variable + " = " + result_to_match]) - self.expect("log timers dump", - substrs=["lldb_private::Module::FindSymbolsMatchingRegExAndType"]) + if not skip_find_function: + self.expect("log timers dump", + substrs=["lldb_private::CompileUnit::FindFunction"]) self.runCmd("log timers reset") self.expect("frame variable " + variable, substrs=[variable + " = " + result_to_match]) self.expect("log timers dump", matching=False, - substrs=["lldb_private::Module::FindSymbolsMatchingRegExAndType"]) + substrs=["lldb_private::CompileUnit::FindFunction"]) - # Temporarily skipping for everywhere b/c we are disabling the std::function formatter - # due to performance issues but plan on turning it back on once they are addressed. - @skipIf @add_test_categories(["libc++"]) def test(self): """Test that std::function as defined by libc++ is correctly printed by LLDB""" @@ -61,8 +59,10 @@ class LibCxxFunctionTestCase(TestBase): lldbutil.continue_to_breakpoint(self.process(), bkpt) self.run_frame_var_check_cache_use("f2", "Lambda in File main.cpp at Line 43") - self.run_frame_var_check_cache_use("f3", "Lambda in File main.cpp at Line 47") - self.run_frame_var_check_cache_use("f4", "Function in File main.cpp at Line 16") + self.run_frame_var_check_cache_use("f3", "Lambda in File main.cpp at Line 47", True) + # TODO reenable this case when std::function formatter supports + # general callable object case. + #self.run_frame_var_check_cache_use("f4", "Function in File main.cpp at Line 16") # These cases won't hit the cache at all but also don't require # an expensive lookup. diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py index 3d2e0321983..348d03ead53 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py @@ -59,10 +59,12 @@ class LibCxxFunctionSteppingIntoCallableTestCase(TestBase): self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec().GetFilename(), self.main_source) ; process.Continue() - thread.StepInto() - self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.source_bar_operator_line ) ; - self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec().GetFilename(), self.main_source) ; - process.Continue() + # TODO reenable this case when std::function formatter supports + # general callable object case. + #thread.StepInto() + #self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.source_bar_operator_line ) ; + #self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec().GetFilename(), self.main_source) ; + #process.Continue() thread.StepInto() self.assertEqual( thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.source_bar_add_num_line ) ; diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/main.cpp index a85e77db040..ebbb05e6d13 100644 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/main.cpp +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/main.cpp @@ -32,7 +32,9 @@ int main (int argc, char *argv[]) return f_mem(bar1) + // Set break point at this line. f1(acc,acc) + // Source main invoking f1 f2(acc) + // Set break point at this line. - f3(acc+1,acc+2) + // Set break point at this line. - f4() + // Set break point at this line. + f3(acc+1,acc+2) + // Set break point at this line. + // TODO reenable this case when std::function formatter supports + // general callable object case. + //f4() + // Set break point at this line. f5(bar1, 10); // Set break point at this line. } |