This patch implements the GetFunctionDisplayName API which gets
used by the frame-formatting code to decide how to print a
function name.
Currently this API trivially returns false, so we try to parse
the demangled function base-name by hand. We try find the closing
parenthesis by doing a forward scan through the demangled name. However,
for arguments that contain parenthesis (e.g., function pointers)
this would leave garbage in the frame function name.
By re-using the CPlusPlusLanguage parser for this we offload the
need to parse function names to a component that knows how to do this
already.
We leave the existing parsing code in FormatEntity since it's used
in cases where a language-plugin is not available (and is not
necessarily C++ specific).
Example
For following function:
int foo(std::function<int(void)> const& func) { return 1; }
Before patch:
frame #0: 0x000000010000151c a.out`foo(func= Function = bar() )> const&) at sample.cpp:11:49
After patch:
frame #0: 0x000000010000151c a.out`foo(func= Function = bar() ) at sample.cpp:11:49
Testing
- Added shell test
Not great that this is copied from FormatEntity but didn't see a great way of making this a useful API across both components