Skip to content

Commit

Permalink
[lldb][AArch64] Correct type of 32 bit GPR RegisterValues when using …
Browse files Browse the repository at this point in the history
…core files (#70054)

As ReadRegister always read into a uint64_t, when it called operator=
with uint64_t it was setting the RegisterValue's type to eTypeUInt64
regardless of its size.

This mostly works because most registers are 64 bit, and very few bits
of code rely on the type being correct. However, cpsr, fpsr and fpcr are
in fact 32 bit, and my upcoming register fields code relies on this type
being correct.

Which is how I found this bug and unfortunately is the only way to test
it. As RegisterValue::Type never makes it out via the API anywhere. So
this change will be tested once I start adding register field
information.
  • Loading branch information
DavidSpickett committed Oct 25, 2023
1 parent 99c15eb commit a770098
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,9 @@ bool RegisterContextCorePOSIX_arm64::ReadRegister(const RegisterInfo *reg_info,

offset = reg_info->byte_offset;
if (offset + reg_info->byte_size <= GetGPRSize()) {
uint64_t v = m_gpr_data.GetMaxU64(&offset, reg_info->byte_size);
if (offset == reg_info->byte_offset + reg_info->byte_size) {
value = v;
return true;
}
value.SetFromMemoryData(*reg_info, m_gpr_data.GetDataStart() + offset,
reg_info->byte_size, lldb::eByteOrderLittle, error);
return error.Success();
}

const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
Expand Down

0 comments on commit a770098

Please sign in to comment.