diff options
author | Greg Clayton <gclayton@apple.com> | 2012-07-11 22:18:24 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-07-11 22:18:24 +0000 |
commit | c3a86bf9f0e774b68b41582937a076d6706f1d30 (patch) | |
tree | e509ab7f6dcd2305671a7af9efbe086167b1e745 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 570ae0b1f73f1c2d710648289b4b1088960cf010 (diff) | |
download | bcm5719-llvm-c3a86bf9f0e774b68b41582937a076d6706f1d30.tar.gz bcm5719-llvm-c3a86bf9f0e774b68b41582937a076d6706f1d30.zip |
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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions