Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 428daafc authored by Josh Gao's avatar Josh Gao
Browse files

crash_dump: improve logging for when a process dies prematurely.

If a process that's getting dumped dies before crash_dump starts (e.g.
because seccomp immediately kills it after it execs crash_dump),
improve the error message to not just say "target died before we could
attach".

Bug: http://b/36077710
Test: inserted an exit in the handler, inspected output
Change-Id: I7d394c66d60d328b096b15654b3648e1ed711728
parent ec91809d
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -148,7 +148,12 @@ static void abort_handler(pid_t target, const bool& tombstoned_connected,
    }
  }

  dprintf(output_fd.get(), "crash_dump failed to dump process %d: %s\n", target, abort_msg);
  dprintf(output_fd.get(), "crash_dump failed to dump process");
  if (target != 1) {
    dprintf(output_fd.get(), " %d: %s\n", target, abort_msg);
  } else {
    dprintf(output_fd.get(), ": %s\n", abort_msg);
  }

  _exit(1);
}
@@ -195,7 +200,7 @@ int main(int argc, char** argv) {
  pid_t pseudothread_tid;

  if (target == 1) {
    LOG(FATAL) << "target died before we could attach";
    LOG(FATAL) << "target died before we could attach (received main tid = " << main_tid << ")";
  }

  if (!android::base::ParseInt(argv[1], &main_tid, 1, std::numeric_limits<pid_t>::max())) {