[lldb-dev] RTTI does not work stable in LLDB.
Roman Popov via lldb-dev
lldb-dev at lists.llvm.org
Sun Feb 5 13:19:33 PST 2017
Hello,
I'm observing very strange LLDB behavior: it does not always shows a
correct dynamic type when I ask for.
Originally I was working with LLDB 3.9, but it looks like trunk version
behaves the same strange way.
I was able to capture this behavior in a small code snippet:
#include <iostream>
#include <typeinfo>
using namespace std;
struct base_type { virtual ~base_type(){} };
template <class T1, class T2, unsigned SIZE>
struct derived0 : base_type {};
template <class T1, class T2>
struct derived1 : base_type {};
int main(int argc, char ** argv) {
base_type * bptr0 = new derived0<int, int, 1024>();
base_type * bptr1 = new derived1<int, int >();
cout << typeid(*bptr0).name() << endl;
cout << typeid(*bptr1).name() << endl;
return 0;
}
lldb --version
lldb version 5.0.0 (http://llvm.org/svn/llvm-project/lldb/trunk revision
293398)
clang revision 293398
llvm revision 293398
Testing in LLDB:
(lldb) break set --file main.cpp --line 22
(lldb) expression -d no-run -- bptr1
(derived1<int, int> *) $2 = 0x0000000000614c40
(lldb) expression -d no-run -- bptr0
*(base_type *) $3 = 0x0000000000614c20*
Can someone explain me why for bptr0 I dont get a derived0<int, int, 1024>
* as I expected?
Thanks,
Roman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20170205/8becd980/attachment.html>
More information about the lldb-dev
mailing list