Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Commit

Permalink
skip samples that throw a PtraceException
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenkaras committed Jan 17, 2018
1 parent 4a9c3de commit 28fbd3a
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/prober.cc
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ int Prober::ProbeLoop(const PyFrob &frobber, std::ostream *out) {
size_t idle_count = 0;
bool check_end = seconds_ >= 0;
auto end = std::chrono::system_clock::now() + ToMicroseconds(seconds_);
try {
for (;;) {
for (;;) {
try {
auto now = std::chrono::system_clock::now();
std::vector<Thread> threads = frobber.GetThreads();

Expand All @@ -402,19 +402,17 @@ int Prober::ProbeLoop(const PyFrob &frobber, std::ostream *out) {
PtraceCont(pid_);
std::this_thread::sleep_for(interval_);
PtraceInterrupt(pid_);
} catch (const TerminateException &exc) {
goto finish;
} catch (const PtraceException &exc) {
// If the process terminates early then we just print the stack traces up
// until that point in time.
std::cerr << "Unexpected ptrace(2) exception: " << exc.what() << "\n";
} catch (const std::exception &exc) {
std::cerr << "Unexpected generic exception: " << exc.what() << "\n";
return_code = 1;
goto finish;
}
} catch (const TerminateException &exc) {
goto finish;
} catch (const PtraceException &exc) {
// If the process terminates early then we just print the stack traces up
// until that point in time.
std::cerr << "Unexpected ptrace(2) exception: " << exc.what() << "\n";
return_code = 1;
goto finish;
} catch (const std::exception &exc) {
std::cerr << "Unexpected generic exception: " << exc.what() << "\n";
return_code = 1;
goto finish;
}
finish:
if (!call_stacks.empty() || idle_count) {
Expand Down

0 comments on commit 28fbd3a

Please sign in to comment.