libdrgn: ppc64: fix fetching cr fields from pt_regs

The condition register fields are numbered from most significant to
least significant. Also, the CFI for unwinding the condition register
fields restores them in their position in the condition register, so do
the same when initially populating them.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
This commit is contained in:
Omar Sandoval 2021-02-17 00:45:14 -08:00
parent 547333d8ca
commit 36df5fc076

View File

@ -159,7 +159,7 @@ set_initial_registers_from_struct_ppc64(Dwfl_Thread *thread, const void *regs,
/* cr0 - cr7 */
uint64_t ccr = READ_REGISTER(38);
for (int i = 0; i < 8; i++)
dwarf_regs[i] = (ccr >> (4 * i)) & 0xf;
dwarf_regs[i] = ccr & (UINT64_C(0xf) << (28 - 4 * i));
if (!dwfl_thread_state_registers(thread, 68, 8, dwarf_regs))
return drgn_error_libdwfl();