• Home
  • Raw
  • Download

Lines Matching refs:pid

135 static void WaitForStop(pid_t pid) {  in WaitForStop()  argument
139 while (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) < 0 && (errno == EINTR || errno == ESRCH)) { in WaitForStop()
148 static void CreateRemoteProcess(pid_t* pid) { in CreateRemoteProcess() argument
149 if ((*pid = fork()) == 0) { in CreateRemoteProcess()
154 ASSERT_NE(-1, *pid); in CreateRemoteProcess()
156 ASSERT_TRUE(ptrace(PTRACE_ATTACH, *pid, 0, 0) == 0); in CreateRemoteProcess()
159 WaitForStop(*pid); in CreateRemoteProcess()
162 static void FinishRemoteProcess(pid_t pid) { in FinishRemoteProcess() argument
163 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in FinishRemoteProcess()
165 kill(pid, SIGKILL); in FinishRemoteProcess()
166 ASSERT_EQ(waitpid(pid, nullptr, 0), pid); in FinishRemoteProcess()
387 static void VerifyProcTest(pid_t pid, pid_t tid, bool (*ReadyFunc)(Backtrace*), in VerifyProcTest() argument
392 ptrace_tid = pid; in VerifyProcTest()
406 map.reset(map_create_func(pid, false)); in VerifyProcTest()
407 std::unique_ptr<Backtrace> backtrace(create_func(pid, tid, map.get())); in VerifyProcTest()
425 pid_t pid; in TEST_F() local
426 if ((pid = fork()) == 0) { in TEST_F()
430 VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, ReadyLevelBacktrace, VerifyLevelDump, in TEST_F()
433 kill(pid, SIGKILL); in TEST_F()
435 ASSERT_EQ(waitpid(pid, &status, 0), pid); in TEST_F()
439 pid_t pid; in TEST_F() local
440 if ((pid = fork()) == 0) { in TEST_F()
444 VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, ReadyMaxBacktrace, VerifyMaxDump, Backtrace::Create, in TEST_F()
447 kill(pid, SIGKILL); in TEST_F()
449 ASSERT_EQ(waitpid(pid, &status, 0), pid); in TEST_F()
469 pid_t pid; in TEST_F() local
470 if ((pid = fork()) == 0) { in TEST_F()
474 VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, ReadyLevelBacktrace, VerifyProcessIgnoreFrames, in TEST_F()
477 kill(pid, SIGKILL); in TEST_F()
479 ASSERT_EQ(waitpid(pid, &status, 0), pid); in TEST_F()
488 static void GetThreads(pid_t pid, std::vector<pid_t>* threads) { in GetThreads() argument
491 snprintf(task_path, sizeof(task_path), "/proc/%d/task", pid); in GetThreads()
506 pid_t pid; in TEST_F() local
507 if ((pid = fork()) == 0) { in TEST_F()
526 GetThreads(pid, &threads); in TEST_F()
531 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in TEST_F()
532 WaitForStop(pid); in TEST_F()
535 if (pid == *it) { in TEST_F()
538 VerifyProcTest(pid, *it, ReadyLevelBacktrace, VerifyLevelDump, Backtrace::Create, in TEST_F()
542 FinishRemoteProcess(pid); in TEST_F()
955 static void VerifyMap(pid_t pid) { in VerifyMap() argument
957 snprintf(buffer, sizeof(buffer), "/proc/%d/maps", pid); in VerifyMap()
970 std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(pid)); in VerifyMap()
993 pid_t pid; in TEST_F() local
994 CreateRemoteProcess(&pid); in TEST_F()
997 VerifyMap(pid); in TEST_F()
999 FinishRemoteProcess(pid); in TEST_F()
1145 pid_t pid; in TEST_F() local
1146 if ((pid = fork()) == 0) { in TEST_F()
1150 ASSERT_NE(-1, pid); in TEST_F()
1155 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) { in TEST_F()
1156 WaitForStop(pid); in TEST_F()
1158 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, pid)); in TEST_F()
1176 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in TEST_F()
1183 kill(pid, SIGKILL); in TEST_F()
1184 ASSERT_EQ(waitpid(pid, nullptr, 0), pid); in TEST_F()
1279 pid_t pid; in TEST_F() local
1280 if ((pid = fork()) == 0) { in TEST_F()
1307 ASSERT_TRUE(pid > 0); in TEST_F()
1312 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in TEST_F()
1315 WaitForStop(pid); in TEST_F()
1317 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, BACKTRACE_CURRENT_THREAD)); in TEST_F()
1345 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in TEST_F()
1353 kill(pid, SIGKILL); in TEST_F()
1354 ASSERT_EQ(waitpid(pid, nullptr, 0), pid); in TEST_F()
1453 pid_t pid; in TEST_F() local
1454 if ((pid = fork()) == 0) { in TEST_F()
1458 ASSERT_TRUE(pid > 0); in TEST_F()
1463 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in TEST_F()
1466 WaitForStop(pid); in TEST_F()
1468 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, BACKTRACE_CURRENT_THREAD)); in TEST_F()
1481 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in TEST_F()
1489 kill(pid, SIGKILL); in TEST_F()
1490 ASSERT_EQ(waitpid(pid, nullptr, 0), pid); in TEST_F()
1515 pid_t pid; in TEST_F() local
1516 CreateRemoteProcess(&pid); in TEST_F()
1519 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, pid)); in TEST_F()
1526 FinishRemoteProcess(pid); in TEST_F()
1677 pid_t pid; in TEST_F() local
1678 CreateRemoteProcess(&pid); in TEST_F()
1681 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, pid)); in TEST_F()
1685 FinishRemoteProcess(pid); in TEST_F()
1725 pid_t pid; in UnwindThroughSignal() local
1726 if ((pid = fork()) == 0) { in UnwindThroughSignal()
1737 ASSERT_NE(-1, pid); in UnwindThroughSignal()
1745 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in UnwindThroughSignal()
1747 WaitForStop(pid); in UnwindThroughSignal()
1749 std::unique_ptr<BacktraceMap> map(map_create_func(pid, false)); in UnwindThroughSignal()
1750 std::unique_ptr<Backtrace> backtrace(create_func(pid, pid, map.get())); in UnwindThroughSignal()
1756 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in UnwindThroughSignal()
1763 kill(pid, SIGUSR1); in UnwindThroughSignal()
1773 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in UnwindThroughSignal()
1775 WaitForStop(pid); in UnwindThroughSignal()
1777 map.reset(map_create_func(pid, false)); in UnwindThroughSignal()
1779 backtrace.reset(create_func(pid, pid, map.get())); in UnwindThroughSignal()
1793 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in UnwindThroughSignal()
1832 FinishRemoteProcess(pid); in UnwindThroughSignal()
1858 static void CheckForLeak(pid_t pid, pid_t tid) { in CheckForLeak() argument
1859 std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(pid)); in CheckForLeak()
1865 Backtrace* backtrace = Backtrace::Create(pid, tid, map.get()); in CheckForLeak()
1903 pid_t pid; in TEST_F() local
1904 CreateRemoteProcess(&pid); in TEST_F()
1906 CheckForLeak(pid, BACKTRACE_CURRENT_THREAD); in TEST_F()
1908 FinishRemoteProcess(pid); in TEST_F()