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

Commit ec5d6cb8 authored by Josh Gao's avatar Josh Gao Committed by Gerrit Code Review
Browse files

Merge changes I1a28c21c,I02faec3b,I16a2050b

* changes:
  crash_dump: collect open files before dropping caps.
  debuggerd_test: improve error when crasher fails to exec.
  debuggerd_test: fix crasher path.
parents 914955ae c24cc8a9
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -363,6 +363,12 @@ int main(int argc, char** argv) {
    LOG(FATAL) << "failed to create backtrace map";
  }

  // Collect the list of open files.
  OpenFilesList open_files;
  if (!backtrace) {
    populate_open_files_list(target, &open_files);
  }

  // Drop our capabilities now that we've attached to the threads we care about.
  drop_capabilities();

@@ -375,10 +381,6 @@ int main(int argc, char** argv) {
  if (backtrace) {
    dump_backtrace(output_fd.get(), backtrace_map.get(), target, main_tid, attached_siblings, 0);
  } else {
    // Collect the list of open files.
    OpenFilesList open_files;
    populate_open_files_list(target, &open_files);

    engrave_tombstone(output_fd.get(), backtrace_map.get(), open_files, target, main_tid,
                      attached_siblings, abort_address, fatal_signal ? &amfd_data : nullptr);
  }
+6 −4
Original line number Diff line number Diff line
@@ -40,10 +40,10 @@ using namespace std::chrono_literals;
using android::base::unique_fd;

#if defined(__LP64__)
#define CRASHER_PATH  "/system/xbin/crasher64"
#define CRASHER_PATH  "/system/bin/crasher64"
#define ARCH_SUFFIX "64"
#else
#define CRASHER_PATH "/system/xbin/crasher"
#define CRASHER_PATH "/system/bin/crasher"
#define ARCH_SUFFIX ""
#endif

@@ -192,7 +192,7 @@ void CrasherTest::StartCrasher(const std::string& crash_type) {
  std::string type = "wait-" + crash_type;
  StartProcess([type]() {
    execl(CRASHER_PATH, CRASHER_PATH, type.c_str(), nullptr);
    err(1, "exec failed");
    exit(errno);
  });
}

@@ -216,7 +216,9 @@ void CrasherTest::AssertDeath(int signo) {
    FAIL() << "failed to wait for crasher: " << strerror(errno);
  }

  if (!WIFSIGNALED(status)) {
  if (WIFEXITED(status)) {
    FAIL() << "crasher failed to exec: " << strerror(WEXITSTATUS(status));
  } else if (!WIFSIGNALED(status)) {
    FAIL() << "crasher didn't terminate via a signal";
  }
  ASSERT_EQ(signo, WTERMSIG(status));