- (void)test
{
pid_t thePid = 47743;
mach_port_t currentTask;
//vm_region_basic_info_data_t
vm_region_basic_info_data_t currentInfo;
mach_msg_type_number_t currentInfoSize = VM_REGION_BASIC_INFO_COUNT;
mach_vm_size_t currentBlockSize = 0;
mach_vm_address_t currentAddress = 0;
mach_port_t currentObject = MACH_PORT_NULL;
kern_return_t kReturn;
kReturn = task_for_pid (mach_task_self(), thePid, ¤tTask);
if (kReturn == KERN_SUCCESS)
{
kReturn = mach_vm_region(currentTask,¤tAddress,¤tBlockSize,VM_REGION_BASIC_INFO,(vm_region_info_t)¤tInfo,¤tInfoSize,¤tObject);
NSRange dataRange = NSMakeRange(currentAddress, currentBlockSize);
printf("The kernal returns %i\n",kReturn);
printf("Range: %s\n",[NSStringFromRange(dataRange) UTF8String]);
}
}