diff options
author | Han Ming Ong <hanming@apple.com> | 2013-06-26 20:46:27 +0000 |
---|---|---|
committer | Han Ming Ong <hanming@apple.com> | 2013-06-26 20:46:27 +0000 |
commit | 6db14a996563072f07a7da85b42a56bf72e6133d (patch) | |
tree | a67d5f68fd2d9582c6d71080ad0739ffdaa14731 /lldb | |
parent | 4ff0dbb615e1984870dee4f69fe8f1fc210fb1ca (diff) | |
download | bcm5719-llvm-6db14a996563072f07a7da85b42a56bf72e6133d.tar.gz bcm5719-llvm-6db14a996563072f07a7da85b42a56bf72e6133d.zip |
<rdar://problem/14262854>
Match up with top’s implementation on recent Cab as API has changed a bit.
Tested the same binary running on Zin as well. Tested ARM binary on iOS as well.
llvm-svn: 185017
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp b/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp index af82fc9f9c4..47f8f8a8fe3 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachVMMemory.cpp @@ -418,7 +418,7 @@ MachVMMemory::GetMemorySizes(task_t task, cpu_type_t cputype, nub_process_t pid, } #if defined (TASK_VM_INFO) && TASK_VM_INFO >= 22 - +#ifndef TASK_VM_INFO_PURGEABLE // cribbed from sysmond static uint64_t SumVMPurgeableInfo(const vm_purgeable_info_t info) @@ -438,7 +438,7 @@ SumVMPurgeableInfo(const vm_purgeable_info_t info) return sum; } - +#endif /* !TASK_VM_INFO_PURGEABLE */ #endif static void @@ -447,11 +447,14 @@ GetPurgeableAndAnonymous(task_t task, uint64_t &purgeable, uint64_t &anonymous) #if defined (TASK_VM_INFO) && TASK_VM_INFO >= 22 kern_return_t kr; +#ifndef TASK_VM_INFO_PURGEABLE task_purgable_info_t purgeable_info; uint64_t purgeable_sum = 0; +#endif /* !TASK_VM_INFO_PURGEABLE */ mach_msg_type_number_t info_count; task_vm_info_data_t vm_info; +#ifndef TASK_VM_INFO_PURGEABLE typedef kern_return_t (*task_purgable_info_type) (task_t, task_purgable_info_t *); task_purgable_info_type task_purgable_info_ptr = NULL; task_purgable_info_ptr = (task_purgable_info_type)dlsym(RTLD_NEXT, "task_purgable_info"); @@ -463,11 +466,20 @@ GetPurgeableAndAnonymous(task_t task, uint64_t &purgeable, uint64_t &anonymous) purgeable = purgeable_sum; } } +#endif /* !TASK_VM_INFO_PURGEABLE */ info_count = TASK_VM_INFO_COUNT; +#ifdef TASK_VM_INFO_PURGEABLE + kr = task_info(task, TASK_VM_INFO_PURGEABLE, (task_info_t)&vm_info, &info_count); +#else kr = task_info(task, TASK_VM_INFO, (task_info_t)&vm_info, &info_count); +#endif if (kr == KERN_SUCCESS) { +#ifdef TASK_VM_INFO_PURGEABLE + purgeable = vm_info.purgeable_volatile_resident; + anonymous = vm_info.internal - vm_info.purgeable_volatile_pmap; +#else if (purgeable_sum < vm_info.internal) { anonymous = vm_info.internal - purgeable_sum; @@ -476,8 +488,9 @@ GetPurgeableAndAnonymous(task_t task, uint64_t &purgeable, uint64_t &anonymous) { anonymous = 0; } +#endif } - + #endif } |