Lines Matching full:pid
80 // Add PID to the shared process pointer map.
85 static nub_bool_t AddProcessToMap(nub_process_t pid, MachProcessSP &procSP) { in AddProcessToMap() argument
88 process_map->insert(std::make_pair(pid, procSP)); in AddProcessToMap()
94 // Remove the shared pointer for PID from the process map.
98 // RemoveProcessFromMap (nub_process_t pid)
103 // return process_map->erase(pid);
108 // Get the shared pointer for PID from the existing process map.
112 static nub_bool_t GetProcessSP(nub_process_t pid, MachProcessSP &procSP) { in GetProcessSP() argument
115 ProcessMapIter pos = process_map->find(pid); in GetProcessSP()
163 const pid_t pid = (pid_t)death_event.ident; in kqueue_thread() local
164 const pid_t child_pid = waitpid(pid, &status, 0); in kqueue_thread()
180 if (child_pid == abs(pid)) { in kqueue_thread()
208 "waitpid_process_thread (): setting exit status for pid = %i to %i", in kqueue_thread()
217 static bool spawn_kqueue_thread(pid_t pid) { in spawn_kqueue_thread() argument
223 DNBLogError("Could not get kqueue for pid = %i.", pid); in spawn_kqueue_thread()
229 EV_SET(®_event, pid, EVFILT_PROC, EV_ADD, in spawn_kqueue_thread()
235 "Failed to register kqueue NOTE_EXIT event for pid %i, error: %d.", pid, in spawn_kqueue_thread()
253 const pid_t pid = (pid_t)(intptr_t)arg; in waitpid_thread() local
270 pid_t child_pid = waitpid(pid, &status, 0); in waitpid_thread()
271 DNBLogThreadedIf(LOG_PROCESS, "waitpid_thread (): waitpid (pid = %i, " in waitpid_thread()
273 pid, child_pid, status, errno); in waitpid_thread()
286 "waitpid_thread (): setting exit status for pid = %i to %i", in waitpid_thread()
297 "exit status to an invalid value (-1) for pid " in waitpid_thread()
299 pid); in waitpid_thread()
300 DNBProcessSetExitStatus(pid, -1); in waitpid_thread()
303 static bool spawn_waitpid_thread(pid_t pid) { in spawn_waitpid_thread() argument
305 bool success = spawn_kqueue_thread(pid); in spawn_waitpid_thread()
312 ::pthread_create(&thread, NULL, waitpid_thread, (void *)(intptr_t)pid); in spawn_waitpid_thread()
353 pid_t pid = processSP->LaunchForDebug( in DNBProcessLaunch() local
369 DNBLogThreadedIf(LOG_PROCESS, "(DebugNub) new pid is %d...", pid); in DNBProcessLaunch()
371 if (pid != INVALID_NUB_PROCESS) { in DNBProcessLaunch()
373 spawn_waitpid_thread(pid); in DNBProcessLaunch()
381 kill(SIGKILL, pid); in DNBProcessLaunch()
386 "failed to get the task for process %i (%s)", pid, in DNBProcessLaunch()
390 "failed to get the task for process %i", pid); in DNBProcessLaunch()
394 bool res = AddProcessToMap(pid, processSP); in DNBProcessLaunch()
397 return pid; in DNBProcessLaunch()
404 // If there is one process with a given name, return the pid for that process.
480 pid_t pid = INVALID_NUB_PROCESS; in DNBProcessAttach() local
483 DNBLogThreadedIf(LOG_PROCESS, "(DebugNub) attaching to pid %d...", in DNBProcessAttach()
485 pid = in DNBProcessAttach()
488 if (pid != INVALID_NUB_PROCESS) { in DNBProcessAttach()
489 bool res = AddProcessToMap(pid, processSP); in DNBProcessAttach()
492 spawn_waitpid_thread(pid); in DNBProcessAttach()
496 while (pid != INVALID_NUB_PROCESS) { in DNBProcessAttach()
502 __FUNCTION__, pid); in DNBProcessAttach()
504 DNBProcessWaitForEvents(pid, eEventProcessRunningStateChanged | in DNBProcessAttach()
512 __FUNCTION__, pid, set_events); in DNBProcessAttach()
517 pid = INVALID_NUB_PROCESS; in DNBProcessAttach()
521 nub_state_t pid_state = DNBProcessGetState(pid); in DNBProcessAttach()
525 __FUNCTION__, pid, DNBStateAsString(pid_state)); in DNBProcessAttach()
542 return pid; in DNBProcessAttach()
552 DNBProcessResetEvents(pid, set_events); in DNBProcessAttach()
712 nub_process_t pid; in DNBProcessAttachWait() local
713 pid = MachProcess::CheckForProcess(attach_token, launch_flavor); in DNBProcessAttachWait()
714 if (pid != INVALID_NUB_PROCESS) { in DNBProcessAttachWait()
715 waitfor_pid = pid; in DNBProcessAttachWait()
778 DNBLogThreadedIf(LOG_PROCESS, "Attaching to %s with pid %i...\n", in DNBProcessAttachWait()
791 nub_bool_t DNBProcessDetach(nub_process_t pid) { in DNBProcessDetach() argument
793 if (GetProcessSP(pid, procSP)) { in DNBProcessDetach()
796 "Disabling breakpoints and watchpoints, and detaching from %d.", pid); in DNBProcessDetach()
804 nub_bool_t DNBProcessKill(nub_process_t pid) { in DNBProcessKill() argument
806 if (GetProcessSP(pid, procSP)) { in DNBProcessKill()
812 nub_bool_t DNBProcessSignal(nub_process_t pid, int signal) { in DNBProcessSignal() argument
814 if (GetProcessSP(pid, procSP)) { in DNBProcessSignal()
820 nub_bool_t DNBProcessInterrupt(nub_process_t pid) { in DNBProcessInterrupt() argument
822 if (GetProcessSP(pid, procSP)) in DNBProcessInterrupt()
827 nub_bool_t DNBProcessSendEvent(nub_process_t pid, const char *event) { in DNBProcessSendEvent() argument
829 if (GetProcessSP(pid, procSP)) { in DNBProcessSendEvent()
837 nub_bool_t DNBProcessIsAlive(nub_process_t pid) { in DNBProcessIsAlive() argument
839 if (GetProcessSP(pid, procSP)) { in DNBProcessIsAlive()
846 nub_state_t DNBProcessGetState(nub_process_t pid) { in DNBProcessGetState() argument
848 if (GetProcessSP(pid, procSP)) { in DNBProcessGetState()
855 nub_bool_t DNBProcessGetExitStatus(nub_process_t pid, int *status) { in DNBProcessGetExitStatus() argument
857 if (GetProcessSP(pid, procSP)) { in DNBProcessGetExitStatus()
863 nub_bool_t DNBProcessSetExitStatus(nub_process_t pid, int status) { in DNBProcessSetExitStatus() argument
865 if (GetProcessSP(pid, procSP)) { in DNBProcessSetExitStatus()
872 const char *DNBProcessGetExitInfo(nub_process_t pid) { in DNBProcessGetExitInfo() argument
874 if (GetProcessSP(pid, procSP)) { in DNBProcessGetExitInfo()
880 nub_bool_t DNBProcessSetExitInfo(nub_process_t pid, const char *info) { in DNBProcessSetExitInfo() argument
882 if (GetProcessSP(pid, procSP)) { in DNBProcessSetExitInfo()
889 const char *DNBThreadGetName(nub_process_t pid, nub_thread_t tid) { in DNBThreadGetName() argument
891 if (GetProcessSP(pid, procSP)) in DNBThreadGetName()
897 DNBThreadGetIdentifierInfo(nub_process_t pid, nub_thread_t tid, in DNBThreadGetIdentifierInfo() argument
900 if (GetProcessSP(pid, procSP)) in DNBThreadGetIdentifierInfo()
905 nub_state_t DNBThreadGetState(nub_process_t pid, nub_thread_t tid) { in DNBThreadGetState() argument
907 if (GetProcessSP(pid, procSP)) { in DNBThreadGetState()
941 Genealogy::ThreadActivitySP DNBGetGenealogyInfoForThread(nub_process_t pid, in DNBGetGenealogyInfoForThread() argument
946 if (GetProcessSP(pid, procSP)) in DNBGetGenealogyInfoForThread()
951 Genealogy::ProcessExecutableInfoSP DNBGetGenealogyImageInfo(nub_process_t pid, in DNBGetGenealogyImageInfo() argument
955 if (GetProcessSP(pid, procSP)) { in DNBGetGenealogyImageInfo()
961 ThreadInfo::QoS DNBGetRequestedQoSForThread(nub_process_t pid, nub_thread_t tid, in DNBGetRequestedQoSForThread() argument
965 if (GetProcessSP(pid, procSP)) { in DNBGetRequestedQoSForThread()
971 nub_addr_t DNBGetPThreadT(nub_process_t pid, nub_thread_t tid) { in DNBGetPThreadT() argument
973 if (GetProcessSP(pid, procSP)) { in DNBGetPThreadT()
979 nub_addr_t DNBGetDispatchQueueT(nub_process_t pid, nub_thread_t tid) { in DNBGetDispatchQueueT() argument
981 if (GetProcessSP(pid, procSP)) { in DNBGetDispatchQueueT()
988 DNBGetTSDAddressForThread(nub_process_t pid, nub_thread_t tid, in DNBGetTSDAddressForThread() argument
993 if (GetProcessSP(pid, procSP)) { in DNBGetTSDAddressForThread()
1002 nub_process_t pid, nub_addr_t image_list_address, nub_addr_t image_count) { in DNBGetLoadedDynamicLibrariesInfos() argument
1004 if (GetProcessSP(pid, procSP)) { in DNBGetLoadedDynamicLibrariesInfos()
1005 return procSP->GetLoadedDynamicLibrariesInfos(pid, image_list_address, in DNBGetLoadedDynamicLibrariesInfos()
1011 JSONGenerator::ObjectSP DNBGetAllLoadedLibrariesInfos(nub_process_t pid) { in DNBGetAllLoadedLibrariesInfos() argument
1013 if (GetProcessSP(pid, procSP)) { in DNBGetAllLoadedLibrariesInfos()
1014 return procSP->GetAllLoadedLibrariesInfos(pid); in DNBGetAllLoadedLibrariesInfos()
1020 DNBGetLibrariesInfoForAddresses(nub_process_t pid, in DNBGetLibrariesInfoForAddresses() argument
1023 if (GetProcessSP(pid, procSP)) { in DNBGetLibrariesInfoForAddresses()
1024 return procSP->GetLibrariesInfoForAddresses(pid, macho_addresses); in DNBGetLibrariesInfoForAddresses()
1029 JSONGenerator::ObjectSP DNBGetSharedCacheInfo(nub_process_t pid) { in DNBGetSharedCacheInfo() argument
1031 if (GetProcessSP(pid, procSP)) { in DNBGetSharedCacheInfo()
1032 return procSP->GetSharedCacheInfo(pid); in DNBGetSharedCacheInfo()
1037 const char *DNBProcessGetExecutablePath(nub_process_t pid) { in DNBProcessGetExecutablePath() argument
1039 if (GetProcessSP(pid, procSP)) { in DNBProcessGetExecutablePath()
1045 nub_size_t DNBProcessGetArgumentCount(nub_process_t pid) { in DNBProcessGetArgumentCount() argument
1047 if (GetProcessSP(pid, procSP)) { in DNBProcessGetArgumentCount()
1053 const char *DNBProcessGetArgumentAtIndex(nub_process_t pid, nub_size_t idx) { in DNBProcessGetArgumentAtIndex() argument
1055 if (GetProcessSP(pid, procSP)) { in DNBProcessGetArgumentAtIndex()
1062 nub_bool_t DNBProcessResume(nub_process_t pid, in DNBProcessResume() argument
1065 DNBLogThreadedIf(LOG_PROCESS, "%s(pid = %4.4x)", __FUNCTION__, pid); in DNBProcessResume()
1067 if (GetProcessSP(pid, procSP)) { in DNBProcessResume()
1085 nub_bool_t DNBProcessHalt(nub_process_t pid) { in DNBProcessHalt() argument
1086 DNBLogThreadedIf(LOG_PROCESS, "%s(pid = %4.4x)", __FUNCTION__, pid); in DNBProcessHalt()
1088 if (GetProcessSP(pid, procSP)) in DNBProcessHalt()
1094 // DNBThreadResume (nub_process_t pid, nub_thread_t tid, nub_bool_t step)
1096 // DNBLogThreadedIf(LOG_THREAD, "%s(pid = %4.4x, tid = %4.4x, step = %u)",
1097 // __FUNCTION__, pid, tid, (uint32_t)step);
1099 // if (GetProcessSP (pid, procSP))
1107 // DNBThreadResumeWithSignal (nub_process_t pid, nub_thread_t tid, nub_bool_t
1110 // DNBLogThreadedIf(LOG_THREAD, "%s(pid = %4.4x, tid = %4.4x, step = %u,
1111 // signal = %i)", __FUNCTION__, pid, tid, (uint32_t)step, signal);
1113 // if (GetProcessSP (pid, procSP))
1120 nub_event_t DNBProcessWaitForEvents(nub_process_t pid, nub_event_t event_mask, in DNBProcessWaitForEvents() argument
1125 if (GetProcessSP(pid, procSP)) { in DNBProcessWaitForEvents()
1134 void DNBProcessResetEvents(nub_process_t pid, nub_event_t event_mask) { in DNBProcessResetEvents() argument
1136 if (GetProcessSP(pid, procSP)) in DNBProcessResetEvents()
1141 nub_bool_t DNBBreakpointSet(nub_process_t pid, nub_addr_t addr, nub_size_t size, in DNBBreakpointSet() argument
1144 if (GetProcessSP(pid, procSP)) in DNBBreakpointSet()
1149 nub_bool_t DNBBreakpointClear(nub_process_t pid, nub_addr_t addr) { in DNBBreakpointClear() argument
1151 if (GetProcessSP(pid, procSP)) in DNBBreakpointClear()
1157 nub_bool_t DNBWatchpointSet(nub_process_t pid, nub_addr_t addr, nub_size_t size, in DNBWatchpointSet() argument
1160 if (GetProcessSP(pid, procSP)) in DNBWatchpointSet()
1165 nub_bool_t DNBWatchpointClear(nub_process_t pid, nub_addr_t addr) { in DNBWatchpointClear() argument
1167 if (GetProcessSP(pid, procSP)) in DNBWatchpointClear()
1173 uint32_t DNBWatchpointGetNumSupportedHWP(nub_process_t pid) { in DNBWatchpointGetNumSupportedHWP() argument
1175 if (GetProcessSP(pid, procSP)) in DNBWatchpointGetNumSupportedHWP()
1180 // Read memory in the address space of process PID. This call will take
1185 nub_size_t DNBProcessMemoryRead(nub_process_t pid, nub_addr_t addr, in DNBProcessMemoryRead() argument
1188 if (GetProcessSP(pid, procSP)) in DNBProcessMemoryRead()
1193 uint64_t DNBProcessMemoryReadInteger(nub_process_t pid, nub_addr_t addr, in DNBProcessMemoryReadInteger() argument
1205 if (DNBProcessMemoryRead(pid, addr, integer_size, &ints) == integer_size) { in DNBProcessMemoryReadInteger()
1229 nub_addr_t DNBProcessMemoryReadPointer(nub_process_t pid, nub_addr_t addr) { in DNBProcessMemoryReadPointer() argument
1230 cpu_type_t cputype = DNBProcessGetCPUType(pid); in DNBProcessMemoryReadPointer()
1233 return DNBProcessMemoryReadInteger(pid, addr, pointer_size, 0); in DNBProcessMemoryReadPointer()
1238 std::string DNBProcessMemoryReadCString(nub_process_t pid, nub_addr_t addr) { in DNBProcessMemoryReadCString() argument
1247 DNBProcessMemoryRead(pid, curr_addr, max_buffer_cstr_length, buffer); in DNBProcessMemoryReadCString()
1257 std::string DNBProcessMemoryReadCStringFixed(nub_process_t pid, nub_addr_t addr, in DNBProcessMemoryReadCStringFixed() argument
1262 nub_size_t bytes_read = DNBProcessMemoryRead(pid, addr, fixed_length, buffer); in DNBProcessMemoryReadCStringFixed()
1268 // Write memory to the address space of process PID. This call will take
1273 nub_size_t DNBProcessMemoryWrite(nub_process_t pid, nub_addr_t addr, in DNBProcessMemoryWrite() argument
1276 if (GetProcessSP(pid, procSP)) in DNBProcessMemoryWrite()
1281 nub_addr_t DNBProcessMemoryAllocate(nub_process_t pid, nub_size_t size, in DNBProcessMemoryAllocate() argument
1284 if (GetProcessSP(pid, procSP)) in DNBProcessMemoryAllocate()
1289 nub_bool_t DNBProcessMemoryDeallocate(nub_process_t pid, nub_addr_t addr) { in DNBProcessMemoryDeallocate() argument
1291 if (GetProcessSP(pid, procSP)) in DNBProcessMemoryDeallocate()
1296 // Find attributes of the memory region that contains ADDR for process PID,
1308 int DNBProcessMemoryRegionInfo(nub_process_t pid, nub_addr_t addr, in DNBProcessMemoryRegionInfo() argument
1311 if (GetProcessSP(pid, procSP)) in DNBProcessMemoryRegionInfo()
1317 std::string DNBProcessGetProfileData(nub_process_t pid, in DNBProcessGetProfileData() argument
1320 if (GetProcessSP(pid, procSP)) in DNBProcessGetProfileData()
1326 nub_bool_t DNBProcessSetEnableAsyncProfiling(nub_process_t pid, in DNBProcessSetEnableAsyncProfiling() argument
1331 if (GetProcessSP(pid, procSP)) { in DNBProcessSetEnableAsyncProfiling()
1340 nub_size_t DNBProcessGetNumThreads(nub_process_t pid) { in DNBProcessGetNumThreads() argument
1342 if (GetProcessSP(pid, procSP)) in DNBProcessGetNumThreads()
1348 nub_thread_t DNBProcessGetCurrentThread(nub_process_t pid) { in DNBProcessGetCurrentThread() argument
1350 if (GetProcessSP(pid, procSP)) in DNBProcessGetCurrentThread()
1356 nub_thread_t DNBProcessGetCurrentThreadMachPort(nub_process_t pid) { in DNBProcessGetCurrentThreadMachPort() argument
1358 if (GetProcessSP(pid, procSP)) in DNBProcessGetCurrentThreadMachPort()
1364 nub_thread_t DNBProcessSetCurrentThread(nub_process_t pid, nub_thread_t tid) { in DNBProcessSetCurrentThread() argument
1366 if (GetProcessSP(pid, procSP)) in DNBProcessSetCurrentThread()
1373 nub_bool_t DNBThreadGetStopReason(nub_process_t pid, nub_thread_t tid, in DNBThreadGetStopReason() argument
1376 if (GetProcessSP(pid, procSP)) in DNBThreadGetStopReason()
1386 const char *DNBThreadGetInfo(nub_process_t pid, nub_thread_t tid) { in DNBThreadGetInfo() argument
1388 if (GetProcessSP(pid, procSP)) in DNBThreadGetInfo()
1394 nub_thread_t DNBProcessGetThreadAtIndex(nub_process_t pid, size_t thread_idx) { in DNBProcessGetThreadAtIndex() argument
1396 if (GetProcessSP(pid, procSP)) in DNBProcessGetThreadAtIndex()
1403 nub_bool_t DNBProcessSyncThreadState(nub_process_t pid, nub_thread_t tid) { in DNBProcessSyncThreadState() argument
1405 if (GetProcessSP(pid, procSP)) in DNBProcessSyncThreadState()
1410 nub_addr_t DNBProcessGetSharedLibraryInfoAddress(nub_process_t pid) { in DNBProcessGetSharedLibraryInfoAddress() argument
1413 if (GetProcessSP(pid, procSP)) in DNBProcessGetSharedLibraryInfoAddress()
1418 nub_bool_t DNBProcessSharedLibrariesUpdated(nub_process_t pid) { in DNBProcessSharedLibrariesUpdated() argument
1420 if (GetProcessSP(pid, procSP)) { in DNBProcessSharedLibrariesUpdated()
1427 const char *DNBGetDeploymentInfo(nub_process_t pid, bool is_executable, in DNBGetDeploymentInfo() argument
1434 if (GetProcessSP(pid, procSP)) { in DNBGetDeploymentInfo()
1453 DNBProcessGetSharedLibraryInfo(nub_process_t pid, nub_bool_t only_changed, in DNBProcessGetSharedLibraryInfo() argument
1456 if (GetProcessSP(pid, procSP)) in DNBProcessGetSharedLibraryInfo()
1474 nub_bool_t DNBThreadGetRegisterValueByID(nub_process_t pid, nub_thread_t tid, in DNBThreadGetRegisterValueByID() argument
1479 if (GetProcessSP(pid, procSP)) { in DNBThreadGetRegisterValueByID()
1486 nub_bool_t DNBThreadSetRegisterValueByID(nub_process_t pid, nub_thread_t tid, in DNBThreadSetRegisterValueByID() argument
1491 if (GetProcessSP(pid, procSP)) in DNBThreadSetRegisterValueByID()
1497 nub_size_t DNBThreadGetRegisterContext(nub_process_t pid, nub_thread_t tid, in DNBThreadGetRegisterContext() argument
1500 if (GetProcessSP(pid, procSP)) { in DNBThreadGetRegisterContext()
1508 nub_size_t DNBThreadSetRegisterContext(nub_process_t pid, nub_thread_t tid, in DNBThreadSetRegisterContext() argument
1511 if (GetProcessSP(pid, procSP)) { in DNBThreadSetRegisterContext()
1518 uint32_t DNBThreadSaveRegisterState(nub_process_t pid, nub_thread_t tid) { in DNBThreadSaveRegisterState() argument
1521 if (GetProcessSP(pid, procSP)) in DNBThreadSaveRegisterState()
1526 nub_bool_t DNBThreadRestoreRegisterState(nub_process_t pid, nub_thread_t tid, in DNBThreadRestoreRegisterState() argument
1530 if (GetProcessSP(pid, procSP)) in DNBThreadRestoreRegisterState()
1537 nub_bool_t DNBThreadGetRegisterValueByName(nub_process_t pid, nub_thread_t tid, in DNBThreadGetRegisterValueByName() argument
1543 if (GetProcessSP(pid, procSP)) { in DNBThreadGetRegisterValueByName()
1605 nub_bool_t DNBProcessSetNameToAddressCallback(nub_process_t pid, in DNBProcessSetNameToAddressCallback() argument
1609 if (GetProcessSP(pid, procSP)) { in DNBProcessSetNameToAddressCallback()
1619 nub_process_t pid, DNBCallbackCopyExecutableImageInfos callback, in DNBProcessSetSharedLibraryInfoCallback() argument
1622 if (GetProcessSP(pid, procSP)) { in DNBProcessSetSharedLibraryInfoCallback()
1629 nub_addr_t DNBProcessLookupAddress(nub_process_t pid, const char *name, in DNBProcessLookupAddress() argument
1632 if (GetProcessSP(pid, procSP)) { in DNBProcessLookupAddress()
1638 nub_size_t DNBProcessGetAvailableSTDOUT(nub_process_t pid, char *buf, in DNBProcessGetAvailableSTDOUT() argument
1641 if (GetProcessSP(pid, procSP)) in DNBProcessGetAvailableSTDOUT()
1646 nub_size_t DNBProcessGetAvailableSTDERR(nub_process_t pid, char *buf, in DNBProcessGetAvailableSTDERR() argument
1649 if (GetProcessSP(pid, procSP)) in DNBProcessGetAvailableSTDERR()
1654 nub_size_t DNBProcessGetAvailableProfileData(nub_process_t pid, char *buf, in DNBProcessGetAvailableProfileData() argument
1657 if (GetProcessSP(pid, procSP)) in DNBProcessGetAvailableProfileData()
1662 DarwinLogEventVector DNBProcessGetAvailableDarwinLogEvents(nub_process_t pid) { in DNBProcessGetAvailableDarwinLogEvents() argument
1663 return DarwinLogCollector::GetEventsForProcess(pid); in DNBProcessGetAvailableDarwinLogEvents()
1666 nub_size_t DNBProcessGetStopCount(nub_process_t pid) { in DNBProcessGetStopCount() argument
1668 if (GetProcessSP(pid, procSP)) in DNBProcessGetStopCount()
1673 uint32_t DNBProcessGetCPUType(nub_process_t pid) { in DNBProcessGetCPUType() argument
1675 if (GetProcessSP(pid, procSP)) in DNBProcessGetCPUType()