Lines Matching refs:pid
106 void WaitForStop(pid_t pid) { in WaitForStop() argument
110 while (ptrace(PTRACE_GETSIGINFO, pid, 0, &si) < 0 && (errno == EINTR || errno == ESRCH)) { in WaitForStop()
299 void VerifyProcTest(pid_t pid, pid_t tid, bool share_map, in VerifyProcTest() argument
304 ptrace_tid = pid; in VerifyProcTest()
319 map.reset(BacktraceMap::Create(pid)); in VerifyProcTest()
321 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, tid, map.get())); in VerifyProcTest()
340 pid_t pid; in TEST() local
341 if ((pid = fork()) == 0) { in TEST()
345 VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, false, ReadyLevelBacktrace, VerifyLevelDump); in TEST()
347 kill(pid, SIGKILL); in TEST()
349 ASSERT_EQ(waitpid(pid, &status, 0), pid); in TEST()
353 pid_t pid; in TEST() local
354 if ((pid = fork()) == 0) { in TEST()
359 VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, true, ReadyLevelBacktrace, VerifyLevelDump); in TEST()
361 kill(pid, SIGKILL); in TEST()
363 ASSERT_EQ(waitpid(pid, &status, 0), pid); in TEST()
367 pid_t pid; in TEST() local
368 if ((pid = fork()) == 0) { in TEST()
372 VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, false, ReadyMaxBacktrace, VerifyMaxDump); in TEST()
374 kill(pid, SIGKILL); in TEST()
376 ASSERT_EQ(waitpid(pid, &status, 0), pid); in TEST()
394 pid_t pid; in TEST() local
395 if ((pid = fork()) == 0) { in TEST()
399 …VerifyProcTest(pid, BACKTRACE_CURRENT_THREAD, false, ReadyLevelBacktrace, VerifyProcessIgnoreFrame… in TEST()
401 kill(pid, SIGKILL); in TEST()
403 ASSERT_EQ(waitpid(pid, &status, 0), pid); in TEST()
412 void GetThreads(pid_t pid, std::vector<pid_t>* threads) { in GetThreads() argument
415 snprintf(task_path, sizeof(task_path), "/proc/%d/task", pid); in GetThreads()
431 pid_t pid; in TEST() local
432 if ((pid = fork()) == 0) { in TEST()
451 GetThreads(pid, &threads); in TEST()
456 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in TEST()
457 WaitForStop(pid); in TEST()
460 if (pid == *it) { in TEST()
463 VerifyProcTest(pid, *it, false, ReadyLevelBacktrace, VerifyLevelDump); in TEST()
465 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in TEST()
467 kill(pid, SIGKILL); in TEST()
469 ASSERT_EQ(waitpid(pid, &status, 0), pid); in TEST()
881 void VerifyMap(pid_t pid) { in VerifyMap() argument
883 snprintf(buffer, sizeof(buffer), "/proc/%d/maps", pid); in VerifyMap()
896 std::unique_ptr<BacktraceMap> map(BacktraceMap::Create(pid)); in VerifyMap()
910 pid_t pid; in TEST() local
912 if ((pid = fork()) == 0) { in TEST()
917 ASSERT_LT(0, pid); in TEST()
919 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in TEST()
922 WaitForStop(pid); in TEST()
925 VerifyMap(pid); in TEST()
927 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in TEST()
929 kill(pid, SIGKILL); in TEST()
930 ASSERT_EQ(waitpid(pid, nullptr, 0), pid); in TEST()
1074 pid_t pid; in TEST() local
1075 if ((pid = fork()) == 0) { in TEST()
1079 ASSERT_NE(-1, pid); in TEST()
1084 if (ptrace(PTRACE_ATTACH, pid, 0, 0) == 0) { in TEST()
1085 WaitForStop(pid); in TEST()
1087 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, pid)); in TEST()
1107 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in TEST()
1114 kill(pid, SIGKILL); in TEST()
1115 ASSERT_EQ(waitpid(pid, nullptr, 0), pid); in TEST()
1220 pid_t pid; in TEST() local
1221 if ((pid = fork()) == 0) { in TEST()
1248 ASSERT_TRUE(pid > 0); in TEST()
1253 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in TEST()
1256 WaitForStop(pid); in TEST()
1258 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, BACKTRACE_CURRENT_THREAD)); in TEST()
1282 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in TEST()
1290 kill(pid, SIGKILL); in TEST()
1291 ASSERT_EQ(waitpid(pid, nullptr, 0), pid); in TEST()
1370 pid_t pid; in TEST() local
1371 if ((pid = fork()) == 0) { in TEST()
1375 ASSERT_TRUE(pid > 0); in TEST()
1381 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in TEST()
1384 WaitForStop(pid); in TEST()
1386 std::unique_ptr<Backtrace> backtrace(Backtrace::Create(pid, BACKTRACE_CURRENT_THREAD)); in TEST()
1399 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in TEST()
1407 kill(pid, SIGKILL); in TEST()
1408 ASSERT_EQ(waitpid(pid, nullptr, 0), pid); in TEST()
1426 void CheckForLeak(pid_t pid, pid_t tid) { in CheckForLeak() argument
1429 Backtrace* backtrace = Backtrace::Create(pid, tid); in CheckForLeak()
1440 Backtrace* backtrace = Backtrace::Create(pid, tid); in CheckForLeak()
1474 pid_t pid; in TEST() local
1476 if ((pid = fork()) == 0) { in TEST()
1481 ASSERT_LT(0, pid); in TEST()
1483 ASSERT_TRUE(ptrace(PTRACE_ATTACH, pid, 0, 0) == 0); in TEST()
1486 WaitForStop(pid); in TEST()
1488 CheckForLeak(pid, BACKTRACE_CURRENT_THREAD); in TEST()
1490 ASSERT_TRUE(ptrace(PTRACE_DETACH, pid, 0, 0) == 0); in TEST()
1492 kill(pid, SIGKILL); in TEST()
1493 ASSERT_EQ(waitpid(pid, nullptr, 0), pid); in TEST()