drsyms on mach-o returns symbols that do not exist in that library
Dr. Memory is crashing on some C++ Mac apps and it turns out the reason is because drsyms is returning addresses for symbols which are incorrect.
$ bin64/symquery -e /usr/lib/libc++.1.dylib -v -s 'operator delete'
<debug info: type=Mach-O symtab, has symbols, NO line numbers>
+0x19f2a
$ bin64/symquery -e /usr/lib/libc++.1.dylib -v --list | grep 'operator delete '
operator delete +0x19f2a-0x19f48
operator delete +0x19f48-0x19f75
operator delete +0x19f75-0x19f90
operator delete +0x19fb1-0x19fdf
operator delete +0x19fdf-0x1a000
operator delete +0x1a000-0x1a01f
Yet none of those are "operator delete" and in fact there is no such function in that library:
(lldb) di -n "libc++.1!operator delete" -c 1
error: Unable to find symbol with name 'libc++.1!operator delete'.
(lldb) di -s 0x00007fff70160000+0x19f2a -c 1
libc++.1.dylib`std::__1::__input_arithmetic<unsigned short, char, std::__1::char_traits<char> >:
0x7fff70179f2a <+194>: addb %cl, -0x77(%rcx)
These symbols that drsyms is seeing seem to be imports and indirects:
U operator delete(void*)
I operator delete(void*) (indirect for __ZdlPv)
U operator delete(void*, std::nothrow_t const&)
I operator delete(void*, std::nothrow_t const&) (indirect for __ZdlPvRKSt9nothrow_t)
U operator delete(void*, std::align_val_t)
I operator delete(void*, std::align_val_t) (indirect for __ZdlPvSt11align_val_t)
U operator delete(void*, std::align_val_t, std::nothrow_t const&)
I operator delete(void*, std::align_val_t, std::nothrow_t const&) (indirect for __ZdlPvSt11align_val_tRKSt9nothrow_t)
U operator delete(void*, unsigned long)
I operator delete(void*, unsigned long) (indirect for __ZdlPvm)
U operator delete(void*, unsigned long, std::align_val_t)
I operator delete(void*, unsigned long, std::align_val_t) (indirect for __ZdlPvmSt11align_val_t)
The drsyms code should resolve indirects to what they point at.