Bug ID 42920
Summary LLDB fails to evaluate expression with template class type
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity enhancement
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter sfunkenhauser@google.com
CC jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
LLDB fails to evaluate expressions with template class types.
Simple example:
template <typename T> class foo
{
uint32_t data;
};
foo<int> test;
int main() {
return 0;
}
I set a breakpoint on main and try to evaluate the following expression:
(lldb) p sizeof(foo<int>)
error: implicit instantiation of undefined template 'foo<int>'
template is declared here
The debug information is available (It's not being optimized out), and printing
'test' works just fine:
$ readelf --debug-dump a.out | grep foo
<41> DW_AT_name : (indirect string, offset: 0xa): foo<int>
<49> DW_AT_name : (indirect string, offset: 0x0): foo
3f foo<int>
Quoting Jim Ingham from a discussion on lldb-dev@
"LLDB uses clang as its expression parser, which when it sees foo<int>
apparently wants to find a decl called "foo" first, which we don't really have
in the abstract."