dump_context: arm: name the registers in the dump output

The current ARM minidump_dump output makes people remember or look up
how registers are mapped in the ISA.  Let's use human friendly names
instead so they don't have to.

Currently it looks like:
MDRawContextARM
  context_flags       = 0x40000006
  iregs[ 0]            = 0x3c48b000
  iregs[ 1]            = 0x3
  iregs[ 2]            = 0x20
  iregs[ 3]            = 0x0
  iregs[ 4]            = 0x1c
  iregs[ 5]            = 0x3c48b000
  iregs[ 6]            = 0x20
  iregs[ 7]            = 0x3c48b04c
  iregs[ 8]            = 0x39100611
  iregs[ 9]            = 0x1c
  iregs[10]            = 0x0
  iregs[11]            = 0xbe61c200
  iregs[12]            = 0xfb9c1fec
  iregs[13]            = 0xbe61bd28
  iregs[14]            = 0x39e19b1c
  iregs[15]            = 0x357dd74c
  cpsr                = 0x680b0010
  float_save.fpscr     = 0x0

Now it looks like:
MDRawContextARM
  context_flags        = 0x40000006
  r0                   = 0x3c48b000
  r1                   = 0x3
  r2                   = 0x20
  r3                   = 0x0
  r4                   = 0x1c
  r5                   = 0x3c48b000
  r6                   = 0x20
  r7                   = 0x3c48b04c
  r8                   = 0x39100611
  r9                   = 0x1c
  r10                  = 0x0
  r11                  = 0xbe61c200
  r12                  = 0xfb9c1fec
  sp                   = 0xbe61bd28
  lr                   = 0x39e19b1c
  pc                   = 0x357dd74c
  cpsr                 = 0x680b0010
  float_save.fpscr     = 0x0

BUG=chromium:665083

Change-Id: I46d87c4ff7303a7efcd60da1d0b67ae7a5465c8f
Reviewed-on: https://chromium-review.googlesource.com/457197
Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
Mike Frysinger 2017-03-17 20:06:34 -04:00
parent 0c3b559653
commit 0a57d7a32b

View File

@ -549,22 +549,26 @@ void DumpContext::Print() {
case MD_CONTEXT_ARM: { case MD_CONTEXT_ARM: {
const MDRawContextARM* context_arm = GetContextARM(); const MDRawContextARM* context_arm = GetContextARM();
const char * const names[] = {
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
"r8", "r9", "r10", "r11", "r12", "sp", "lr", "pc",
};
printf("MDRawContextARM\n"); printf("MDRawContextARM\n");
printf(" context_flags = 0x%x\n", printf(" context_flags = 0x%x\n",
context_arm->context_flags); context_arm->context_flags);
for (unsigned int ireg_index = 0; for (unsigned int ireg_index = 0;
ireg_index < MD_CONTEXT_ARM_GPR_COUNT; ireg_index < MD_CONTEXT_ARM_GPR_COUNT;
++ireg_index) { ++ireg_index) {
printf(" iregs[%2d] = 0x%x\n", printf(" %-3s = 0x%x\n",
ireg_index, context_arm->iregs[ireg_index]); names[ireg_index], context_arm->iregs[ireg_index]);
} }
printf(" cpsr = 0x%x\n", context_arm->cpsr); printf(" cpsr = 0x%x\n", context_arm->cpsr);
printf(" float_save.fpscr = 0x%" PRIx64 "\n", printf(" float_save.fpscr = 0x%" PRIx64 "\n",
context_arm->float_save.fpscr); context_arm->float_save.fpscr);
for (unsigned int fpr_index = 0; for (unsigned int fpr_index = 0;
fpr_index < MD_FLOATINGSAVEAREA_ARM_FPR_COUNT; fpr_index < MD_FLOATINGSAVEAREA_ARM_FPR_COUNT;
++fpr_index) { ++fpr_index) {
printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n", printf(" float_save.regs[%2d] = 0x%" PRIx64 "\n",
fpr_index, context_arm->float_save.regs[fpr_index]); fpr_index, context_arm->float_save.regs[fpr_index]);
} }
for (unsigned int fpe_index = 0; for (unsigned int fpe_index = 0;