[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Libunwind-devel] [PATCH 15/19] Implement _UCD_access_reg() for ARM
From: |
Tommi Rantala |
Subject: |
[Libunwind-devel] [PATCH 15/19] Implement _UCD_access_reg() for ARM |
Date: |
Wed, 5 Sep 2012 14:50:23 +0300 |
Implement the Linux version of _UCD_access_reg() for ARM. We can
sidestep the register number remapping, as the libunwind register
numbers match one-to-one to the ELF core file register numbers.
---
src/coredump/_UCD_access_reg_linux.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/coredump/_UCD_access_reg_linux.c
b/src/coredump/_UCD_access_reg_linux.c
index 9026ec6..c48f5c9 100644
--- a/src/coredump/_UCD_access_reg_linux.c
+++ b/src/coredump/_UCD_access_reg_linux.c
@@ -1,4 +1,5 @@
/* libunwind - a platform-independent unwind library
+ Copyright (C) 2012 Tommi Rantala <address@hidden>
This file is part of libunwind.
@@ -30,12 +31,18 @@ _UCD_access_reg (unw_addr_space_t as,
unw_regnum_t regnum, unw_word_t *valp,
int write, void *arg)
{
+ struct UCD_info *ui = arg;
+
if (write)
{
Debug(0, "write is not supported\n");
return -UNW_EINVAL;
}
+#if defined(UNW_TARGET_ARM)
+ if (regnum < 0 || regnum >= 16)
+ goto badreg;
+#else
#if defined(UNW_TARGET_X86)
static const uint8_t remap_regs[] =
{
@@ -69,13 +76,11 @@ _UCD_access_reg (unw_addr_space_t as,
#error Port me
#endif
- struct UCD_info *ui = arg;
if (regnum < 0 || regnum >= (unw_regnum_t)ARRAY_SIZE(remap_regs))
- {
- Debug(0, "bad regnum:%d\n", regnum);
- return -UNW_EINVAL;
- }
+ goto badreg;
+
regnum = remap_regs[regnum];
+#endif
/* pr_reg is a long[] array, but it contains struct user_regs_struct's
* image.
@@ -87,4 +92,8 @@ _UCD_access_reg (unw_addr_space_t as,
*valp = ui->prstatus->pr_reg[regnum];
return 0;
+
+badreg:
+ Debug(0, "bad regnum:%d\n", regnum);
+ return -UNW_EINVAL;
}
--
1.7.9.5
- Re: [Libunwind-devel] [PATCH 14/19] Provide manual page for `unw_backtrace()', (continued)
[Libunwind-devel] [PATCH 12/19] Avoid LLVM -Wunused-value warning in src/dwarf/Gexpr.c, Tommi Rantala, 2012/09/05
[Libunwind-devel] [PATCH 13/19] Remove AC_FUNC_MEMCMP check from configure.in, Tommi Rantala, 2012/09/05
[Libunwind-devel] [PATCH 10/19] Change test-varargs to check libunwind backtracing, Tommi Rantala, 2012/09/05
[Libunwind-devel] [PATCH 16/19] ARM: invalidate proc info after non-dwarf unw_step(), Tommi Rantala, 2012/09/05
[Libunwind-devel] [PATCH 15/19] Implement _UCD_access_reg() for ARM,
Tommi Rantala <=
[Libunwind-devel] [PATCH 19/19] Rename and share `ALIGN' macro from _UCD_internal.h, Tommi Rantala, 2012/09/05
[Libunwind-devel] [PATCH 18/19] Fix IA64 separate builddir cursor generation, Tommi Rantala, 2012/09/05
[Libunwind-devel] [PATCH 17/19] Fix incorrect .debug_frame lookup with non-zero text segment vaddr, Tommi Rantala, 2012/09/05