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

Commit b66f601c authored by Christopher Ferris's avatar Christopher Ferris Committed by android-build-merger
Browse files

Merge "Only call one unwinder."

am: d9f183b8

Change-Id: I01ec531fa8846880de91ae4a63db9cb0f1b65ffe
parents 61e508c3 d9f183b8
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -193,7 +193,6 @@ cc_test {
        "libdebuggerd/test/elf_fake.cpp",
        "libdebuggerd/test/log_fake.cpp",
        "libdebuggerd/test/open_files_list_test.cpp",
        "libdebuggerd/test/property_fake.cpp",
        "libdebuggerd/test/ptrace_fake.cpp",
        "libdebuggerd/test/tombstone_test.cpp",
    ],
+2 −8
Original line number Diff line number Diff line
@@ -348,11 +348,6 @@ int main(int argc, char** argv) {
      LOG(FATAL) << "failed to create backtrace map";
    }
  }
  std::unique_ptr<BacktraceMap> backtrace_map_new;
  backtrace_map_new.reset(BacktraceMap::CreateNew(main_tid));
  if (!backtrace_map_new) {
    LOG(FATAL) << "failed to create backtrace map new";
  }

  // Collect the list of open files.
  OpenFilesList open_files;
@@ -432,9 +427,8 @@ int main(int argc, char** argv) {
    dump_backtrace(output_fd.get(), backtrace_map.get(), target, main_tid, process_name, threads, 0);
  } else {
    ATRACE_NAME("engrave_tombstone");
    engrave_tombstone(output_fd.get(), backtrace_map.get(), backtrace_map_new.get(), &open_files,
                      target, main_tid, process_name, threads, abort_address,
                      fatal_signal ? &amfd_data : nullptr);
    engrave_tombstone(output_fd.get(), backtrace_map.get(), &open_files, target, main_tid,
                      process_name, threads, abort_address, fatal_signal ? &amfd_data : nullptr);
  }

  // We don't actually need to PTRACE_DETACH, as long as our tracees aren't in
+4 −4
Original line number Diff line number Diff line
@@ -35,10 +35,10 @@ class BacktraceMap;
int open_tombstone(std::string* path);

/* Creates a tombstone file and writes the crash dump to it. */
void engrave_tombstone(int tombstone_fd, BacktraceMap* map, BacktraceMap* map_new,
                       const OpenFilesList* open_files, pid_t pid, pid_t tid,
                       const std::string& process_name, const std::map<pid_t, std::string>& threads,
                       uintptr_t abort_msg_address, std::string* amfd_data);
void engrave_tombstone(int tombstone_fd, BacktraceMap* map, const OpenFilesList* open_files,
                       pid_t pid, pid_t tid, const std::string& process_name,
                       const std::map<pid_t, std::string>& threads, uintptr_t abort_msg_address,
                       std::string* amfd_data);

void engrave_tombstone_ucontext(int tombstone_fd, uintptr_t abort_msg_address, siginfo_t* siginfo,
                                ucontext_t* ucontext);
+0 −45
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <string.h>

#include <string>
#include <unordered_map>

#include <sys/system_properties.h>

std::unordered_map<std::string, std::string> g_properties;

extern "C" int property_set(const char* name, const char* value) {
  if (g_properties.count(name) != 0) {
    g_properties.erase(name);
  }
  g_properties[name] = value;
  return 0;
}

extern "C" int property_get(const char* key, char* value, const char* default_value) {
  if (g_properties.count(key) == 0) {
    if (default_value == nullptr) {
      return 0;
    }
    strncpy(value, default_value, PROP_VALUE_MAX-1);
  } else {
    strncpy(value, g_properties[key].c_str(), PROP_VALUE_MAX-1);
  }
  value[PROP_VALUE_MAX-1] = '\0';
  return strlen(value);
}
+6 −2
Original line number Diff line number Diff line
@@ -19,8 +19,9 @@
#include <memory>
#include <string>

#include <gtest/gtest.h>
#include <android-base/file.h>
#include <android-base/properties.h>
#include <gtest/gtest.h>

#include "libdebuggerd/utility.h"

@@ -639,7 +640,10 @@ TEST_F(TombstoneTest, dump_log_file_error) {
TEST_F(TombstoneTest, dump_header_info) {
  dump_header_info(&log_);

  std::string expected = "Build fingerprint: 'unknown'\nRevision: 'unknown'\n";
  std::string expected = android::base::StringPrintf(
      "Build fingerprint: '%s'\nRevision: '%s'\n",
      android::base::GetProperty("ro.build.fingerprint", "unknown").c_str(),
      android::base::GetProperty("ro.revision", "unknown").c_str());
  expected += android::base::StringPrintf("ABI: '%s'\n", ABI_STRING);
  ASSERT_STREQ(expected.c_str(), amfd_data_.c_str());
}
Loading