With this commit, we also hide the implementation details of `std::invoke`. To do so, the `LibCXXFrameRecognizer` got a couple more regular expressions. The regular expression passed into `AddRecognizer` became problematic, as it was evaluated on the demangled name. Those names also included result types for C++ symbols. For `std::__invoke` the return type is a huge `decltype(...)`, making the regular expresison really hard to write. Instead, I added support to `AddRecognizer` for matching on the demangled names without result type and argument types. By hiding the implementation details of `invoke`, also the back traces for `std::function` become even nicer, because `std::function` is using `__invoke` internally. Co-authored-by: Adrian Prantl <aprantl@apple.com>
45 lines
1.5 KiB
Python
45 lines
1.5 KiB
Python
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
from lldbsuite.test import lldbutil
|
|
|
|
|
|
class LibCxxStdFunctionRecognizerTestCase(TestBase):
|
|
NO_DEBUG_INFO_TESTCASE = True
|
|
|
|
@add_test_categories(["libc++"])
|
|
def test_frame_recognizer(self):
|
|
"""Test that implementation details of `std::invoke` are hidden"""
|
|
self.build()
|
|
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
|
|
self, "break here", lldb.SBFileSpec("main.cpp")
|
|
)
|
|
|
|
stop_cnt = 0
|
|
while process.GetState() != lldb.eStateExited:
|
|
stop_cnt += 1
|
|
self.assertTrue(
|
|
any(
|
|
f in thread.GetFrameAtIndex(0).GetFunctionName()
|
|
for f in ["consume_number", "add", "Callable"]
|
|
)
|
|
)
|
|
# Skip all hidden frames
|
|
frame_id = 1
|
|
while (
|
|
frame_id < thread.GetNumFrames()
|
|
and thread.GetFrameAtIndex(frame_id).IsHidden()
|
|
):
|
|
frame_id = frame_id + 1
|
|
# Expect `std::invoke` to be the direct parent
|
|
self.assertIn(
|
|
"::invoke", thread.GetFrameAtIndex(frame_id).GetFunctionName()
|
|
)
|
|
# And right above that, there should be the `main` frame
|
|
self.assertIn(
|
|
"main", thread.GetFrameAtIndex(frame_id + 1).GetFunctionName()
|
|
)
|
|
process.Continue()
|
|
|
|
self.assertEqual(stop_cnt, 4)
|