Re: [lldb-dev] Evaluate expression for template class

2019-07-24 Thread Jim Ingham via lldb-dev
> On Jul 24, 2019, at 7:23 AM, Scott Funkenhauser > wrote: > > I've tried with LLVM 4, 7 and 8. They all fail to evaluate 'sizeof(foo)'. > The fundamental problem is that DWARF doesn't represent templates per se. It only represents template instantiations. So there's nothing in the debug

Re: [lldb-dev] Evaluate expression for template class

2019-07-24 Thread Scott Funkenhauser via lldb-dev
I've tried with LLVM 4, 7 and 8. They all fail to evaluate 'sizeof(foo)'. I'm also building with '-g' which might be why 'sizeof(foo)' succeeds for me, but fails for you. On Tue, Jul 23, 2019 at 9:07 PM Jim Ingham wrote: > Interesting... What lldb & clang were you using? With current TOT clan

Re: [lldb-dev] Evaluate expression for template class

2019-07-23 Thread Jim Ingham via lldb-dev
Interesting... What lldb & clang were you using? With current TOT clang & lldb I see: (lldb) run Process 83732 launched: '/tmp/template2' (x86_64) Process 83732 stopped * thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1 frame #0: 0x00010fad template2`main at

Re: [lldb-dev] Evaluate expression for template class

2019-07-23 Thread Scott Funkenhauser via lldb-dev
I built with both clang and gcc, the behavior is the same (lldb fails to evaluate the expression, gdb succeeds). Trying to evaluate a template type that hasn't been instantiated fails in both lldb and gdb. ie. (gdb) p sizeof(foo) No symbol "foo" in current context. (lldb) p sizeof(foo) error: impl

Re: [lldb-dev] Evaluate expression for template class

2019-07-23 Thread Jim Ingham via lldb-dev
lldb can't currently create new template instantiations. It can only access ones that were generated in the binary you were debugging. The debug information doesn't have any code, so we can't create new instantiations from there. Having the debugger try to include headers into the expression

[lldb-dev] Evaluate expression for template class

2019-07-23 Thread Scott Funkenhauser via lldb-dev
Hey, I've noticed that evaluating expressions involving templated classes seems to have some unexpected behavior. I've created the following sample code to reproduce the issue: template class foo { uint32_t data; }; foo test; int main() { foo test2; return 0; } I've set a breakpoint on