aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Khem Raj <raj.khem@gmail.com>2020-02-20 19:36:24 -0800
committerGravatar GitHub <noreply@github.com>2020-02-20 22:36:23 -0500
commitf9b3d6e493c1b6ab3dbdab71c5f8fa849db4abaf (patch)
tree6960ae77f0e3150c2caa77c98b64157d1769ef5a
parent0232c87f21c26718aa3eb2d86678070f3b498a4e (diff)
Add RISCV support to GetProgramCounter() (#621)
Identify PC register from signal context Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--absl/debugging/internal/examine_stack.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/absl/debugging/internal/examine_stack.cc b/absl/debugging/internal/examine_stack.cc
index 22f41b4..a3dd893 100644
--- a/absl/debugging/internal/examine_stack.cc
+++ b/absl/debugging/internal/examine_stack.cc
@@ -53,6 +53,8 @@ void* GetProgramCounter(void* vuc) {
return reinterpret_cast<void*>(context->uc_mcontext.gp_regs[32]);
#elif defined(__powerpc__)
return reinterpret_cast<void*>(context->uc_mcontext.regs->nip);
+#elif defined(__riscv)
+ return reinterpret_cast<void*>(context->uc_mcontext.__gregs[REG_PC]);
#elif defined(__s390__) && !defined(__s390x__)
return reinterpret_cast<void*>(context->uc_mcontext.psw.addr & 0x7fffffff);
#elif defined(__s390__) && defined(__s390x__)