diff options
author | Enrico Granata <granata.enrico@gmail.com> | 2011-09-09 00:04:24 +0000 |
---|---|---|
committer | Enrico Granata <granata.enrico@gmail.com> | 2011-09-09 00:04:24 +0000 |
commit | 13f1d561703b62f2b746fac1ae33c49ccf178c76 (patch) | |
tree | 588bca1ea853904d93167a21e8f978b0135066e6 /lldb/tools/debugserver/source/MacOSX/MachTask.h | |
parent | e92aa43b3bc6d6ae1f0d353216a35383b85aabca (diff) | |
download | bcm5719-llvm-13f1d561703b62f2b746fac1ae33c49ccf178c76.tar.gz bcm5719-llvm-13f1d561703b62f2b746fac1ae33c49ccf178c76.zip |
Basic infrastructure code to exploit malloc stack logging as available on Mac OS X to track the allocation history of pointers on the target process
llvm-svn: 139337
Diffstat (limited to 'lldb/tools/debugserver/source/MacOSX/MachTask.h')
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachTask.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachTask.h b/lldb/tools/debugserver/source/MacOSX/MachTask.h index a907e94d344..0e74086a727 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachTask.h +++ b/lldb/tools/debugserver/source/MacOSX/MachTask.h @@ -31,6 +31,23 @@ class MachProcess; +typedef uint64_t MachMallocEventId; + +enum MachMallocEventType +{ + eMachMallocEventTypeAlloc = 2, + eMachMallocEventTypeDealloc = 4, + eMachMallocEventTypeOther = 1 +}; + +struct MachMallocEvent +{ + mach_vm_address_t m_base_address; + uint64_t m_size; + MachMallocEventType m_event_type; + MachMallocEventId m_event_id; +}; + class MachTask { public: @@ -70,6 +87,27 @@ public: MachProcess * Process () { return m_process; } const MachProcess * Process () const { return m_process; } + + + bool HasMallocLoggingEnabled (); + + // enumerate the malloc records for a given address (starting with Mac OS X 10.6 Snow Leopard it should include + // all allocations that *include* address, rather than just those *starting* at address) + bool EnumerateMallocRecords (mach_vm_address_t address, + MachMallocEvent *event_buffer, + uint32_t buffer_size, + uint32_t *count); + + // enumerate every malloc record generated by this task, no matter what the address + bool EnumerateMallocRecords (MachMallocEvent *event_buffer, + uint32_t buffer_size, + uint32_t *count); + + // given a malloc event, report every stack frame that led to this event + bool EnumerateMallocFrames (MachMallocEventId event_id, + mach_vm_address_t *function_addresses_buffer, + uint32_t buffer_size, + uint32_t *count); protected: MachProcess * m_process; // The mach process that owns this MachTask |