Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 983eeae0792946fe5c090f95164c892ec6db5cc4 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 16 Feb 2020 16:22:53 -0800 |
| 4 | Subject: [PATCH] Add RISCV support to GetProgramCounter() |
| 5 | |
| 6 | Identify PC register from signal context |
| 7 | |
| 8 | Upstream-Status: Submitted [https://github.com/abseil/abseil-cpp/pull/621] |
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 10 | --- |
| 11 | absl/debugging/internal/examine_stack.cc | 2 ++ |
| 12 | 1 file changed, 2 insertions(+) |
| 13 | |
| 14 | diff --git a/absl/debugging/internal/examine_stack.cc b/absl/debugging/internal/examine_stack.cc |
| 15 | index 4739fbc..fb77450 100644 |
| 16 | --- a/absl/debugging/internal/examine_stack.cc |
| 17 | +++ b/absl/debugging/internal/examine_stack.cc |
| 18 | @@ -53,6 +53,8 @@ void* GetProgramCounter(void* vuc) { |
| 19 | return reinterpret_cast<void*>(context->uc_mcontext.gp_regs[32]); |
| 20 | #elif defined(__powerpc__) |
| 21 | return reinterpret_cast<void*>(context->uc_mcontext.regs->nip); |
| 22 | +#elif defined(__riscv) |
| 23 | + return reinterpret_cast<void*>(context->uc_mcontext.__gregs[REG_PC]); |
| 24 | #elif defined(__s390__) && !defined(__s390x__) |
| 25 | return reinterpret_cast<void*>(context->uc_mcontext.psw.addr & 0x7fffffff); |
| 26 | #elif defined(__s390__) && defined(__s390x__) |
| 27 | -- |
| 28 | 2.25.0 |
| 29 | |