summaryrefslogtreecommitdiff
path: root/vm_dump.c
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2020-12-16 06:32:11 +0000
committerGitHub <noreply@github.com>2020-12-16 15:32:11 +0900
commit19157a3c001d68acdc8e5190a806189840d23375 (patch)
treead50e087f6be5e75e6bdda2749ab1545bcab82a9 /vm_dump.c
parent98dca855736c9fb8d4edef8b33a5df1cfe67ebb7 (diff)
vm debug: dump registers on ARM too. (#3900)
* vm debug: dump registers on ARM too.
Notes
Notes: Merged-By: nurse <naruse@airemix.jp>
Diffstat (limited to 'vm_dump.c')
-rw-r--r--vm_dump.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/vm_dump.c b/vm_dump.c
index 46c2520769..043c07ccd9 100644
--- a/vm_dump.c
+++ b/vm_dump.c
@@ -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__