<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/111291>111291</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[LLDB] Unreliable CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mentlerd
</td>
</tr>
</table>
<pre>
`CPPLanguageRuntime::FindLibCppStdFunctionCallableInfo` fails to extract the callable information from an `std::function` which is constructed from a lambda inside a function which has multiple parameters due to this part of it's implementation:
https://github.com/llvm/llvm-project/blob/8ebd4019500cbec28426f19e6440484d53ecaecd/lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp#L293-L311
As a consequence, `std::function` summary cannot print the target function's description, and stepping into `operator()` does not work.
I have augmented LLDB's logging locally to confirm that this is indeed where things go wrong:
```c++
#include <functional>
std::function<void()> GetFunc() {
return []{ printf("func\n"); };
}
std::function<void()> GetFunc1(int a) {
return [=]{ printf("func1(%d)\n", a); };
}
std::function<void()> GetFunc2(int a, int b) {
return [=]{ printf("func2(%d,%d)\n", a, b); };
}
int main() {
auto f1 = GetFunc();
auto f2 = GetFunc1(10);
auto f3 = GetFunc2(10, 10);
printf("Breakpoint here\n");
/*
vtable_name='vtable for std::__1::__function::__func<GetFunc()::$_0, std::__1::allocator<GetFunc()::$_0>, void ()>'
first_template_parameter='GetFunc()::$_0'
vtable_name='vtable for std::__1::__function::__func<GetFunc1(int)::$_0, std::__1::allocator<GetFunc1(int)::$_0>, void ()>'
first_template_parameter='GetFunc1(int)::$_0'
vtable_name='vtable for std::__1::__function::__func<GetFunc2(int, int)::$_0, std::__1::allocator<GetFunc2(int, int)::$_0>, void ()>'
first_template_parameter='GetFunc2(int'
*/
return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vk2P6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