ruby-changes:65209
From: Yusuke <ko1@a...>
Date: Wed, 10 Feb 2021 04:40:52 +0900 (JST)
Subject: [ruby-changes:65209] 66394aec98 (master): vm_dump.c: Dump machine registers on RISC-V Linux
https://git.ruby-lang.org/ruby.git/commit/?id=66394aec98 From 66394aec9813e52751e2b099ee6a4814ace494f8 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Wed, 10 Feb 2021 04:39:41 +0900 Subject: vm_dump.c: Dump machine registers on RISC-V Linux Fixes [Bug #17615] Co-Authored-By: xtkoba (Tee KOBAYASHI) <xtkoba+ruby@g...> --- vm_dump.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/vm_dump.c b/vm_dump.c index 279164c..a6c8eaa 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__ || defined __aarch64__ || defined __arm__ +# if defined __x86_64__ || defined __i386__ || defined __aarch64__ || defined __arm__ || defined __riscv # define HAVE_PRINT_MACHINE_REGISTERS 1 # endif #elif defined __APPLE__ @@ -813,7 +813,7 @@ 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#L813 # ifdef __linux__ # 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__) +# elif defined(__aarch64__) || defined(__arm__) || defined(__riscv) # define dump_machine_register(reg, regstr) (col_count = print_machine_register(reg, regstr, col_count, 80)) # endif # elif defined __APPLE__ @@ -908,6 +908,28 @@ rb_dump_machine_register(const ucontext_t *ctx) https://github.com/ruby/ruby/blob/trunk/vm_dump.c#L908 dump_machine_register(mctx->arm_r10, "r10"); dump_machine_register(mctx->arm_sp, "sp"); dump_machine_register(mctx->fault_address, "fault_address"); +# elif defined __riscv + dump_machine_register(mctx->__gregs[REG_SP], "sp"); + dump_machine_register(mctx->__gregs[REG_S0], "s0"); + dump_machine_register(mctx->__gregs[REG_S1], "s1"); + dump_machine_register(mctx->__gregs[REG_A0], "a0"); + dump_machine_register(mctx->__gregs[REG_A0+1], "a1"); + dump_machine_register(mctx->__gregs[REG_A0+2], "a2"); + dump_machine_register(mctx->__gregs[REG_A0+3], "a3"); + dump_machine_register(mctx->__gregs[REG_A0+4], "a4"); + dump_machine_register(mctx->__gregs[REG_A0+5], "a5"); + dump_machine_register(mctx->__gregs[REG_A0+6], "a6"); + dump_machine_register(mctx->__gregs[REG_A0+7], "a7"); + dump_machine_register(mctx->__gregs[REG_S2], "s2"); + dump_machine_register(mctx->__gregs[REG_S2+1], "s3"); + dump_machine_register(mctx->__gregs[REG_S2+2], "s4"); + dump_machine_register(mctx->__gregs[REG_S2+3], "s5"); + dump_machine_register(mctx->__gregs[REG_S2+4], "s6"); + dump_machine_register(mctx->__gregs[REG_S2+5], "s7"); + dump_machine_register(mctx->__gregs[REG_S2+6], "s8"); + dump_machine_register(mctx->__gregs[REG_S2+7], "s9"); + dump_machine_register(mctx->__gregs[REG_S2+8], "s10"); + dump_machine_register(mctx->__gregs[REG_S2+9], "s11"); # endif } # elif defined __APPLE__ -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/