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

Commit 01ba1157 authored by Christopher Ferris's avatar Christopher Ferris Committed by Gerrit Code Review
Browse files

Merge "Use new unwinder for offline in libbacktrace."

parents 8abe4e26 c8bec5aa
Loading
Loading
Loading
Loading
+2 −53
Original line number Diff line number Diff line
@@ -128,39 +128,8 @@ cc_library_shared {
    cflags: ["-O0"],
    srcs: ["backtrace_testlib.cpp"],

    target: {
        linux: {
    shared_libs: [
                "libunwind",
                "libunwindstack",
            ],
        },
    }
}

//-------------------------------------------------------------------------
// The libbacktrace_offline static library.
//-------------------------------------------------------------------------
cc_library_static {
    name: "libbacktrace_offline",
    defaults: ["libbacktrace_common"],
    host_supported: true,
    srcs: ["BacktraceOffline.cpp"],

    cflags: [
        "-D__STDC_CONSTANT_MACROS",
        "-D__STDC_LIMIT_MACROS",
        "-D__STDC_FORMAT_MACROS",
    ],

    header_libs: ["llvm-headers"],

    // Use shared libraries so their headers get included during build.
    shared_libs = [
        "libbase",
        "libunwind",
      "libunwindstack",
        "libziparchive",
    ],
}

@@ -193,28 +162,11 @@ cc_test {
        "libbase",
        "libcutils",
        "liblog",
        "libunwind",
        "libunwindstack",
    ],

    group_static_libs: true,

    // Statically link LLVMlibraries to remove dependency on llvm shared library.
    static_libs = [
        "libbacktrace_offline",
        "libLLVMObject",
        "libLLVMBitReader",
        "libLLVMMC",
        "libLLVMMCParser",
        "libLLVMCore",
        "libLLVMSupport",

        "libziparchive",
        "libz",
    ],

    header_libs: ["llvm-headers"],

    target: {
        android: {
            cflags: ["-DENABLE_PSS_TESTS"],
@@ -223,9 +175,6 @@ cc_test {
            ],
        },
        linux_glibc: {
            host_ldlibs: [
                "-lncurses",
            ],
            static_libs: ["libutils"],
        },
    },
+4 −0
Original line number Diff line number Diff line
@@ -168,5 +168,9 @@ std::string Backtrace::GetErrorString(BacktraceUnwindError error) {
      return "Failed to find a function in debug sections";
    case BACKTRACE_UNWIND_ERROR_EXECUTE_DWARF_INSTRUCTION_FAILED:
      return "Failed to execute dwarf instructions in debug sections";
    case BACKTRACE_UNWIND_ERROR_UNWIND_INFO:
      return "Failed to unwind due to invalid unwind information";
    case BACKTRACE_UNWIND_ERROR_REPEATED_FRAME:
      return "Failed to unwind due to same sp/pc repeating";
  }
}
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ size_t BacktraceCurrent::Read(uint64_t addr, uint8_t* buffer, size_t bytes) {
  return bytes;
}

bool BacktraceCurrent::Unwind(size_t num_ignore_frames, ucontext_t* ucontext) {
bool BacktraceCurrent::Unwind(size_t num_ignore_frames, void* ucontext) {
  if (GetMap() == nullptr) {
    // Without a map object, we can't do anything.
    error_.error_code = BACKTRACE_UNWIND_ERROR_MAP_MISSING;
+2 −3
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@

#include <stdint.h>
#include <sys/types.h>
#include <ucontext.h>

#include <backtrace/Backtrace.h>

@@ -44,7 +43,7 @@ class BacktraceCurrent : public Backtrace {

  bool ReadWord(uint64_t ptr, word_t* out_value) override;

  bool Unwind(size_t num_ignore_frames, ucontext_t* ucontext) override;
  bool Unwind(size_t num_ignore_frames, void* ucontext) override;

 protected:
  bool DiscardFrame(const backtrace_frame_data_t& frame);
@@ -52,7 +51,7 @@ class BacktraceCurrent : public Backtrace {
 private:
  bool UnwindThread(size_t num_ignore_frames);

  virtual bool UnwindFromContext(size_t num_ignore_frames, ucontext_t* ucontext) = 0;
  virtual bool UnwindFromContext(size_t num_ignore_frames, void* ucontext) = 0;
};

#endif // _LIBBACKTRACE_BACKTRACE_CURRENT_H
+0 −10
Original line number Diff line number Diff line
@@ -146,13 +146,3 @@ BacktraceMap* BacktraceMap::Create(pid_t pid, bool /*uncached*/) {
  return map;
}
#endif

BacktraceMap* BacktraceMap::Create(pid_t pid, const std::vector<backtrace_map_t>& maps) {
    BacktraceMap* backtrace_map = new BacktraceMap(pid);
    backtrace_map->maps_.insert(backtrace_map->maps_.begin(), maps.begin(), maps.end());
    std::sort(backtrace_map->maps_.begin(), backtrace_map->maps_.end(),
            [](const backtrace_map_t& map1, const backtrace_map_t& map2) {
              return map1.start < map2.start;
            });
    return backtrace_map;
}
Loading