From 6a5da54b8ac724fc68001a1e07430d910d9e8141 Mon Sep 17 00:00:00 2001 From: Tommi Rantala Date: Thu, 2 Aug 2012 21:55:30 +0300 Subject: [PATCH] Allow for architecture specific dwarf_to_unw_regnum() For a few of the supported architectures we can use one-to-one mapping from the dwarf to the libunwind register numbers. Allow the architectures to define their own dwarf_to_unw_regnum() macro to do this easily. --- include/dwarf_i.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/dwarf_i.h b/include/dwarf_i.h index d01eab86..77f52fe9 100644 --- a/include/dwarf_i.h +++ b/include/dwarf_i.h @@ -15,13 +15,13 @@ # define dwarf_addr_size(as) (sizeof (unw_word_t)) #endif -#define dwarf_to_unw_regnum_map UNW_OBJ (dwarf_to_unw_regnum_map) - +#ifndef dwarf_to_unw_regnum +# define dwarf_to_unw_regnum_map UNW_OBJ (dwarf_to_unw_regnum_map) extern uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH]; - /* REG is evaluated multiple times; it better be side-effects free! */ -#define dwarf_to_unw_regnum(reg) \ +# define dwarf_to_unw_regnum(reg) \ (((reg) <= DWARF_REGNUM_MAP_LENGTH) ? dwarf_to_unw_regnum_map[reg] : 0) +#endif #ifdef UNW_LOCAL_ONLY