about summary refs log tree commit diff
path: root/absl
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-02-21T03·36-0800
committerGitHub <noreply@github.com>2020-02-21T03·36-0500
commitf9b3d6e493c1b6ab3dbdab71c5f8fa849db4abaf (patch)
tree6960ae77f0e3150c2caa77c98b64157d1769ef5a /absl
parent0232c87f21c26718aa3eb2d86678070f3b498a4e (diff)
Add RISCV support to GetProgramCounter() (#621)
Identify PC register from signal context

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'absl')
-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 22f41b46ee2e..a3dd893a9dfe 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__)