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

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

Merge "Split arch data into separate files."

parents a78c6867 d06001d6
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -99,8 +99,7 @@ bool UnwindStackCurrent::UnwindFromContext(size_t num_ignore_frames, ucontext_t*
    // one extra function call appearing in the unwind.
    unwindstack::RegsGetLocal(regs.get());
  } else {
    regs.reset(
        unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentMachineType(), ucontext));
    regs.reset(unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentArch(), ucontext));
  }

  error_ = BACKTRACE_UNWIND_NO_ERROR;
@@ -120,8 +119,7 @@ bool UnwindStackPtrace::Unwind(size_t num_ignore_frames, ucontext_t* context) {
  if (context == nullptr) {
    regs.reset(unwindstack::Regs::RemoteGet(Tid()));
  } else {
    regs.reset(
        unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentMachineType(), context));
    regs.reset(unwindstack::Regs::CreateFromUcontext(unwindstack::Regs::CurrentArch(), context));
  }

  error_ = BACKTRACE_UNWIND_NO_ERROR;
+4 −0
Original line number Diff line number Diff line
@@ -60,6 +60,10 @@ cc_library {
        "Maps.cpp",
        "Memory.cpp",
        "Regs.cpp",
        "RegsArm.cpp",
        "RegsArm64.cpp",
        "RegsX86.cpp",
        "RegsX86_64.cpp",
        "Unwinder.cpp",
        "Symbols.cpp",
    ],
+2 −2
Original line number Diff line number Diff line
@@ -23,11 +23,11 @@

#include <unwindstack/Log.h>
#include <unwindstack/Memory.h>
#include <unwindstack/Regs.h>
#include <unwindstack/RegsArm.h>

#include "ArmExidx.h"
#include "Check.h"
#include "Machine.h"
#include "MachineArm.h"

namespace unwindstack {

+10 −9
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@
#include <unwindstack/Regs.h>

#include "ElfInterfaceArm.h"
#include "Machine.h"
#include "Symbols.h"

namespace unwindstack {
@@ -183,18 +182,15 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) {
      return nullptr;
    }

    if (e_machine != EM_ARM && e_machine != EM_386) {
      // Unsupported.
      ALOGI("32 bit elf that is neither arm nor x86: e_machine = %d\n", e_machine);
      return nullptr;
    }

    machine_type_ = e_machine;
    if (e_machine == EM_ARM) {
      arch_ = ARCH_ARM;
      interface.reset(new ElfInterfaceArm(memory));
    } else if (e_machine == EM_386) {
      arch_ = ARCH_X86;
      interface.reset(new ElfInterface32(memory));
    } else {
      // Unsupported.
      ALOGI("32 bit elf that is neither arm nor x86: e_machine = %d\n", e_machine);
      return nullptr;
    }
@@ -203,12 +199,17 @@ ElfInterface* Elf::CreateInterfaceFromMemory(Memory* memory) {
    if (!memory->ReadFully(EI_NIDENT + sizeof(Elf64_Half), &e_machine, sizeof(e_machine))) {
      return nullptr;
    }
    if (e_machine != EM_AARCH64 && e_machine != EM_X86_64) {

    machine_type_ = e_machine;
    if (e_machine == EM_AARCH64) {
      arch_ = ARCH_ARM64;
    } else if (e_machine == EM_X86_64) {
      arch_ = ARCH_X86_64;
    } else {
      // Unsupported.
      ALOGI("64 bit elf that is neither aarch64 nor x86_64: e_machine = %d\n", e_machine);
      return nullptr;
    }
    machine_type_ = e_machine;
    interface.reset(new ElfInterface64(memory));
  }

+2 −2
Original line number Diff line number Diff line
@@ -18,11 +18,11 @@
#include <stdint.h>

#include <unwindstack/Memory.h>
#include <unwindstack/Regs.h>
#include <unwindstack/RegsArm.h>

#include "ArmExidx.h"
#include "ElfInterfaceArm.h"
#include "Machine.h"
#include "MachineArm.h"

namespace unwindstack {

Loading