[Lldb-commits] [lldb] r185017 - <rdar://problem/14262854>

Han Ming Ong hanming at apple.com
Wed Jun 26 13:46:27 PDT 2013


Author: hanming
Date: Wed Jun 26 15:46:27 2013
New Revision: 185017

URL: http://llvm.org/viewvc/llvm-project?rev=185017&view=rev
Log:
<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.

Modified:
    lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp?rev=185017&r1=185016&r2=185017&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachVMMemory.cpp Wed Jun 26 15:46:27 2013
@@ -418,7 +418,7 @@ MachVMMemory::GetMemorySizes(task_t task
 }
 
 #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_in
     
     return sum;
 }
-
+#endif /* !TASK_VM_INFO_PURGEABLE */
 #endif
 
 static void
@@ -447,11 +447,14 @@ GetPurgeableAndAnonymous(task_t task, ui
 #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, ui
             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, ui
         {
             anonymous = 0;
         }
+#endif
     }
-    
+
 #endif
 }
 





More information about the lldb-commits mailing list