Modifying the "address" format, which prints a pointer and a description of...
Modifying the "address" format, which prints a pointer and a description of what it points to, to detect when the deref of that pointer points to something valid. So if you have: % cat sp.cpp #include <tr1/memory> class A { public: A (): m_i (12) {} virtual ~A() {} private: int m_i; }; int main (int argc, char const *argv[], char const *envp[]) { A *a_pointers[2] = { NULL, NULL }; A a1; A a2; a_pointers[0] = &a1; a_pointers[1] = &a2; return 0; } And you stop at the "return 0", you can now read memory using the "address" format and see: (lldb) memory read --format address `&a_pointers` 0x7fff5fbff870: 0x00007fff5fbff860 -> 0x00000001000010b0 vtable for A + 16 0x7fff5fbff878: 0x00007fff5fbff850 -> 0x00000001000010b0 vtable for A + 16 0x7fff5fbff880: 0x00007fff5fbff8d0 0x7fff5fbff888: 0x00007fff5fbff8c0 0x7fff5fbff890: 0x0000000000000001 0x7fff5fbff898: 0x36d54c275add2294 0x7fff5fbff8a0: 0x00007fff5fbff8b0 0x7fff5fbff8a8: 0x0000000100000bb4 a.out`start + 52 Note the extra dereference that was applied to 0x00007fff5fbff860 and 0x00007fff5fbff850 so we can see that these are "A" classes. llvm-svn: 160085
Loading
Please register or sign in to comment