Bug ID 40062
Summary lldb cannot deduce dynamic most derived type for types with lambda type as template argument
Product lldb
Version unspecified
Hardware PC
OS MacOS X
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter erik@olofsson.info
CC llvm-bugs@lists.llvm.org
main.cpp:
struct CStoreFunctor
{
virtual ~CStoreFunctor() = default;
};
template <typename t_CFunctor>
struct TCStoreFunctor : public CStoreFunctor
{
TCStoreFunctor(t_CFunctor _fFunctor)
: m_fFunctor(_fFunctor)
{
}
t_CFunctor m_fFunctor;
};
struct CTestFunctor
{
void operator() () const
{
}
};
int main()
{
TCStoreFunctor<CTestFunctor> Test0{{}};
CStoreFunctor *pTest0 = &Test0;
auto fTest = []
{
}
;
TCStoreFunctor<decltype(fTest)> Test1{fTest};
CStoreFunctor *pTest1 = &Test1;
return 0;
}
# clang++ testdebug.cpp -g -o test -std=c++17
# lldb test
(lldb) break set --file main.cpp --line 39
(lldb) run
(lldb) p pTest0
(TCStoreFunctor<CTestFunctor> *) $0 = 0x00007ffeefbff7a8
(lldb) p pTest1
(CStoreFunctor *) $1 = 0x00007ffeefbff780
I tracked this down to ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress
where the type name is:
0x00007ffeefbff780: static-type = 'CStoreFunctor *' has vtable symbol 'vtable
for TCStoreFunctor<main::$_0>'
It's then using this name 'TCStoreFunctor<main::$_0>' to lookup the type with
FindTypes. The problem is that the dwarf info has another name for
this type:
(lldb) script
>>> for type in lldb.target.GetModuleAtIndex(0).GetTypes():
... print type.GetName()
...
TCStoreFunctor<(lambda at main.cpp:31:15)>
TCStoreFunctor<(anonymous class)> *