blob: 95ec070f6c5a7ee455495d72264569cd9d316711 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From 983eeae0792946fe5c090f95164c892ec6db5cc4 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 16 Feb 2020 16:22:53 -0800
4Subject: [PATCH] Add RISCV support to GetProgramCounter()
5
6Identify PC register from signal context
7
8Upstream-Status: Submitted [https://github.com/abseil/abseil-cpp/pull/621]
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 absl/debugging/internal/examine_stack.cc | 2 ++
12 1 file changed, 2 insertions(+)
13
14diff --git a/absl/debugging/internal/examine_stack.cc b/absl/debugging/internal/examine_stack.cc
15index 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--
282.25.0
29