libunwind-common.h revision f4a8df5f4f338f1a12c25213227e98b34b42447f
16534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* libunwind - a platform-independent unwind library 26534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris Copyright (C) 2001-2004 Hewlett-Packard Co 36534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris Contributed by David Mosberger-Tang <davidm@hpl.hp.com> 46534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 56534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisThis file is part of libunwind. 66534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 76534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisPermission is hereby granted, free of charge, to any person obtaining 86534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisa copy of this software and associated documentation files (the 96534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris"Software"), to deal in the Software without restriction, including 106534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferriswithout limitation the rights to use, copy, modify, merge, publish, 116534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisdistribute, sublicense, and/or sell copies of the Software, and to 126534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrispermit persons to whom the Software is furnished to do so, subject to 136534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristhe following conditions: 146534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 156534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisThe above copyright notice and this permission notice shall be 166534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisincluded in all copies or substantial portions of the Software. 176534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 186534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 196534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 206534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 216534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 226534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 236534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 246534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher FerrisWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 256534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 2616b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris/* ANDROID support update. */ 2716b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris#include <sys/types.h> 2816b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris/* End of ANDROID update. */ 2916b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris 306534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_VERSION_MAJOR 1 316534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_VERSION_MINOR 1 326534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_VERSION_EXTRA 336534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 346534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min)) 356534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR) 366534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 376534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_PASTE2(x,y) x##y 386534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_PASTE(x,y) UNW_PASTE2(x,y) 396534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn) 406534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn) 416534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 426534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#ifdef UNW_LOCAL_ONLY 436534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_) 446534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#else /* !UNW_LOCAL_ONLY */ 456534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_) 466534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#endif /* !UNW_LOCAL_ONLY */ 476534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 486534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* Error codes. The unwind routines return the *negated* values of 496534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris these error codes on error and a non-negative value on success. */ 506534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef enum 516534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris { 526534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_ESUCCESS = 0, /* no error */ 536534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_EUNSPEC, /* unspecified (general) error */ 546534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_ENOMEM, /* out of memory */ 556534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_EBADREG, /* bad register number */ 566534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_EREADONLYREG, /* attempt to write read-only register */ 576534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_ESTOPUNWIND, /* stop unwinding */ 586534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_EINVALIDIP, /* invalid IP */ 596534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_EBADFRAME, /* bad frame */ 606534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_EINVAL, /* unsupported operation or bad value */ 616534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_EBADVERSION, /* unwind info has unsupported version */ 626534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_ENOINFO /* no unwind info found */ 636534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris } 646534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisunw_error_t; 656534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 666534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* The following enum defines the indices for a couple of 676534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris (pseudo-)registers which have the same meaning across all 686534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris platforms. (RO) means read-only. (RW) means read-write. General 696534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris registers (aka "integer registers") are expected to start with 706534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris index 0. The number of such registers is architecture-dependent. 716534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris The remaining indices can be used as an architecture sees fit. The 726534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris last valid register index is given by UNW_REG_LAST. */ 736534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef enum 746534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris { 756534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */ 766534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */ 776534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */ 786534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_REG_LAST = UNW_TDEP_LAST_REG 796534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris } 806534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisunw_frame_regnum_t; 816534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 826534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* Number of exception-handler argument registers: */ 836534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS 846534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 856534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef enum 866534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris { 876534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_CACHE_NONE, /* no caching */ 886534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_CACHE_GLOBAL, /* shared global cache */ 896534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_CACHE_PER_THREAD /* per-thread caching */ 906534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris } 916534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisunw_caching_policy_t; 926534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 936534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef int unw_regnum_t; 946534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 956534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* The unwind cursor starts at the youngest (most deeply nested) frame 966534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris and is used to track the frame state as the unwinder steps from 976534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris frame to frame. It is safe to make (shallow) copies of variables 986534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris of this type. */ 996534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef struct unw_cursor 1006534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris { 1016534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_word_t opaque[UNW_TDEP_CURSOR_LEN]; 1026534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris } 1036534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisunw_cursor_t; 1046534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1056534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* This type encapsulates the entire (preserved) machine-state. */ 1066534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef unw_tdep_context_t unw_context_t; 1076534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1086534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* unw_getcontext() fills the unw_context_t pointed to by UC with the 1096534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris machine state as it exists at the call-site. For implementation 1106534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris reasons, this needs to be a target-dependent macro. It's easiest 1116534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris to think of unw_getcontext() as being identical to getcontext(). */ 1126534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_getcontext(uc) unw_tdep_getcontext(uc) 1136534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1146534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* Return 1 if register number R is a floating-point register, zero 1156534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris otherwise. 1166534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris This routine is signal-safe. */ 1176534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_is_fpreg(r) unw_tdep_is_fpreg(r) 1186534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1196534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef unw_tdep_fpreg_t unw_fpreg_t; 1206534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1216534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef struct unw_addr_space *unw_addr_space_t; 1226534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1236534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* Each target may define it's own set of flags, but bits 0-15 are 1246534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris reserved for general libunwind-use. */ 1256534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_PI_FLAG_FIRST_TDEP_BIT 16 1266534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* The information comes from a .debug_frame section. */ 1276534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define UNW_PI_FLAG_DEBUG_FRAME 32 1286534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1296534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef struct unw_proc_info 1306534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris { 1316534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_word_t start_ip; /* first IP covered by this procedure */ 1326534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_word_t end_ip; /* first IP NOT covered by this procedure */ 1336534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_word_t lsda; /* address of lang.-spec. data area (if any) */ 1346534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_word_t handler; /* optional personality routine */ 1356534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_word_t gp; /* global-pointer value for this procedure */ 1366534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_word_t flags; /* misc. flags */ 1376534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1386534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int format; /* unwind-info format (arch-specific) */ 1396534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int unwind_info_size; /* size of the information (if applicable) */ 1406534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris void *unwind_info; /* unwind-info (arch-specific) */ 1416534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */ 1426534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris } 1436534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisunw_proc_info_t; 1446534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1456534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* These are backend callback routines that provide access to the 1466534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris state of a "remote" process. This can be used, for example, to 1476534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unwind another process through the ptrace() interface. */ 1486534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef struct unw_accessors 1496534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris { 1506534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris /* Look up the unwind info associated with instruction-pointer IP. 1516534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris On success, the routine fills in the PROC_INFO structure. */ 1526534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int (*find_proc_info) (unw_addr_space_t, unw_word_t, unw_proc_info_t *, 1536534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int, void *); 1546534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1556534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris /* Release any resources (e.g., memory) that were allocated for 1566534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris the unwind info returned in by a previous call to 1576534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris find_proc_info() with NEED_UNWIND_INFO set to 1. */ 1586534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris void (*put_unwind_info) (unw_addr_space_t, unw_proc_info_t *, void *); 1596534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1606534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris /* Return the list-head of the dynamically registered unwind 1616534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris info. */ 1626534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int (*get_dyn_info_list_addr) (unw_addr_space_t, unw_word_t *, void *); 1636534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1646534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris /* Access aligned word at address ADDR. The value is returned 1656534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris according to the endianness of the host (e.g., if the host is 1666534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris little-endian and the target is big-endian, access_mem() needs 1676534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris to byte-swap the value before returning it). */ 1686534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int (*access_mem) (unw_addr_space_t, unw_word_t, unw_word_t *, int, 1696534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris void *); 1706534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1716534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris /* Access register number REG at address ADDR. */ 1726534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, int, 1736534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris void *); 1746534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1756534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris /* Access register number REG at address ADDR. */ 1766534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, 1776534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_fpreg_t *, int, void *); 1786534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1796534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int (*resume) (unw_addr_space_t, unw_cursor_t *, void *); 1806534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1816534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris /* Optional call back to obtain the name of a (static) procedure. 1826534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris Dynamically generated procedures are handled automatically by 1836534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris libunwind. This callback is optional and may be set to 1846534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris NULL. */ 1856534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris int (*get_proc_name) (unw_addr_space_t, unw_word_t, char *, size_t, 1866534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_word_t *, void *); 1876534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris } 1886534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisunw_accessors_t; 1896534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1906534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef enum unw_save_loc_type 1916534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris { 1926534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_SLT_NONE, /* register is not saved ("not an l-value") */ 1936534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_SLT_MEMORY, /* register has been saved in memory */ 1946534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris UNW_SLT_REG /* register has been saved in (another) register */ 1956534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris } 1966534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisunw_save_loc_type_t; 1976534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 1986534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferristypedef struct unw_save_loc 1996534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris { 2006534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_save_loc_type_t type; 2016534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris union 2026534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris { 2036534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */ 2046534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */ 2056534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris } 2066534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris u; 2076534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_tdep_save_loc_t extra; /* target-dependent additional information */ 2086534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris } 2096534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisunw_save_loc_t; 2106534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 21116b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris/* ANDROID support update. */ 21216b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferristypedef struct unw_map_cursor 21316b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris { 21416b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris void *map_list; 21516b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris void *cur_map; 21616b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris } 21716b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferrisunw_map_cursor_t; 21816b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris 21916b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferristypedef struct unw_map 22016b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris { 22116b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris unw_word_t start; 22216b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris unw_word_t end; 22316b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris char *path; 22416b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris int flags; 22516b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris } 22616b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferrisunw_map_t; 22716b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris/* End of ANDROID update. */ 22816b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris 2296534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris/* These routines work both for local and remote unwinding. */ 2306534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 2316534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_local_addr_space UNW_OBJ(local_addr_space) 2326534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_create_addr_space UNW_OBJ(create_addr_space) 2336534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space) 2346534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_get_accessors UNW_ARCH_OBJ(get_accessors) 2356534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_init_local UNW_OBJ(init_local) 2366534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_init_remote UNW_OBJ(init_remote) 2376534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_step UNW_OBJ(step) 2386534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_resume UNW_OBJ(resume) 2396534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_get_proc_info UNW_OBJ(get_proc_info) 2406534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_get_proc_info_by_ip UNW_OBJ(get_proc_info_by_ip) 2416534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_get_reg UNW_OBJ(get_reg) 2426534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_set_reg UNW_OBJ(set_reg) 2436534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_get_fpreg UNW_OBJ(get_fpreg) 2446534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_set_fpreg UNW_OBJ(set_fpreg) 2456534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_get_save_loc UNW_OBJ(get_save_loc) 2466534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_is_signal_frame UNW_OBJ(is_signal_frame) 2476534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_handle_signal_frame UNW_OBJ(handle_signal_frame) 2486534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_get_proc_name UNW_OBJ(get_proc_name) 2496534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_get_proc_name_by_ip UNW_OBJ(get_proc_name_by_ip) 2506534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_set_caching_policy UNW_OBJ(set_caching_policy) 2516534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_regname UNW_ARCH_OBJ(regname) 2526534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_flush_cache UNW_ARCH_OBJ(flush_cache) 2536534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris#define unw_strerror UNW_ARCH_OBJ(strerror) 2546534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 2556534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern unw_addr_space_t unw_create_addr_space (unw_accessors_t *, int); 2566534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern void unw_destroy_addr_space (unw_addr_space_t); 2576534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern unw_accessors_t *unw_get_accessors (unw_addr_space_t); 2586534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern void unw_flush_cache (unw_addr_space_t, unw_word_t, unw_word_t); 2596534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_set_caching_policy (unw_addr_space_t, unw_caching_policy_t); 2606534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern const char *unw_regname (unw_regnum_t); 2616534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 2626534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_init_local (unw_cursor_t *, unw_context_t *); 2636534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *); 2646534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_step (unw_cursor_t *); 2656534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_resume (unw_cursor_t *); 2666534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_get_proc_info (unw_cursor_t *, unw_proc_info_t *); 2676534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_get_proc_info_by_ip (unw_addr_space_t, unw_word_t, 2686534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris unw_proc_info_t *, void *); 2696534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_get_reg (unw_cursor_t *, int, unw_word_t *); 2706534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_set_reg (unw_cursor_t *, int, unw_word_t); 2716534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_get_fpreg (unw_cursor_t *, int, unw_fpreg_t *); 2726534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_set_fpreg (unw_cursor_t *, int, unw_fpreg_t); 2736534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *); 2746534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_is_signal_frame (unw_cursor_t *); 2756534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_handle_signal_frame (unw_cursor_t *); 2766534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *); 2776534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_get_proc_name_by_ip (unw_addr_space_t, unw_word_t, char *, 2786534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris size_t, unw_word_t *, void *); 2796534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern const char *unw_strerror (int); 2806534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern int unw_backtrace (void **, int); 2816534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferris 28216b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris/* ANDROID support update. */ 283f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisextern int unw_map_local_cursor_valid (unw_map_cursor_t *); 284f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisextern void unw_map_local_cursor_get (unw_map_cursor_t *); 285f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisextern int unw_map_local_cursor_get_next (unw_map_cursor_t *, unw_map_t *); 286f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisextern int unw_map_local_create (void); 287f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisextern void unw_map_local_destroy (void); 28816b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferrisextern void unw_map_set (unw_addr_space_t, unw_map_cursor_t *); 28916b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferrisextern void unw_map_cursor_reset (unw_map_cursor_t *); 290f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisextern void unw_map_cursor_clear (unw_map_cursor_t *); 29116b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferrisextern int unw_map_cursor_create (unw_map_cursor_t *, pid_t); 29216b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferrisextern void unw_map_cursor_destroy (unw_map_cursor_t *); 293f4a8df5f4f338f1a12c25213227e98b34b42447fChristopher Ferrisextern int unw_map_cursor_get_next (unw_map_cursor_t *, unw_map_t *); 29416b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris/* End of ANDROID update. */ 29516b95a68caaa7e021209e2cd6a877ae1e558f740Christopher Ferris 2966534a77195ac6b5059bc9b6a27e8da58f538f55eChristopher Ferrisextern unw_addr_space_t unw_local_addr_space; 297