summaryrefslogtreecommitdiffstats
path: root/libunwindstack/include/unwindstack/Regs.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2018-03-14 18:16:22 -0700
committerChristopher Ferris <cferris@google.com>2018-03-16 23:38:07 -0700
commit11e96fe48a74e6ab97d4de899684d3a61a9d1129 (patch)
tree6a056073b680ed6fe25fb406e5f2b316b991ee3e /libunwindstack/include/unwindstack/Regs.h
parenta411fc65d1fc4c2c1c44d5d0860b31a018b8c9fd (diff)
downloadsystem_core-11e96fe48a74e6ab97d4de899684d3a61a9d1129.tar.gz
system_core-11e96fe48a74e6ab97d4de899684d3a61a9d1129.tar.bz2
system_core-11e96fe48a74e6ab97d4de899684d3a61a9d1129.zip
Always set the sp reg to the cfa for DWARF.
There are a few places where it is assumed that this register is set to the cfa value when interpreting DWARF information. Add a testcase for unwinding art_quick_osr_stub on ARM. Bug: 73954823 Test: Ran libunwindstack/libbacktrace unit tests. Test: Random debuggerd -b of process on a hikey. Test: Ran the 137 art test on host. Change-Id: Ida6ccdc38c3cfeea6b57fe861a0cc127b150b790
Diffstat (limited to 'libunwindstack/include/unwindstack/Regs.h')
-rw-r--r--libunwindstack/include/unwindstack/Regs.h23
1 files changed, 7 insertions, 16 deletions
diff --git a/libunwindstack/include/unwindstack/Regs.h b/libunwindstack/include/unwindstack/Regs.h
index b0e7ea152..4bac47313 100644
--- a/libunwindstack/include/unwindstack/Regs.h
+++ b/libunwindstack/include/unwindstack/Regs.h
@@ -45,8 +45,8 @@ class Regs {
int16_t value;
};
- Regs(uint16_t total_regs, uint16_t sp_reg, const Location& return_loc)
- : total_regs_(total_regs), sp_reg_(sp_reg), return_loc_(return_loc) {}
+ Regs(uint16_t total_regs, const Location& return_loc)
+ : total_regs_(total_regs), return_loc_(return_loc) {}
virtual ~Regs() = default;
virtual ArchEnum Arch() = 0;
@@ -57,6 +57,9 @@ class Regs {
virtual uint64_t pc() = 0;
virtual uint64_t sp() = 0;
+ virtual void set_pc(uint64_t pc) = 0;
+ virtual void set_sp(uint64_t sp) = 0;
+
uint64_t dex_pc() { return dex_pc_; }
void set_dex_pc(uint64_t dex_pc) { dex_pc_ = dex_pc; }
@@ -64,13 +67,10 @@ class Regs {
virtual bool StepIfSignalHandler(uint64_t rel_pc, Elf* elf, Memory* process_memory) = 0;
- virtual void SetFromRaw() = 0;
-
virtual bool SetPcFromReturnAddress(Memory* process_memory) = 0;
virtual void IterateRegisters(std::function<void(const char*, uint64_t)>) = 0;
- uint16_t sp_reg() { return sp_reg_; }
uint16_t total_regs() { return total_regs_; }
static ArchEnum CurrentArch();
@@ -80,7 +80,6 @@ class Regs {
protected:
uint16_t total_regs_;
- uint16_t sp_reg_;
Location return_loc_;
uint64_t dex_pc_ = 0;
};
@@ -88,16 +87,10 @@ class Regs {
template <typename AddressType>
class RegsImpl : public Regs {
public:
- RegsImpl(uint16_t total_regs, uint16_t sp_reg, Location return_loc)
- : Regs(total_regs, sp_reg, return_loc), regs_(total_regs) {}
+ RegsImpl(uint16_t total_regs, Location return_loc)
+ : Regs(total_regs, return_loc), regs_(total_regs) {}
virtual ~RegsImpl() = default;
- uint64_t pc() override { return pc_; }
- uint64_t sp() override { return sp_; }
-
- void set_pc(AddressType pc) { pc_ = pc; }
- void set_sp(AddressType sp) { sp_ = sp; }
-
bool Is32Bit() override { return sizeof(AddressType) == sizeof(uint32_t); }
inline AddressType& operator[](size_t reg) { return regs_[reg]; }
@@ -111,8 +104,6 @@ class RegsImpl : public Regs {
}
protected:
- AddressType pc_;
- AddressType sp_;
std::vector<AddressType> regs_;
};