[llvm-bugs] [Bug 42920] New: LLDB fails to evaluate expression with template class type

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 7 10:18:31 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42920

            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 at lists.llvm.org
          Reporter: sfunkenhauser at google.com
                CC: jdevlieghere at apple.com, llvm-bugs at 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."

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190807/fed922a9/attachment.html>


More information about the llvm-bugs mailing list