@@ -345,6 +345,13 @@ static inline void invalidate_edi (struct elf_dyn_info *edi)
# define PT_ARM_EXIDX 0x70000001 /* ARM unwind segment */
#endif /* !PT_ARM_EXIDX */
+/* Define binary target address size */
+enum {
+ TARGET_ADDR_SIZE_DEFAULT,
+ TARGET_ADDR_SIZE_32,
+ TARGET_ADDR_SIZE_64
+};
+
#include "tdep/libunwind_i.h"
#ifndef tdep_get_func_addr
@@ -61,6 +61,7 @@ struct unw_addr_space
{
struct unw_accessors acc;
int big_endian;
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
AO_t cache_generation;
@@ -46,6 +46,7 @@ struct unw_addr_space
{
struct unw_accessors acc;
int big_endian;
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
AO_t cache_generation;
@@ -45,6 +45,7 @@ unw_tdep_frame_t;
struct unw_addr_space
{
struct unw_accessors acc;
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
AO_t cache_generation;
@@ -96,6 +96,7 @@ struct unw_addr_space
struct unw_accessors acc;
int big_endian;
int abi; /* abi < 0 => unknown, 0 => SysV, 1 => HP-UX, 2 => Windows */
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
AO_t cache_generation;
@@ -52,6 +52,7 @@ struct unw_addr_space
int big_endian;
mips_abi_t abi;
unsigned int addr_size;
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
@@ -51,6 +51,7 @@ unw_tdep_frame_t;
struct unw_addr_space
{
struct unw_accessors acc;
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
AO_t cache_generation;
@@ -53,6 +53,7 @@ struct unw_addr_space
struct unw_accessors acc;
int big_endian;
ppc64_abi_t abi;
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
AO_t cache_generation;
@@ -46,6 +46,7 @@ struct unw_addr_space
{
struct unw_accessors acc;
int big_endian;
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
AO_t cache_generation;
@@ -45,6 +45,7 @@ unw_tdep_frame_t;
struct unw_addr_space
{
struct unw_accessors acc;
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
AO_t cache_generation;
@@ -62,6 +62,7 @@ unw_tdep_frame_t;
struct unw_addr_space
{
struct unw_accessors acc;
+ int target_addr_size; /* target binary: 32/64 bit */
unw_caching_policy_t caching_policy;
#ifdef HAVE_ATOMIC_OPS_H
AO_t cache_generation;
In the case of unwinding the debug info from a binary that has a different address size than the current native platform, it is needed to record it in the address space struct, in order to correctly parse the debug info later. This mode is known as compat mode. This is the case on e.g. profiling an ARMv7 binary that runs on an ARMv8 (aka AARCH64) platform. Add the target_addr_size field in the unw_addr_space struct and provide the 32 and 64 bit macros for use in the code. Signed-off-by: Jean Pihet <jean.pihet@linaro.org> --- include/libunwind_i.h | 7 +++++++ include/tdep-aarch64/libunwind_i.h | 1 + include/tdep-arm/libunwind_i.h | 1 + include/tdep-hppa/libunwind_i.h | 1 + include/tdep-ia64/libunwind_i.h | 1 + include/tdep-mips/libunwind_i.h | 1 + include/tdep-ppc32/libunwind_i.h | 1 + include/tdep-ppc64/libunwind_i.h | 1 + include/tdep-sh/libunwind_i.h | 1 + include/tdep-x86/libunwind_i.h | 1 + include/tdep-x86_64/libunwind_i.h | 1 + 11 files changed, 17 insertions(+)