ruby-changes:64203
From: David <ko1@a...>
Date: Wed, 16 Dec 2020 15:32:33 +0900 (JST)
Subject: [ruby-changes:64203] 19157a3c00 (master): vm debug: dump registers on ARM too. (#3900)
https://git.ruby-lang.org/ruby.git/commit/?id=19157a3c00 From 19157a3c001d68acdc8e5190a806189840d23375 Mon Sep 17 00:00:00 2001 From: David CARLIER <devnexen@g...> Date: Wed, 16 Dec 2020 06:32:11 +0000 Subject: vm debug: dump registers on ARM too. (#3900) * vm debug: dump registers on ARM too. diff --git a/vm_dump.c b/vm_dump.c index 46c2520..043c07c 100644 --- a/vm_dump.c +++ b/vm_dump.c @@ -781,7 +781,7 @@ rb_print_backtrace(void) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L781 #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_ https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L811 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) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L871 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__ -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/