1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

vm debug: dump registers on ARM too. (#3900)

* vm debug: dump registers on ARM too.
This commit is contained in:
David CARLIER 2020-12-16 06:32:11 +00:00 committed by GitHub
parent 98dca85573
commit 19157a3c00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: git 2020-12-16 15:32:36 +09:00
Merged-By: nurse <naruse@airemix.jp>

View file

@ -781,7 +781,7 @@ rb_print_backtrace(void)
#endif
#if defined __linux__
# if defined __x86_64__ || defined __i386__
# if defined __x86_64__ || defined __i386__ || defined __aarch64__ || defined __arm__
# define HAVE_PRINT_MACHINE_REGISTERS 1
# endif
#elif defined __APPLE__
@ -811,7 +811,11 @@ print_machine_register(size_t reg, const char *reg_name, int col_count, int max_
return col_count;
}
# ifdef __linux__
# define dump_machine_register(reg) (col_count = print_machine_register(mctx->gregs[REG_##reg], #reg, col_count, 80))
# if defined(__x86_64__) || defined(__i386__)
# define dump_machine_register(reg) (col_count = print_machine_register(mctx->gregs[REG_##reg], #reg, col_count, 80))
# elif defined(__aarch64__) || defined(__arm__)
# define dump_machine_register(reg, regstr) (col_count = print_machine_register(reg, #regstr, col_count, 80))
# endif
# elif defined __APPLE__
# define dump_machine_register(reg) (col_count = print_machine_register(mctx->MCTX_SS_REG(reg), #reg, col_count, 80))
# endif
@ -867,6 +871,43 @@ rb_dump_machine_register(const ucontext_t *ctx)
dump_machine_register(EFL);
dump_machine_register(UESP);
dump_machine_register(SS);
# elif defined __aarch64__
dump_machine_register(mctx->regs[0], "x0");
dump_machine_register(mctx->regs[1], "x1");
dump_machine_register(mctx->regs[2], "x2");
dump_machine_register(mctx->regs[3], "x3");
dump_machine_register(mctx->regs[4], "x4");
dump_machine_register(mctx->regs[5], "x5");
dump_machine_register(mctx->regs[6], "x6");
dump_machine_register(mctx->regs[7], "x7");
dump_machine_register(mctx->regs[18], "x18");
dump_machine_register(mctx->regs[19], "x19");
dump_machine_register(mctx->regs[20], "x20");
dump_machine_register(mctx->regs[21], "x21");
dump_machine_register(mctx->regs[22], "x22");
dump_machine_register(mctx->regs[23], "x23");
dump_machine_register(mctx->regs[24], "x24");
dump_machine_register(mctx->regs[25], "x25");
dump_machine_register(mctx->regs[26], "x26");
dump_machine_register(mctx->regs[27], "x27");
dump_machine_register(mctx->regs[28], "x28");
dump_machine_register(mctx->regs[29], "x29");
dump_machine_register(mctx->sp, "sp");
dump_machine_register(mctx->fault_address, "fault_address");
# elif defined __arm__
dump_machine_register(mctx->arm_r0, "r0");
dump_machine_register(mctx->arm_r1, "r1");
dump_machine_register(mctx->arm_r2, "r2");
dump_machine_register(mctx->arm_r3, "r3");
dump_machine_register(mctx->arm_r4, "r4");
dump_machine_register(mctx->arm_r5, "r5");
dump_machine_register(mctx->arm_r6, "r6");
dump_machine_register(mctx->arm_r7, "r7");
dump_machine_register(mctx->arm_r8, "r8");
dump_machine_register(mctx->arm_r9, "r9");
dump_machine_register(mctx->arm_r10, "r10");
dump_machine_register(mctx->arm_sp, "sp");
dump_machine_register(mctx->fault_address, "fault_address");
# endif
}
# elif defined __APPLE__