Include PSTATE in tombstones on arm64.

A thread's PSTATE can sometimes be critical for understanding a crash,
especially with MTE and other new features that store per-thread state
in PSTATE.

Bug: 135772972
Change-Id: I1bee25bffe7eea395f04b6449dc9227298cf866e
This commit is contained in:
Peter Collingbourne 2019-11-18 12:36:50 -08:00
parent bc420c4748
commit bb2f941f57
4 changed files with 5 additions and 1 deletions

View file

@ -391,7 +391,7 @@ void dump_registers(log_t* log, unwindstack::Regs* regs) {
std::vector<std::pair<std::string, uint64_t>> special_row;
#if defined(__arm__) || defined(__aarch64__)
static constexpr const char* special_registers[] = {"ip", "lr", "sp", "pc"};
static constexpr const char* special_registers[] = {"ip", "lr", "sp", "pc", "pst"};
#elif defined(__i386__)
static constexpr const char* special_registers[] = {"ebp", "esp", "eip"};
#elif defined(__x86_64__)

View file

@ -103,6 +103,7 @@ void RegsArm64::IterateRegisters(std::function<void(const char*, uint64_t)> fn)
fn("sp", regs_[ARM64_REG_SP]);
fn("lr", regs_[ARM64_REG_LR]);
fn("pc", regs_[ARM64_REG_PC]);
fn("pst", regs_[ARM64_REG_PSTATE]);
}
Regs* RegsArm64::Read(void* remote_data) {
@ -113,6 +114,7 @@ Regs* RegsArm64::Read(void* remote_data) {
uint64_t* reg_data = reinterpret_cast<uint64_t*>(regs->RawData());
reg_data[ARM64_REG_PC] = user->pc;
reg_data[ARM64_REG_SP] = user->sp;
reg_data[ARM64_REG_PSTATE] = user->pstate;
return regs;
}

View file

@ -55,6 +55,7 @@ enum Arm64Reg : uint16_t {
ARM64_REG_R30,
ARM64_REG_R31,
ARM64_REG_PC,
ARM64_REG_PSTATE,
ARM64_REG_LAST,
ARM64_REG_SP = ARM64_REG_R31,

View file

@ -114,6 +114,7 @@ std::vector<Register> ExpectedRegisters<RegsArm64>() {
result.push_back({"sp", ARM64_REG_SP});
result.push_back({"lr", ARM64_REG_LR});
result.push_back({"pc", ARM64_REG_PC});
result.push_back({"pst", ARM64_REG_PSTATE});
return result;
}