diff --git a/include/compiler.h b/include/compiler.h index 312ac150..abd424d8 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -31,28 +31,28 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define COMPILER_H #ifdef __GNUC__ -# define ALIGNED(x) __attribute__((aligned(x))) -# define CONST_ATTR __attribute__((__const__)) -# define UNUSED __attribute__((unused)) -# define NOINLINE __attribute__((noinline)) -# define NORETURN __attribute__((noreturn)) -# define ALIAS(name) __attribute__((alias (#name))) +# define ALIGNED(x) __attribute__((aligned(x))) +# define CONST_ATTR __attribute__((__const__)) +# define UNUSED __attribute__((unused)) +# define NOINLINE __attribute__((noinline)) +# define NORETURN __attribute__((noreturn)) +# define ALIAS(name) __attribute__((alias (#name))) # if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) -# define ALWAYS_INLINE inline __attribute__((always_inline)) -# define HIDDEN __attribute__((visibility ("hidden"))) -# define PROTECTED __attribute__((visibility ("protected"))) +# define ALWAYS_INLINE inline __attribute__((always_inline)) +# define HIDDEN __attribute__((visibility ("hidden"))) +# define PROTECTED __attribute__((visibility ("protected"))) # else # define ALWAYS_INLINE # define HIDDEN # define PROTECTED # endif -# define WEAK __attribute__((weak)) +# define WEAK __attribute__((weak)) # if (__GNUC__ >= 3) -# define likely(x) __builtin_expect ((x), 1) -# define unlikely(x) __builtin_expect ((x), 0) +# define likely(x) __builtin_expect ((x), 1) +# define unlikely(x) __builtin_expect ((x), 0) # else -# define likely(x) (x) -# define unlikely(x) (x) +# define likely(x) (x) +# define unlikely(x) (x) # endif #else # define ALIGNED(x) @@ -65,10 +65,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ # define HIDDEN # define PROTECTED # define WEAK -# define likely(x) (x) -# define unlikely(x) (x) +# define likely(x) (x) +# define unlikely(x) (x) #endif -#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) #endif /* COMPILER_H */ diff --git a/include/dwarf-eh.h b/include/dwarf-eh.h index 405e394a..e81aaef8 100644 --- a/include/dwarf-eh.h +++ b/include/dwarf-eh.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -58,9 +58,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ string: 'z': The operand for this character is a uleb128 value that gives the - length of the CIE augmentation body, not counting the length - of the uleb128 operand itself. If present, this code must - appear as the first character in the augmentation body. + length of the CIE augmentation body, not counting the length + of the uleb128 operand itself. If present, this code must + appear as the first character in the augmentation body. 'L': Indicates that the FDE's augmentation body contains an LSDA pointer. The operand for this character is a single byte @@ -73,13 +73,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ operand for this character is a single byte that specifies the pointer-encoding (PE) that is used for the code-pointers. Note: the "address_range" member is always - encoded as an absolute value. Apart from that, the specified - FDE pointer-encoding applies. + encoded as an absolute value. Apart from that, the specified + FDE pointer-encoding applies. 'P': Indicates the presence of a personality routine (handler). The first operand for this character specifies the - pointer-encoding (PE) that is used for the second operand, - which specifies the address of the personality routine. + pointer-encoding (PE) that is used for the second operand, + which specifies the address of the personality routine. If the augmentation string contains any other characters, the remainder of the augmentation string should be ignored. @@ -104,7 +104,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ */ -#define DW_EH_VERSION 1 /* The version we're implementing */ +#define DW_EH_VERSION 1 /* The version we're implementing */ struct dwarf_eh_frame_hdr { @@ -115,14 +115,14 @@ struct dwarf_eh_frame_hdr /* The rest of the header is variable-length and consists of the following members: - encoded_t eh_frame_ptr; - encoded_t fde_count; - struct - { - encoded_t start_ip; // first address covered by this FDE - encoded_t fde_addr; // address of the FDE - } - binary_search_table[fde_count]; */ + encoded_t eh_frame_ptr; + encoded_t fde_count; + struct + { + encoded_t start_ip; // first address covered by this FDE + encoded_t fde_addr; // address of the FDE + } + binary_search_table[fde_count]; */ }; #endif /* dwarf_eh_h */ diff --git a/include/dwarf.h b/include/dwarf.h index 4ec172ea..71e9df60 100644 --- a/include/dwarf.h +++ b/include/dwarf.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -struct dwarf_cursor; /* forward-declaration */ +struct dwarf_cursor; /* forward-declaration */ struct elf_dyn_info; #include "dwarf-config.h" @@ -53,49 +53,49 @@ struct elf_dyn_info; typedef enum { - DW_OP_addr = 0x03, - DW_OP_deref = 0x06, - DW_OP_const1u = 0x08, - DW_OP_const1s = 0x09, - DW_OP_const2u = 0x0a, - DW_OP_const2s = 0x0b, - DW_OP_const4u = 0x0c, - DW_OP_const4s = 0x0d, - DW_OP_const8u = 0x0e, - DW_OP_const8s = 0x0f, - DW_OP_constu = 0x10, - DW_OP_consts = 0x11, - DW_OP_dup = 0x12, - DW_OP_drop = 0x13, - DW_OP_over = 0x14, - DW_OP_pick = 0x15, - DW_OP_swap = 0x16, - DW_OP_rot = 0x17, - DW_OP_xderef = 0x18, - DW_OP_abs = 0x19, - DW_OP_and = 0x1a, - DW_OP_div = 0x1b, - DW_OP_minus = 0x1c, - DW_OP_mod = 0x1d, - DW_OP_mul = 0x1e, - DW_OP_neg = 0x1f, - DW_OP_not = 0x20, - DW_OP_or = 0x21, - DW_OP_plus = 0x22, - DW_OP_plus_uconst = 0x23, - DW_OP_shl = 0x24, - DW_OP_shr = 0x25, - DW_OP_shra = 0x26, - DW_OP_xor = 0x27, - DW_OP_skip = 0x2f, - DW_OP_bra = 0x28, - DW_OP_eq = 0x29, - DW_OP_ge = 0x2a, - DW_OP_gt = 0x2b, - DW_OP_le = 0x2c, - DW_OP_lt = 0x2d, - DW_OP_ne = 0x2e, - DW_OP_lit0 = 0x30, + DW_OP_addr = 0x03, + DW_OP_deref = 0x06, + DW_OP_const1u = 0x08, + DW_OP_const1s = 0x09, + DW_OP_const2u = 0x0a, + DW_OP_const2s = 0x0b, + DW_OP_const4u = 0x0c, + DW_OP_const4s = 0x0d, + DW_OP_const8u = 0x0e, + DW_OP_const8s = 0x0f, + DW_OP_constu = 0x10, + DW_OP_consts = 0x11, + DW_OP_dup = 0x12, + DW_OP_drop = 0x13, + DW_OP_over = 0x14, + DW_OP_pick = 0x15, + DW_OP_swap = 0x16, + DW_OP_rot = 0x17, + DW_OP_xderef = 0x18, + DW_OP_abs = 0x19, + DW_OP_and = 0x1a, + DW_OP_div = 0x1b, + DW_OP_minus = 0x1c, + DW_OP_mod = 0x1d, + DW_OP_mul = 0x1e, + DW_OP_neg = 0x1f, + DW_OP_not = 0x20, + DW_OP_or = 0x21, + DW_OP_plus = 0x22, + DW_OP_plus_uconst = 0x23, + DW_OP_shl = 0x24, + DW_OP_shr = 0x25, + DW_OP_shra = 0x26, + DW_OP_xor = 0x27, + DW_OP_skip = 0x2f, + DW_OP_bra = 0x28, + DW_OP_eq = 0x29, + DW_OP_ge = 0x2a, + DW_OP_gt = 0x2b, + DW_OP_le = 0x2c, + DW_OP_lt = 0x2d, + DW_OP_ne = 0x2e, + DW_OP_lit0 = 0x30, DW_OP_lit1, DW_OP_lit2, DW_OP_lit3, DW_OP_lit4, DW_OP_lit5, DW_OP_lit6, DW_OP_lit7, DW_OP_lit8, DW_OP_lit9, DW_OP_lit10, DW_OP_lit11, DW_OP_lit12, DW_OP_lit13, DW_OP_lit14, DW_OP_lit15, @@ -103,7 +103,7 @@ typedef enum DW_OP_lit21, DW_OP_lit22, DW_OP_lit23, DW_OP_lit24, DW_OP_lit25, DW_OP_lit26, DW_OP_lit27, DW_OP_lit28, DW_OP_lit29, DW_OP_lit30, DW_OP_lit31, - DW_OP_reg0 = 0x50, + DW_OP_reg0 = 0x50, DW_OP_reg1, DW_OP_reg2, DW_OP_reg3, DW_OP_reg4, DW_OP_reg5, DW_OP_reg6, DW_OP_reg7, DW_OP_reg8, DW_OP_reg9, DW_OP_reg10, DW_OP_reg11, DW_OP_reg12, DW_OP_reg13, DW_OP_reg14, DW_OP_reg15, @@ -111,7 +111,7 @@ typedef enum DW_OP_reg21, DW_OP_reg22, DW_OP_reg23, DW_OP_reg24, DW_OP_reg25, DW_OP_reg26, DW_OP_reg27, DW_OP_reg28, DW_OP_reg29, DW_OP_reg30, DW_OP_reg31, - DW_OP_breg0 = 0x70, + DW_OP_breg0 = 0x70, DW_OP_breg1, DW_OP_breg2, DW_OP_breg3, DW_OP_breg4, DW_OP_breg5, DW_OP_breg6, DW_OP_breg7, DW_OP_breg8, DW_OP_breg9, DW_OP_breg10, DW_OP_breg11, DW_OP_breg12, DW_OP_breg13, DW_OP_breg14, DW_OP_breg15, @@ -119,59 +119,59 @@ typedef enum DW_OP_breg21, DW_OP_breg22, DW_OP_breg23, DW_OP_breg24, DW_OP_breg25, DW_OP_breg26, DW_OP_breg27, DW_OP_breg28, DW_OP_breg29, DW_OP_breg30, DW_OP_breg31, - DW_OP_regx = 0x90, - DW_OP_fbreg = 0x91, - DW_OP_bregx = 0x92, - DW_OP_piece = 0x93, - DW_OP_deref_size = 0x94, - DW_OP_xderef_size = 0x95, - DW_OP_nop = 0x96, - DW_OP_push_object_address = 0x97, - DW_OP_call2 = 0x98, - DW_OP_call4 = 0x99, - DW_OP_call_ref = 0x9a, - DW_OP_lo_user = 0xe0, - DW_OP_hi_user = 0xff + DW_OP_regx = 0x90, + DW_OP_fbreg = 0x91, + DW_OP_bregx = 0x92, + DW_OP_piece = 0x93, + DW_OP_deref_size = 0x94, + DW_OP_xderef_size = 0x95, + DW_OP_nop = 0x96, + DW_OP_push_object_address = 0x97, + DW_OP_call2 = 0x98, + DW_OP_call4 = 0x99, + DW_OP_call_ref = 0x9a, + DW_OP_lo_user = 0xe0, + DW_OP_hi_user = 0xff } dwarf_expr_op_t; -#define DWARF_CIE_VERSION 3 /* GCC emits version 1??? */ +#define DWARF_CIE_VERSION 3 /* GCC emits version 1??? */ -#define DWARF_CFA_OPCODE_MASK 0xc0 -#define DWARF_CFA_OPERAND_MASK 0x3f +#define DWARF_CFA_OPCODE_MASK 0xc0 +#define DWARF_CFA_OPERAND_MASK 0x3f typedef enum { - DW_CFA_advance_loc = 0x40, - DW_CFA_offset = 0x80, - DW_CFA_restore = 0xc0, - DW_CFA_nop = 0x00, - DW_CFA_set_loc = 0x01, - DW_CFA_advance_loc1 = 0x02, - DW_CFA_advance_loc2 = 0x03, - DW_CFA_advance_loc4 = 0x04, - DW_CFA_offset_extended = 0x05, - DW_CFA_restore_extended = 0x06, - DW_CFA_undefined = 0x07, - DW_CFA_same_value = 0x08, - DW_CFA_register = 0x09, - DW_CFA_remember_state = 0x0a, - DW_CFA_restore_state = 0x0b, - DW_CFA_def_cfa = 0x0c, - DW_CFA_def_cfa_register = 0x0d, - DW_CFA_def_cfa_offset = 0x0e, - DW_CFA_def_cfa_expression = 0x0f, - DW_CFA_expression = 0x10, - DW_CFA_offset_extended_sf = 0x11, - DW_CFA_def_cfa_sf = 0x12, - DW_CFA_def_cfa_offset_sf = 0x13, - DW_CFA_val_expression = 0x16, - DW_CFA_lo_user = 0x1c, - DW_CFA_MIPS_advance_loc8 = 0x1d, - DW_CFA_GNU_window_save = 0x2d, - DW_CFA_GNU_args_size = 0x2e, - DW_CFA_GNU_negative_offset_extended = 0x2f, - DW_CFA_hi_user = 0x3c + DW_CFA_advance_loc = 0x40, + DW_CFA_offset = 0x80, + DW_CFA_restore = 0xc0, + DW_CFA_nop = 0x00, + DW_CFA_set_loc = 0x01, + DW_CFA_advance_loc1 = 0x02, + DW_CFA_advance_loc2 = 0x03, + DW_CFA_advance_loc4 = 0x04, + DW_CFA_offset_extended = 0x05, + DW_CFA_restore_extended = 0x06, + DW_CFA_undefined = 0x07, + DW_CFA_same_value = 0x08, + DW_CFA_register = 0x09, + DW_CFA_remember_state = 0x0a, + DW_CFA_restore_state = 0x0b, + DW_CFA_def_cfa = 0x0c, + DW_CFA_def_cfa_register = 0x0d, + DW_CFA_def_cfa_offset = 0x0e, + DW_CFA_def_cfa_expression = 0x0f, + DW_CFA_expression = 0x10, + DW_CFA_offset_extended_sf = 0x11, + DW_CFA_def_cfa_sf = 0x12, + DW_CFA_def_cfa_offset_sf = 0x13, + DW_CFA_val_expression = 0x16, + DW_CFA_lo_user = 0x1c, + DW_CFA_MIPS_advance_loc8 = 0x1d, + DW_CFA_GNU_window_save = 0x2d, + DW_CFA_GNU_args_size = 0x2e, + DW_CFA_GNU_negative_offset_extended = 0x2f, + DW_CFA_hi_user = 0x3c } dwarf_cfa_t; @@ -186,53 +186,53 @@ dwarf_cfa_t; engineered from GCC. */ -#define DW_EH_PE_FORMAT_MASK 0x0f /* format of the encoded value */ -#define DW_EH_PE_APPL_MASK 0x70 /* how the value is to be applied */ +#define DW_EH_PE_FORMAT_MASK 0x0f /* format of the encoded value */ +#define DW_EH_PE_APPL_MASK 0x70 /* how the value is to be applied */ /* Flag bit. If set, the resulting pointer is the address of the word that contains the final address. */ -#define DW_EH_PE_indirect 0x80 +#define DW_EH_PE_indirect 0x80 /* Pointer-encoding formats: */ -#define DW_EH_PE_omit 0xff -#define DW_EH_PE_ptr 0x00 /* pointer-sized unsigned value */ -#define DW_EH_PE_uleb128 0x01 /* unsigned LE base-128 value */ -#define DW_EH_PE_udata2 0x02 /* unsigned 16-bit value */ -#define DW_EH_PE_udata4 0x03 /* unsigned 32-bit value */ -#define DW_EH_PE_udata8 0x04 /* unsigned 64-bit value */ -#define DW_EH_PE_sleb128 0x09 /* signed LE base-128 value */ -#define DW_EH_PE_sdata2 0x0a /* signed 16-bit value */ -#define DW_EH_PE_sdata4 0x0b /* signed 32-bit value */ -#define DW_EH_PE_sdata8 0x0c /* signed 64-bit value */ +#define DW_EH_PE_omit 0xff +#define DW_EH_PE_ptr 0x00 /* pointer-sized unsigned value */ +#define DW_EH_PE_uleb128 0x01 /* unsigned LE base-128 value */ +#define DW_EH_PE_udata2 0x02 /* unsigned 16-bit value */ +#define DW_EH_PE_udata4 0x03 /* unsigned 32-bit value */ +#define DW_EH_PE_udata8 0x04 /* unsigned 64-bit value */ +#define DW_EH_PE_sleb128 0x09 /* signed LE base-128 value */ +#define DW_EH_PE_sdata2 0x0a /* signed 16-bit value */ +#define DW_EH_PE_sdata4 0x0b /* signed 32-bit value */ +#define DW_EH_PE_sdata8 0x0c /* signed 64-bit value */ /* Pointer-encoding application: */ -#define DW_EH_PE_absptr 0x00 /* absolute value */ -#define DW_EH_PE_pcrel 0x10 /* rel. to addr. of encoded value */ -#define DW_EH_PE_textrel 0x20 /* text-relative (GCC-specific???) */ -#define DW_EH_PE_datarel 0x30 /* data-relative */ +#define DW_EH_PE_absptr 0x00 /* absolute value */ +#define DW_EH_PE_pcrel 0x10 /* rel. to addr. of encoded value */ +#define DW_EH_PE_textrel 0x20 /* text-relative (GCC-specific???) */ +#define DW_EH_PE_datarel 0x30 /* data-relative */ /* The following are not documented by LSB v1.3, yet they are used by GCC, presumably they aren't documented by LSB since they aren't used on Linux: */ -#define DW_EH_PE_funcrel 0x40 /* start-of-procedure-relative */ -#define DW_EH_PE_aligned 0x50 /* aligned pointer */ +#define DW_EH_PE_funcrel 0x40 /* start-of-procedure-relative */ +#define DW_EH_PE_aligned 0x50 /* aligned pointer */ extern struct mempool dwarf_reg_state_pool; extern struct mempool dwarf_cie_info_pool; typedef enum { - DWARF_WHERE_UNDEF, /* register isn't saved at all */ - DWARF_WHERE_SAME, /* register has same value as in prev. frame */ - DWARF_WHERE_CFAREL, /* register saved at CFA-relative address */ - DWARF_WHERE_REG, /* register saved in another register */ - DWARF_WHERE_EXPR, /* register saved */ - DWARF_WHERE_VAL_EXPR, /* register has computed value */ + DWARF_WHERE_UNDEF, /* register isn't saved at all */ + DWARF_WHERE_SAME, /* register has same value as in prev. frame */ + DWARF_WHERE_CFAREL, /* register saved at CFA-relative address */ + DWARF_WHERE_REG, /* register saved in another register */ + DWARF_WHERE_EXPR, /* register saved */ + DWARF_WHERE_VAL_EXPR, /* register has computed value */ } dwarf_where_t; typedef struct { - dwarf_where_t where; /* how is the register saved? */ - unw_word_t val; /* where it's saved */ + dwarf_where_t where; /* how is the register saved? */ + unw_word_t val; /* where it's saved */ } dwarf_save_loc_t; @@ -246,18 +246,18 @@ dwarf_save_loc_t; case of DWARF_WHERE_REG, member "val" gives the number of the base-register and the "val" member of DWARF_CFA_OFF_COLUMN gives the offset value. */ -#define DWARF_CFA_REG_COLUMN DWARF_NUM_PRESERVED_REGS -#define DWARF_CFA_OFF_COLUMN (DWARF_NUM_PRESERVED_REGS + 1) +#define DWARF_CFA_REG_COLUMN DWARF_NUM_PRESERVED_REGS +#define DWARF_CFA_OFF_COLUMN (DWARF_NUM_PRESERVED_REGS + 1) typedef struct dwarf_reg_state { - struct dwarf_reg_state *next; /* for rs_stack */ + struct dwarf_reg_state *next; /* for rs_stack */ dwarf_save_loc_t reg[DWARF_NUM_PRESERVED_REGS + 2]; - unw_word_t ip; /* ip this rs is for */ + unw_word_t ip; /* ip this rs is for */ unw_word_t ret_addr_column; /* indicates which column in the rule table represents return address */ - unsigned short lru_chain; /* used for least-recently-used chain */ - unsigned short coll_chain; /* used for hash collisions */ - unsigned short hint; /* hint for next rs to try (or -1) */ + unsigned short lru_chain; /* used for least-recently-used chain */ + unsigned short coll_chain; /* used for hash collisions */ + unsigned short hint; /* hint for next rs to try (or -1) */ unsigned short valid : 1; /* optional machine-dependent signal info */ unsigned short signal_frame : 1; /* optional machine-dependent signal info */ } @@ -265,14 +265,14 @@ dwarf_reg_state_t; typedef struct dwarf_cie_info { - unw_word_t cie_instr_start; /* start addr. of CIE "initial_instructions" */ - unw_word_t cie_instr_end; /* end addr. of CIE "initial_instructions" */ - unw_word_t fde_instr_start; /* start addr. of FDE "instructions" */ - unw_word_t fde_instr_end; /* end addr. of FDE "instructions" */ - unw_word_t code_align; /* code-alignment factor */ - unw_word_t data_align; /* data-alignment factor */ - unw_word_t ret_addr_column; /* column of return-address register */ - unw_word_t handler; /* address of personality-routine */ + unw_word_t cie_instr_start; /* start addr. of CIE "initial_instructions" */ + unw_word_t cie_instr_end; /* end addr. of CIE "initial_instructions" */ + unw_word_t fde_instr_start; /* start addr. of FDE "instructions" */ + unw_word_t fde_instr_end; /* end addr. of FDE "instructions" */ + unw_word_t code_align; /* code-alignment factor */ + unw_word_t data_align; /* data-alignment factor */ + unw_word_t ret_addr_column; /* column of return-address register */ + unw_word_t handler; /* address of personality-routine */ uint16_t abi; uint16_t tag; uint8_t fde_encoding; @@ -288,20 +288,20 @@ typedef struct dwarf_state_record unsigned char fde_encoding; unw_word_t args_size; - dwarf_reg_state_t rs_initial; /* reg-state after CIE instructions */ - dwarf_reg_state_t rs_current; /* current reg-state */ + dwarf_reg_state_t rs_initial; /* reg-state after CIE instructions */ + dwarf_reg_state_t rs_current; /* current reg-state */ } dwarf_state_record_t; typedef struct dwarf_cursor { - void *as_arg; /* argument to address-space callbacks */ - unw_addr_space_t as; /* reference to per-address-space info */ + void *as_arg; /* argument to address-space callbacks */ + unw_addr_space_t as; /* reference to per-address-space info */ - unw_word_t cfa; /* canonical frame address; aka frame-/stack-pointer */ - unw_word_t ip; /* instruction pointer */ - unw_word_t args_size; /* size of arguments */ - unw_word_t ret_addr_column; /* column for return-address */ + unw_word_t cfa; /* canonical frame address; aka frame-/stack-pointer */ + unw_word_t ip; /* instruction pointer */ + unw_word_t args_size; /* size of arguments */ + unw_word_t ret_addr_column; /* column for return-address */ unw_word_t eh_args[UNW_TDEP_NUM_EH_REGS]; unsigned int eh_valid_mask; @@ -309,33 +309,33 @@ typedef struct dwarf_cursor unsigned int stash_frames :1; /* stash frames for fast lookup */ unsigned int use_prev_instr :1; /* use previous (= call) or current (= signal) instruction? */ - unsigned int pi_valid :1; /* is proc_info valid? */ + unsigned int pi_valid :1; /* is proc_info valid? */ unsigned int pi_is_dynamic :1; /* proc_info found via dynamic proc info? */ - unw_proc_info_t pi; /* info about current procedure */ + unw_proc_info_t pi; /* info about current procedure */ short hint; /* faster lookup of the rs cache */ short prev_rs; } dwarf_cursor_t; -#define DWARF_LOG_UNW_CACHE_SIZE 7 -#define DWARF_UNW_CACHE_SIZE (1 << DWARF_LOG_UNW_CACHE_SIZE) +#define DWARF_LOG_UNW_CACHE_SIZE 7 +#define DWARF_UNW_CACHE_SIZE (1 << DWARF_LOG_UNW_CACHE_SIZE) -#define DWARF_LOG_UNW_HASH_SIZE (DWARF_LOG_UNW_CACHE_SIZE + 1) -#define DWARF_UNW_HASH_SIZE (1 << DWARF_LOG_UNW_HASH_SIZE) +#define DWARF_LOG_UNW_HASH_SIZE (DWARF_LOG_UNW_CACHE_SIZE + 1) +#define DWARF_UNW_HASH_SIZE (1 << DWARF_LOG_UNW_HASH_SIZE) typedef unsigned char unw_hash_index_t; struct dwarf_rs_cache { pthread_mutex_t lock; - unsigned short lru_head; /* index of lead-recently used rs */ - unsigned short lru_tail; /* index of most-recently used rs */ + unsigned short lru_head; /* index of lead-recently used rs */ + unsigned short lru_tail; /* index of most-recently used rs */ /* hash table that maps instruction pointer to rs index: */ unsigned short hash[DWARF_UNW_HASH_SIZE]; - uint32_t generation; /* generation number */ + uint32_t generation; /* generation number */ /* rs cache: */ dwarf_reg_state_t buckets[DWARF_UNW_CACHE_SIZE]; @@ -361,74 +361,74 @@ struct unw_debug_frame_list struct dwarf_callback_data { /* in: */ - unw_word_t ip; /* instruction-pointer we're looking for */ - unw_proc_info_t *pi; /* proc-info pointer */ + unw_word_t ip; /* instruction-pointer we're looking for */ + unw_proc_info_t *pi; /* proc-info pointer */ int need_unwind_info; /* out: */ - int single_fde; /* did we find a single FDE? (vs. a table) */ - unw_dyn_info_t di; /* table info (if single_fde is false) */ - unw_dyn_info_t di_debug; /* additional table info for .debug_frame */ + int single_fde; /* did we find a single FDE? (vs. a table) */ + unw_dyn_info_t di; /* table info (if single_fde is false) */ + unw_dyn_info_t di_debug; /* additional table info for .debug_frame */ }; /* Convenience macros: */ -#define dwarf_init UNW_ARCH_OBJ (dwarf_init) -#define dwarf_callback UNW_OBJ (dwarf_callback) -#define dwarf_find_proc_info UNW_OBJ (dwarf_find_proc_info) -#define dwarf_find_debug_frame UNW_OBJ (dwarf_find_debug_frame) -#define dwarf_search_unwind_table UNW_OBJ (dwarf_search_unwind_table) -#define dwarf_find_unwind_table UNW_OBJ (dwarf_find_unwind_table) -#define dwarf_put_unwind_info UNW_OBJ (dwarf_put_unwind_info) -#define dwarf_put_unwind_info UNW_OBJ (dwarf_put_unwind_info) -#define dwarf_eval_expr UNW_OBJ (dwarf_eval_expr) +#define dwarf_init UNW_ARCH_OBJ (dwarf_init) +#define dwarf_callback UNW_OBJ (dwarf_callback) +#define dwarf_find_proc_info UNW_OBJ (dwarf_find_proc_info) +#define dwarf_find_debug_frame UNW_OBJ (dwarf_find_debug_frame) +#define dwarf_search_unwind_table UNW_OBJ (dwarf_search_unwind_table) +#define dwarf_find_unwind_table UNW_OBJ (dwarf_find_unwind_table) +#define dwarf_put_unwind_info UNW_OBJ (dwarf_put_unwind_info) +#define dwarf_put_unwind_info UNW_OBJ (dwarf_put_unwind_info) +#define dwarf_eval_expr UNW_OBJ (dwarf_eval_expr) #define dwarf_extract_proc_info_from_fde \ - UNW_OBJ (dwarf_extract_proc_info_from_fde) -#define dwarf_find_save_locs UNW_OBJ (dwarf_find_save_locs) -#define dwarf_create_state_record UNW_OBJ (dwarf_create_state_record) -#define dwarf_make_proc_info UNW_OBJ (dwarf_make_proc_info) -#define dwarf_read_encoded_pointer UNW_OBJ (dwarf_read_encoded_pointer) -#define dwarf_step UNW_OBJ (dwarf_step) + UNW_OBJ (dwarf_extract_proc_info_from_fde) +#define dwarf_find_save_locs UNW_OBJ (dwarf_find_save_locs) +#define dwarf_create_state_record UNW_OBJ (dwarf_create_state_record) +#define dwarf_make_proc_info UNW_OBJ (dwarf_make_proc_info) +#define dwarf_read_encoded_pointer UNW_OBJ (dwarf_read_encoded_pointer) +#define dwarf_step UNW_OBJ (dwarf_step) extern int dwarf_init (void); #ifndef UNW_REMOTE_ONLY extern int dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr); extern int dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_proc_info_t *pi, + int need_unwind_info, void *arg); #endif /* !UNW_REMOTE_ONLY */ extern int dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug, - unw_word_t ip, unw_word_t segbase, - const char* obj_name, unw_word_t start, - unw_word_t end); + unw_word_t ip, unw_word_t segbase, + const char* obj_name, unw_word_t start, + unw_word_t end); extern int dwarf_search_unwind_table (unw_addr_space_t as, - unw_word_t ip, - unw_dyn_info_t *di, - unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_word_t ip, + unw_dyn_info_t *di, + unw_proc_info_t *pi, + int need_unwind_info, void *arg); extern int dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, - char *path, unw_word_t segbase, unw_word_t mapoff, - unw_word_t ip); + char *path, unw_word_t segbase, unw_word_t mapoff, + unw_word_t ip); extern void dwarf_put_unwind_info (unw_addr_space_t as, - unw_proc_info_t *pi, void *arg); + unw_proc_info_t *pi, void *arg); extern int dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t *addr, - unw_word_t len, unw_word_t *valp, - int *is_register); + unw_word_t len, unw_word_t *valp, + int *is_register); extern int dwarf_extract_proc_info_from_fde (unw_addr_space_t as, - unw_accessors_t *a, - unw_word_t *fde_addr, - unw_proc_info_t *pi, - int need_unwind_info, - unw_word_t base, - void *arg); + unw_accessors_t *a, + unw_word_t *fde_addr, + unw_proc_info_t *pi, + int need_unwind_info, + unw_word_t base, + void *arg); extern int dwarf_find_save_locs (struct dwarf_cursor *c); extern int dwarf_create_state_record (struct dwarf_cursor *c, - dwarf_state_record_t *sr); + dwarf_state_record_t *sr); extern int dwarf_make_proc_info (struct dwarf_cursor *c); extern int dwarf_read_encoded_pointer (unw_addr_space_t as, - unw_accessors_t *a, - unw_word_t *addr, - unsigned char encoding, - const unw_proc_info_t *pi, - unw_word_t *valp, void *arg); + unw_accessors_t *a, + unw_word_t *addr, + unsigned char encoding, + const unw_proc_info_t *pi, + unw_word_t *valp, void *arg); extern int dwarf_step (struct dwarf_cursor *c); #endif /* dwarf_h */ diff --git a/include/dwarf_i.h b/include/dwarf_i.h index 0e728457..1e6231e2 100644 --- a/include/dwarf_i.h +++ b/include/dwarf_i.h @@ -16,10 +16,10 @@ #endif #ifndef dwarf_to_unw_regnum -# define dwarf_to_unw_regnum_map UNW_OBJ (dwarf_to_unw_regnum_map) +# define dwarf_to_unw_regnum_map UNW_OBJ (dwarf_to_unw_regnum_map) extern const 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 @@ -44,7 +44,7 @@ dwarf_misaligned_value_t; static inline int dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - int8_t *val, void *arg) + int8_t *val, void *arg) { dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; @@ -55,7 +55,7 @@ dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - int16_t *val, void *arg) + int16_t *val, void *arg) { dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; @@ -66,7 +66,7 @@ dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - int32_t *val, void *arg) + int32_t *val, void *arg) { dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; @@ -77,7 +77,7 @@ dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - int64_t *val, void *arg) + int64_t *val, void *arg) { dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; @@ -88,7 +88,7 @@ dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - uint8_t *val, void *arg) + uint8_t *val, void *arg) { dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; @@ -99,7 +99,7 @@ dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - uint16_t *val, void *arg) + uint16_t *val, void *arg) { dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; @@ -110,7 +110,7 @@ dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - uint32_t *val, void *arg) + uint32_t *val, void *arg) { dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; @@ -121,7 +121,7 @@ dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - uint64_t *val, void *arg) + uint64_t *val, void *arg) { dwarf_misaligned_value_t *mvp = (void *) (uintptr_t) *addr; @@ -134,7 +134,7 @@ dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - uint8_t *valp, void *arg) + uint8_t *valp, void *arg) { unw_word_t val, aligned_addr = *addr & -sizeof (unw_word_t); unw_word_t off = *addr - aligned_addr; @@ -153,7 +153,7 @@ dwarf_readu8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - uint16_t *val, void *arg) + uint16_t *val, void *arg) { uint8_t v0, v1; int ret; @@ -171,7 +171,7 @@ dwarf_readu16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - uint32_t *val, void *arg) + uint32_t *val, void *arg) { uint16_t v0, v1; int ret; @@ -189,7 +189,7 @@ dwarf_readu32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - uint64_t *val, void *arg) + uint64_t *val, void *arg) { uint32_t v0, v1; int ret; @@ -207,7 +207,7 @@ dwarf_readu64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - int8_t *val, void *arg) + int8_t *val, void *arg) { uint8_t uval; int ret; @@ -220,7 +220,7 @@ dwarf_reads8 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - int16_t *val, void *arg) + int16_t *val, void *arg) { uint16_t uval; int ret; @@ -233,7 +233,7 @@ dwarf_reads16 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - int32_t *val, void *arg) + int32_t *val, void *arg) { uint32_t uval; int ret; @@ -246,7 +246,7 @@ dwarf_reads32 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - int64_t *val, void *arg) + int64_t *val, void *arg) { uint64_t uval; int ret; @@ -261,7 +261,7 @@ dwarf_reads64 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_readw (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - unw_word_t *val, void *arg) + unw_word_t *val, void *arg) { uint32_t u32; uint64_t u64; @@ -272,14 +272,14 @@ dwarf_readw (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, case 4: ret = dwarf_readu32 (as, a, addr, &u32, arg); if (ret < 0) - return ret; + return ret; *val = u32; return ret; case 8: ret = dwarf_readu64 (as, a, addr, &u64, arg); if (ret < 0) - return ret; + return ret; *val = u64; return ret; @@ -293,7 +293,7 @@ dwarf_readw (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_read_uleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - unw_word_t *valp, void *arg) + unw_word_t *valp, void *arg) { unw_word_t val = 0, shift = 0; unsigned char byte; @@ -302,7 +302,7 @@ dwarf_read_uleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, do { if ((ret = dwarf_readu8 (as, a, addr, &byte, arg)) < 0) - return ret; + return ret; val |= ((unw_word_t) byte & 0x7f) << shift; shift += 7; @@ -318,7 +318,7 @@ dwarf_read_uleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline int dwarf_read_sleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - unw_word_t *valp, void *arg) + unw_word_t *valp, void *arg) { unw_word_t val = 0, shift = 0; unsigned char byte; @@ -327,7 +327,7 @@ dwarf_read_sleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, do { if ((ret = dwarf_readu8 (as, a, addr, &byte, arg)) < 0) - return ret; + return ret; val |= ((unw_word_t) byte & 0x7f) << shift; shift += 7; @@ -344,9 +344,9 @@ dwarf_read_sleb128 (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static ALWAYS_INLINE int dwarf_read_encoded_pointer_inlined (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, unsigned char encoding, - const unw_proc_info_t *pi, - unw_word_t *valp, void *arg) + unw_word_t *addr, unsigned char encoding, + const unw_proc_info_t *pi, + unw_word_t *valp, void *arg) { unw_word_t val, initial_addr = *addr; uint16_t uval16; @@ -375,58 +375,58 @@ dwarf_read_encoded_pointer_inlined (unw_addr_space_t as, unw_accessors_t *a, { case DW_EH_PE_ptr: if ((ret = dwarf_readw (as, a, addr, &val, arg)) < 0) - return ret; + return ret; break; case DW_EH_PE_uleb128: if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) - return ret; + return ret; break; case DW_EH_PE_udata2: if ((ret = dwarf_readu16 (as, a, addr, &uval16, arg)) < 0) - return ret; + return ret; val = uval16; break; case DW_EH_PE_udata4: if ((ret = dwarf_readu32 (as, a, addr, &uval32, arg)) < 0) - return ret; + return ret; val = uval32; break; case DW_EH_PE_udata8: if ((ret = dwarf_readu64 (as, a, addr, &uval64, arg)) < 0) - return ret; + return ret; val = uval64; break; case DW_EH_PE_sleb128: if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) - return ret; + return ret; break; case DW_EH_PE_sdata2: if ((ret = dwarf_reads16 (as, a, addr, &sval16, arg)) < 0) - return ret; + return ret; val = sval16; break; case DW_EH_PE_sdata4: if ((ret = dwarf_reads32 (as, a, addr, &sval32, arg)) < 0) - return ret; + return ret; val = sval32; break; case DW_EH_PE_sdata8: if ((ret = dwarf_reads64 (as, a, addr, &sval64, arg)) < 0) - return ret; + return ret; val = sval64; break; default: Debug (1, "unexpected encoding format 0x%x\n", - encoding & DW_EH_PE_FORMAT_MASK); + encoding & DW_EH_PE_FORMAT_MASK); return -UNW_EINVAL; } @@ -462,7 +462,7 @@ dwarf_read_encoded_pointer_inlined (unw_addr_space_t as, unw_accessors_t *a, "segbase" member to unw_proc_info_t. */ default: Debug (1, "unexpected application type 0x%x\n", - encoding & DW_EH_PE_APPL_MASK); + encoding & DW_EH_PE_APPL_MASK); return -UNW_EINVAL; } @@ -480,7 +480,7 @@ dwarf_read_encoded_pointer_inlined (unw_addr_space_t as, unw_accessors_t *a, unw_word_t indirect_addr = val; if ((ret = dwarf_readw (as, a, &indirect_addr, &val, arg)) < 0) - return ret; + return ret; } *valp = val; diff --git a/include/libunwind-aarch64.h b/include/libunwind-aarch64.h index d50da8f7..cd01e578 100644 --- a/include/libunwind-aarch64.h +++ b/include/libunwind-aarch64.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Copyright (C) 2013 Linaro Limited This file is part of libunwind. @@ -35,10 +35,10 @@ extern "C" { #include #include -#define UNW_TARGET aarch64 -#define UNW_TARGET_AARCH64 1 +#define UNW_TARGET aarch64 +#define UNW_TARGET_AARCH64 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* This needs to be big enough to accommodate "struct cursor", while leaving some slack for future expansion. Changing this value will @@ -46,7 +46,7 @@ extern "C" { relatively cheap and unwind-state copying is relatively rare, so we want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 4096 +#define UNW_TDEP_CURSOR_LEN 4096 typedef uint64_t unw_word_t; typedef int64_t unw_sword_t; @@ -160,7 +160,7 @@ typedef enum aarch64_regnum_t; /* Use R0 through R3 to pass exception handling information. */ -#define UNW_TDEP_NUM_EH_REGS 4 +#define UNW_TDEP_NUM_EH_REGS 4 typedef struct unw_tdep_save_loc { @@ -176,7 +176,7 @@ typedef ucontext_t unw_tdep_context_t; #include "libunwind-dynamic.h" #define unw_tdep_getcontext(uc) (getcontext (uc), 0) -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) extern int unw_tdep_is_fpreg (int); diff --git a/include/libunwind-arm.h b/include/libunwind-arm.h index cba380f2..f208487a 100644 --- a/include/libunwind-arm.h +++ b/include/libunwind-arm.h @@ -32,10 +32,10 @@ extern "C" { #include #include -#define UNW_TARGET arm -#define UNW_TARGET_ARM 1 +#define UNW_TARGET arm +#define UNW_TARGET_ARM 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* This needs to be big enough to accommodate "struct cursor", while leaving some slack for future expansion. Changing this value will @@ -44,7 +44,7 @@ extern "C" { want to err on making it rather too big than too small. */ /* FIXME for ARM. Too big? What do other things use for similar tasks? */ -#define UNW_TDEP_CURSOR_LEN 4096 +#define UNW_TDEP_CURSOR_LEN 4096 typedef uint32_t unw_word_t; typedef int32_t unw_sword_t; @@ -242,7 +242,7 @@ typedef enum } arm_regnum_t; -#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for ARM. */ +#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for ARM. */ typedef struct unw_tdep_save_loc { @@ -263,22 +263,22 @@ unw_tdep_context_t; registers. FIXME: Not ideal, may not be sufficient for all libunwind use cases. Stores pc+8, which is only approximately correct, really. */ #ifndef __thumb__ -#define unw_tdep_getcontext(uc) (({ \ - unw_tdep_context_t *unw_ctx = (uc); \ - register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ - __asm__ __volatile__ ( \ - "stmia %[base], {r0-r15}" \ - : : [base] "r" (unw_base) : "memory"); \ +#define unw_tdep_getcontext(uc) (({ \ + unw_tdep_context_t *unw_ctx = (uc); \ + register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ + __asm__ __volatile__ ( \ + "stmia %[base], {r0-r15}" \ + : : [base] "r" (unw_base) : "memory"); \ }), 0) #else /* __thumb__ */ -#define unw_tdep_getcontext(uc) (({ \ - unw_tdep_context_t *unw_ctx = (uc); \ - register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ - __asm__ __volatile__ ( \ - ".align 2\nbx pc\nnop\n.code 32\n" \ - "stmia %[base], {r0-r15}\n" \ - "orr %[base], pc, #1\nbx %[base]" \ - : [base] "+r" (unw_base) : : "memory", "cc"); \ +#define unw_tdep_getcontext(uc) (({ \ + unw_tdep_context_t *unw_ctx = (uc); \ + register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ + __asm__ __volatile__ ( \ + ".align 2\nbx pc\nnop\n.code 32\n" \ + "stmia %[base], {r0-r15}\n" \ + "orr %[base], pc, #1\nbx %[base]" \ + : [base] "+r" (unw_base) : : "memory", "cc"); \ }), 0) #endif @@ -292,7 +292,7 @@ unw_tdep_proc_info_t; #include "libunwind-common.h" -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) extern int unw_tdep_is_fpreg (int); #if defined(__cplusplus) || defined(c_plusplus) diff --git a/include/libunwind-coredump.h b/include/libunwind-coredump.h index d2b05e71..3c781414 100644 --- a/include/libunwind-coredump.h +++ b/include/libunwind-coredump.h @@ -46,22 +46,22 @@ extern pid_t _UCD_get_pid(struct UCD_info *); extern int _UCD_get_cursig(struct UCD_info *); extern int _UCD_add_backing_file_at_segment(struct UCD_info *, int phdr_no, const char *filename); extern int _UCD_add_backing_file_at_vaddr(struct UCD_info *, - unsigned long vaddr, - const char *filename); + unsigned long vaddr, + const char *filename); extern int _UCD_find_proc_info (unw_addr_space_t, unw_word_t, - unw_proc_info_t *, int, void *); + unw_proc_info_t *, int, void *); extern void _UCD_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *); extern int _UCD_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *, - void *); + void *); extern int _UCD_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int, - void *); + void *); extern int _UCD_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *, - int, void *); + int, void *); extern int _UCD_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, - int, void *); + int, void *); extern int _UCD_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t, - unw_word_t *, void *); + unw_word_t *, void *); extern int _UCD_resume (unw_addr_space_t, unw_cursor_t *, void *); extern unw_accessors_t _UCD_accessors; diff --git a/include/libunwind-dynamic.h b/include/libunwind-dynamic.h index 584f392c..8feb9de8 100644 --- a/include/libunwind-dynamic.h +++ b/include/libunwind-dynamic.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -59,50 +59,50 @@ the following rules should be followed in declaring these structures: typedef enum { - UNW_DYN_STOP = 0, /* end-of-unwind-info marker */ - UNW_DYN_SAVE_REG, /* save register to another register */ - UNW_DYN_SPILL_FP_REL, /* frame-pointer-relative register spill */ - UNW_DYN_SPILL_SP_REL, /* stack-pointer-relative register spill */ - UNW_DYN_ADD, /* add constant value to a register */ - UNW_DYN_POP_FRAMES, /* drop one or more stack frames */ - UNW_DYN_LABEL_STATE, /* name the current state */ - UNW_DYN_COPY_STATE, /* set the region's entry-state */ - UNW_DYN_ALIAS /* get unwind info from an alias */ + UNW_DYN_STOP = 0, /* end-of-unwind-info marker */ + UNW_DYN_SAVE_REG, /* save register to another register */ + UNW_DYN_SPILL_FP_REL, /* frame-pointer-relative register spill */ + UNW_DYN_SPILL_SP_REL, /* stack-pointer-relative register spill */ + UNW_DYN_ADD, /* add constant value to a register */ + UNW_DYN_POP_FRAMES, /* drop one or more stack frames */ + UNW_DYN_LABEL_STATE, /* name the current state */ + UNW_DYN_COPY_STATE, /* set the region's entry-state */ + UNW_DYN_ALIAS /* get unwind info from an alias */ } unw_dyn_operation_t; typedef enum { - UNW_INFO_FORMAT_DYNAMIC, /* unw_dyn_proc_info_t */ - UNW_INFO_FORMAT_TABLE, /* unw_dyn_table_t */ - UNW_INFO_FORMAT_REMOTE_TABLE, /* unw_dyn_remote_table_t */ - UNW_INFO_FORMAT_ARM_EXIDX /* ARM specific unwind info */ + UNW_INFO_FORMAT_DYNAMIC, /* unw_dyn_proc_info_t */ + UNW_INFO_FORMAT_TABLE, /* unw_dyn_table_t */ + UNW_INFO_FORMAT_REMOTE_TABLE, /* unw_dyn_remote_table_t */ + UNW_INFO_FORMAT_ARM_EXIDX /* ARM specific unwind info */ } unw_dyn_info_format_t; typedef struct unw_dyn_op { - int8_t tag; /* what operation? */ - int8_t qp; /* qualifying predicate register */ - int16_t reg; /* what register */ - int32_t when; /* when does it take effect? */ - unw_word_t val; /* auxiliary value */ + int8_t tag; /* what operation? */ + int8_t qp; /* qualifying predicate register */ + int16_t reg; /* what register */ + int32_t when; /* when does it take effect? */ + unw_word_t val; /* auxiliary value */ } unw_dyn_op_t; typedef struct unw_dyn_region_info { - struct unw_dyn_region_info *next; /* linked list of regions */ - int32_t insn_count; /* region length (# of instructions) */ - uint32_t op_count; /* length of op-array */ - unw_dyn_op_t op[1]; /* variable-length op-array */ + struct unw_dyn_region_info *next; /* linked list of regions */ + int32_t insn_count; /* region length (# of instructions) */ + uint32_t op_count; /* length of op-array */ + unw_dyn_op_t op[1]; /* variable-length op-array */ } unw_dyn_region_info_t; typedef struct unw_dyn_proc_info { - unw_word_t name_ptr; /* address of human-readable procedure name */ - unw_word_t handler; /* address of personality routine */ + unw_word_t name_ptr; /* address of human-readable procedure name */ + unw_word_t handler; /* address of personality routine */ uint32_t flags; int32_t pad0; unw_dyn_region_info_t *regions; @@ -111,18 +111,18 @@ unw_dyn_proc_info_t; typedef struct unw_dyn_table_info { - unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ - unw_word_t segbase; /* segment base */ - unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ + unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ + unw_word_t segbase; /* segment base */ + unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ unw_word_t *table_data; } unw_dyn_table_info_t; typedef struct unw_dyn_remote_table_info { - unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ - unw_word_t segbase; /* segment base */ - unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ + unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ + unw_word_t segbase; /* segment base */ + unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ unw_word_t table_data; } unw_dyn_remote_table_info_t; @@ -132,16 +132,16 @@ typedef struct unw_dyn_info /* doubly-linked list of dyn-info structures: */ struct unw_dyn_info *next; struct unw_dyn_info *prev; - unw_word_t start_ip; /* first IP covered by this entry */ - unw_word_t end_ip; /* first IP NOT covered by this entry */ - unw_word_t gp; /* global-pointer in effect for this entry */ - int32_t format; /* real type: unw_dyn_info_format_t */ + unw_word_t start_ip; /* first IP covered by this entry */ + unw_word_t end_ip; /* first IP NOT covered by this entry */ + unw_word_t gp; /* global-pointer in effect for this entry */ + int32_t format; /* real type: unw_dyn_info_format_t */ int32_t pad; union { - unw_dyn_proc_info_t pi; - unw_dyn_table_info_t ti; - unw_dyn_remote_table_info_t rti; + unw_dyn_proc_info_t pi; + unw_dyn_table_info_t ti; + unw_dyn_remote_table_info_t rti; } u; } @@ -157,9 +157,9 @@ unw_dyn_info_list_t; /* Return the size (in bytes) of an unw_dyn_region_info_t structure that can hold OP_COUNT ops. */ -#define _U_dyn_region_info_size(op_count) \ - ((char *) (((unw_dyn_region_info_t *) NULL)->op + (op_count)) \ - - (char *) NULL) +#define _U_dyn_region_info_size(op_count) \ + ((char *) (((unw_dyn_region_info_t *) NULL)->op + (op_count)) \ + - (char *) NULL) /* Register the unwind info for a single procedure. This routine is NOT signal-safe. */ @@ -172,39 +172,39 @@ extern void _U_dyn_cancel (unw_dyn_info_t *); /* Convenience routines. */ -#define _U_dyn_op(_tag, _qp, _when, _reg, _val) \ - ((unw_dyn_op_t) { (_tag), (_qp), (_reg), (_when), (_val) }) +#define _U_dyn_op(_tag, _qp, _when, _reg, _val) \ + ((unw_dyn_op_t) { (_tag), (_qp), (_reg), (_when), (_val) }) -#define _U_dyn_op_save_reg(op, qp, when, reg, dst) \ - (*(op) = _U_dyn_op (UNW_DYN_SAVE_REG, (qp), (when), (reg), (dst))) +#define _U_dyn_op_save_reg(op, qp, when, reg, dst) \ + (*(op) = _U_dyn_op (UNW_DYN_SAVE_REG, (qp), (when), (reg), (dst))) -#define _U_dyn_op_spill_fp_rel(op, qp, when, reg, offset) \ - (*(op) = _U_dyn_op (UNW_DYN_SPILL_FP_REL, (qp), (when), (reg), \ - (offset))) +#define _U_dyn_op_spill_fp_rel(op, qp, when, reg, offset) \ + (*(op) = _U_dyn_op (UNW_DYN_SPILL_FP_REL, (qp), (when), (reg), \ + (offset))) -#define _U_dyn_op_spill_sp_rel(op, qp, when, reg, offset) \ - (*(op) = _U_dyn_op (UNW_DYN_SPILL_SP_REL, (qp), (when), (reg), \ - (offset))) +#define _U_dyn_op_spill_sp_rel(op, qp, when, reg, offset) \ + (*(op) = _U_dyn_op (UNW_DYN_SPILL_SP_REL, (qp), (when), (reg), \ + (offset))) -#define _U_dyn_op_add(op, qp, when, reg, value) \ - (*(op) = _U_dyn_op (UNW_DYN_ADD, (qp), (when), (reg), (value))) +#define _U_dyn_op_add(op, qp, when, reg, value) \ + (*(op) = _U_dyn_op (UNW_DYN_ADD, (qp), (when), (reg), (value))) -#define _U_dyn_op_pop_frames(op, qp, when, num_frames) \ - (*(op) = _U_dyn_op (UNW_DYN_POP_FRAMES, (qp), (when), 0, (num_frames))) +#define _U_dyn_op_pop_frames(op, qp, when, num_frames) \ + (*(op) = _U_dyn_op (UNW_DYN_POP_FRAMES, (qp), (when), 0, (num_frames))) -#define _U_dyn_op_label_state(op, label) \ - (*(op) = _U_dyn_op (UNW_DYN_LABEL_STATE, _U_QP_TRUE, -1, 0, (label))) +#define _U_dyn_op_label_state(op, label) \ + (*(op) = _U_dyn_op (UNW_DYN_LABEL_STATE, _U_QP_TRUE, -1, 0, (label))) -#define _U_dyn_op_copy_state(op, label) \ - (*(op) = _U_dyn_op (UNW_DYN_COPY_STATE, _U_QP_TRUE, -1, 0, (label))) +#define _U_dyn_op_copy_state(op, label) \ + (*(op) = _U_dyn_op (UNW_DYN_COPY_STATE, _U_QP_TRUE, -1, 0, (label))) -#define _U_dyn_op_alias(op, qp, when, addr) \ - (*(op) = _U_dyn_op (UNW_DYN_ALIAS, (qp), (when), 0, (addr))) +#define _U_dyn_op_alias(op, qp, when, addr) \ + (*(op) = _U_dyn_op (UNW_DYN_ALIAS, (qp), (when), 0, (addr))) -#define _U_dyn_op_stop(op) \ - (*(op) = _U_dyn_op (UNW_DYN_STOP, _U_QP_TRUE, -1, 0, 0)) +#define _U_dyn_op_stop(op) \ + (*(op) = _U_dyn_op (UNW_DYN_STOP, _U_QP_TRUE, -1, 0, 0)) /* The target-dependent qualifying predicate which is always TRUE. On IA-64, that's p0 (0), on non-predicated architectures, the value is ignored. */ -#define _U_QP_TRUE _U_TDEP_QP_TRUE +#define _U_QP_TRUE _U_TDEP_QP_TRUE diff --git a/include/libunwind-hppa.h b/include/libunwind-hppa.h index 74ea70da..7013aa77 100644 --- a/include/libunwind-hppa.h +++ b/include/libunwind-hppa.h @@ -32,17 +32,17 @@ extern "C" { #include #include -#define UNW_TARGET hppa -#define UNW_TARGET_HPPA 1 +#define UNW_TARGET hppa +#define UNW_TARGET_HPPA 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* This needs to be big enough to accommodate "struct cursor", while leaving some slack for future expansion. Changing this value will require recompiling all users of this library. Stack allocation is relatively cheap and unwind-state copying is relatively rare, so we want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 511 +#define UNW_TDEP_CURSOR_LEN 511 typedef uint32_t unw_word_t; typedef int32_t unw_sword_t; @@ -61,13 +61,13 @@ typedef enum implementation of the C++ exception handling ABI. See _Unwind_SetGR() and _Unwind_GetGR() for details. */ UNW_HPPA_GR = 0, - UNW_HPPA_RP = 2, /* return pointer */ - UNW_HPPA_FP = 3, /* frame pointer */ + UNW_HPPA_RP = 2, /* return pointer */ + UNW_HPPA_FP = 3, /* frame pointer */ UNW_HPPA_SP = UNW_HPPA_GR + 30, UNW_HPPA_FR = UNW_HPPA_GR + 32, - UNW_HPPA_IP = UNW_HPPA_FR + 32, /* instruction pointer */ + UNW_HPPA_IP = UNW_HPPA_FR + 32, /* instruction pointer */ /* other "preserved" registers (fpsr etc.)... */ @@ -76,10 +76,10 @@ typedef enum exception-handling registers which we then alias to the actual physical register. */ - UNW_HPPA_EH0 = UNW_HPPA_IP + 1, /* alias for UNW_HPPA_GR + 20 */ - UNW_HPPA_EH1 = UNW_HPPA_EH0 + 1, /* alias for UNW_HPPA_GR + 21 */ - UNW_HPPA_EH2 = UNW_HPPA_EH1 + 1, /* alias for UNW_HPPA_GR + 22 */ - UNW_HPPA_EH3 = UNW_HPPA_EH2 + 1, /* alias for UNW_HPPA_GR + 31 */ + UNW_HPPA_EH0 = UNW_HPPA_IP + 1, /* alias for UNW_HPPA_GR + 20 */ + UNW_HPPA_EH1 = UNW_HPPA_EH0 + 1, /* alias for UNW_HPPA_GR + 21 */ + UNW_HPPA_EH2 = UNW_HPPA_EH1 + 1, /* alias for UNW_HPPA_GR + 22 */ + UNW_HPPA_EH3 = UNW_HPPA_EH2 + 1, /* alias for UNW_HPPA_GR + 31 */ /* frame info (read-only) */ UNW_HPPA_CFA, @@ -92,7 +92,7 @@ typedef enum } hppa_regnum_t; -#define UNW_TDEP_NUM_EH_REGS 4 +#define UNW_TDEP_NUM_EH_REGS 4 typedef struct unw_tdep_save_loc { @@ -103,7 +103,7 @@ unw_tdep_save_loc_t; /* On PA-RISC, we can directly use ucontext_t as the unwind context. */ typedef ucontext_t unw_tdep_context_t; -#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_HPPA_FR) < 32) +#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_HPPA_FR) < 32) #include "libunwind-dynamic.h" @@ -115,7 +115,7 @@ unw_tdep_proc_info_t; #include "libunwind-common.h" -#define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) +#define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) extern int unw_tdep_getcontext (unw_tdep_context_t *); #if defined(__cplusplus) || defined(c_plusplus) diff --git a/include/libunwind-ia64.h b/include/libunwind-ia64.h index fb2fbfe5..0cc4f39e 100644 --- a/include/libunwind-ia64.h +++ b/include/libunwind-ia64.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -47,24 +47,24 @@ extern "C" { # define UNW_GENERIC_ONLY #endif -#define UNW_TARGET ia64 -#define UNW_TARGET_IA64 1 +#define UNW_TARGET ia64 +#define UNW_TARGET_IA64 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* This needs to be big enough to accommodate "struct cursor", while leaving some slack for future expansion. Changing this value will require recompiling all users of this library. Stack allocation is relatively cheap and unwind-state copying is relatively rare, so we want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 511 +#define UNW_TDEP_CURSOR_LEN 511 /* If this bit is it indicates that the procedure saved all of ar.bsp, ar.bspstore, and ar.rnat. If, additionally, ar.bsp != saved ar.bsp, then this procedure has performed a register-backing-store switch. */ -#define UNW_PI_FLAG_IA64_RBS_SWITCH_BIT (UNW_PI_FLAG_FIRST_TDEP_BIT + 0) +#define UNW_PI_FLAG_IA64_RBS_SWITCH_BIT (UNW_PI_FLAG_FIRST_TDEP_BIT + 0) -#define UNW_PI_FLAG_IA64_RBS_SWITCH (1 << UNW_PI_FLAG_IA64_RBS_SWITCH_BIT) +#define UNW_PI_FLAG_IA64_RBS_SWITCH (1 << UNW_PI_FLAG_IA64_RBS_SWITCH_BIT) typedef uint64_t unw_word_t; typedef int64_t unw_sword_t; @@ -76,7 +76,7 @@ typedef int64_t unw_sword_t; typedef union { struct { unw_word_t bits[2]; } raw; - long double dummy; /* dummy to force 16-byte alignment */ + long double dummy; /* dummy to force 16-byte alignment */ } unw_tdep_fpreg_t; @@ -92,15 +92,15 @@ typedef enum This convention facilitates architecture-independent implementation of the C++ exception handling ABI. See _Unwind_SetGR() and _Unwind_GetGR() for details. */ - UNW_IA64_GR = 0, /* general registers (r0..r127) */ + UNW_IA64_GR = 0, /* general registers (r0..r127) */ UNW_IA64_GP = UNW_IA64_GR + 1, UNW_IA64_TP = UNW_IA64_GR + 13, - UNW_IA64_NAT = UNW_IA64_GR + 128, /* NaT registers (nat0..nat127) */ + UNW_IA64_NAT = UNW_IA64_GR + 128, /* NaT registers (nat0..nat127) */ - UNW_IA64_FR = UNW_IA64_NAT + 128, /* fp registers (f0..f127) */ + UNW_IA64_FR = UNW_IA64_NAT + 128, /* fp registers (f0..f127) */ - UNW_IA64_AR = UNW_IA64_FR + 128, /* application registers (ar0..r127) */ + UNW_IA64_AR = UNW_IA64_FR + 128, /* application registers (ar0..r127) */ UNW_IA64_AR_RSC = UNW_IA64_AR + 16, UNW_IA64_AR_BSP = UNW_IA64_AR + 17, UNW_IA64_AR_BSPSTORE = UNW_IA64_AR + 18, @@ -115,9 +115,9 @@ typedef enum UNW_IA64_AR_LC = UNW_IA64_AR + 65, UNW_IA64_AR_EC = UNW_IA64_AR + 66, - UNW_IA64_BR = UNW_IA64_AR + 128, /* branch registers (b0..p7) */ - UNW_IA64_RP = UNW_IA64_BR + 0, /* return pointer (rp) */ - UNW_IA64_PR = UNW_IA64_BR + 8, /* predicate registers (p0..p63) */ + UNW_IA64_BR = UNW_IA64_AR + 128, /* branch registers (b0..p7) */ + UNW_IA64_RP = UNW_IA64_BR + 0, /* return pointer (rp) */ + UNW_IA64_PR = UNW_IA64_BR + 8, /* predicate registers (p0..p63) */ UNW_IA64_CFM, /* frame info: */ @@ -133,7 +133,7 @@ typedef enum } ia64_regnum_t; -#define UNW_TDEP_NUM_EH_REGS 4 /* r15-r18 are exception args */ +#define UNW_TDEP_NUM_EH_REGS 4 /* r15-r18 are exception args */ typedef struct unw_tdep_save_loc { @@ -150,7 +150,7 @@ unw_tdep_save_loc_t; /* On IA-64, we can directly use ucontext_t as the unwind context. */ typedef ucontext_t unw_tdep_context_t; -#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_IA64_FR) < 128) +#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_IA64_FR) < 128) #include "libunwind-dynamic.h" #include "libunwind-common.h" @@ -159,9 +159,9 @@ typedef ucontext_t unw_tdep_context_t; /* In theory, we could use _Uia64_getcontext() on HP-UX as well, but the benefit of doing so would be marginal given that it can't support UNW_LOCAL_ONLY. */ -# define unw_tdep_getcontext getcontext +# define unw_tdep_getcontext getcontext #else -# define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) +# define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) extern int unw_tdep_getcontext (unw_tdep_context_t *); #endif @@ -171,17 +171,17 @@ typedef ucontext_t unw_tdep_context_t; with malloc(), and should be free()d during the put_unwind_info() callback. This routine is signal-safe for the local-address-space case ONLY. */ -#define unw_search_ia64_unwind_table UNW_OBJ(search_unwind_table) +#define unw_search_ia64_unwind_table UNW_OBJ(search_unwind_table) extern int unw_search_ia64_unwind_table (unw_addr_space_t, unw_word_t, - unw_dyn_info_t *, unw_proc_info_t *, - int, void *); + unw_dyn_info_t *, unw_proc_info_t *, + int, void *); /* This is a helper routine which the get_dyn_info_list_addr() callback can use to locate the special dynamic-info list entry in an IA-64 unwind table. If the entry exists in the table, the list-address is returned. In all other cases, 0 is returned. */ extern unw_word_t _Uia64_find_dyn_list (unw_addr_space_t, unw_dyn_info_t *, - void *); + void *); /* This is a helper routine to obtain the kernel-unwind info. It is signal-safe. */ diff --git a/include/libunwind-mips.h b/include/libunwind-mips.h index cf22fc90..4591d062 100644 --- a/include/libunwind-mips.h +++ b/include/libunwind-mips.h @@ -36,10 +36,10 @@ extern "C" { # undef mips #endif -#define UNW_TARGET mips -#define UNW_TARGET_MIPS 1 +#define UNW_TARGET mips +#define UNW_TARGET_MIPS 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* This needs to be big enough to accommodate "struct cursor", while leaving some slack for future expansion. Changing this value will @@ -48,7 +48,7 @@ extern "C" { want to err on making it rather too big than too small. */ /* FIXME for MIPS. Too big? What do other things use for similar tasks? */ -#define UNW_TDEP_CURSOR_LEN 4096 +#define UNW_TDEP_CURSOR_LEN 4096 /* The size of a "word" varies on MIPS. This type is used for memory addresses and register values. To allow a single library to support @@ -119,7 +119,7 @@ typedef enum } mips_abi_t; -#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for MIPS. */ +#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for MIPS. */ typedef struct unw_tdep_save_loc { @@ -147,7 +147,7 @@ unw_tdep_proc_info_t; #define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) extern int unw_tdep_getcontext (ucontext_t *uc); -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) extern int unw_tdep_is_fpreg (int); #if defined(__cplusplus) || defined(c_plusplus) diff --git a/include/libunwind-ppc32.h b/include/libunwind-ppc32.h index d5342b12..47ebfde5 100644 --- a/include/libunwind-ppc32.h +++ b/include/libunwind-ppc32.h @@ -39,10 +39,10 @@ extern "C" { #include #include -#define UNW_TARGET ppc32 -#define UNW_TARGET_PPC32 1 +#define UNW_TARGET ppc32 +#define UNW_TARGET_PPC32 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* * This needs to be big enough to accommodate "struct cursor", while @@ -170,7 +170,7 @@ ppc32_regnum_t; * passing parameters to exception handlers. */ -#define UNW_TDEP_NUM_EH_REGS 4 +#define UNW_TDEP_NUM_EH_REGS 4 typedef struct unw_tdep_save_loc { @@ -185,7 +185,7 @@ typedef ucontext_t unw_tdep_context_t; using the "getcontext" name just because it's using libunwind. We can't just use __getcontext() either, because that isn't exported by glibc... */ -#define unw_tdep_getcontext(uc) (getcontext (uc), 0) +#define unw_tdep_getcontext(uc) (getcontext (uc), 0) #include "libunwind-dynamic.h" @@ -197,7 +197,7 @@ unw_tdep_proc_info_t; #include "libunwind-common.h" -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) extern int unw_tdep_is_fpreg (int); #if defined(__cplusplus) || defined(c_plusplus) diff --git a/include/libunwind-ppc64.h b/include/libunwind-ppc64.h index 07c72a9d..9944628d 100644 --- a/include/libunwind-ppc64.h +++ b/include/libunwind-ppc64.h @@ -39,10 +39,10 @@ extern "C" { #include #include -#define UNW_TARGET ppc64 -#define UNW_TARGET_PPC64 1 +#define UNW_TARGET ppc64 +#define UNW_TARGET_PPC64 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* * This needs to be big enough to accommodate "struct cursor", while @@ -234,7 +234,7 @@ ppc64_abi_t; * passing parameters to exception handlers. */ -#define UNW_TDEP_NUM_EH_REGS 4 +#define UNW_TDEP_NUM_EH_REGS 4 typedef struct unw_tdep_save_loc { @@ -249,7 +249,7 @@ typedef ucontext_t unw_tdep_context_t; using the "getcontext" name just because it's using libunwind. We can't just use __getcontext() either, because that isn't exported by glibc... */ -#define unw_tdep_getcontext(uc) (getcontext (uc), 0) +#define unw_tdep_getcontext(uc) (getcontext (uc), 0) #include "libunwind-dynamic.h" @@ -261,7 +261,7 @@ unw_tdep_proc_info_t; #include "libunwind-common.h" -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) extern int unw_tdep_is_fpreg (int); #if defined(__cplusplus) || defined(c_plusplus) diff --git a/include/libunwind-ptrace.h b/include/libunwind-ptrace.h index 7fca205e..801325c4 100644 --- a/include/libunwind-ptrace.h +++ b/include/libunwind-ptrace.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -40,18 +40,18 @@ extern "C" { extern void *_UPT_create (pid_t); extern void _UPT_destroy (void *); extern int _UPT_find_proc_info (unw_addr_space_t, unw_word_t, - unw_proc_info_t *, int, void *); + unw_proc_info_t *, int, void *); extern void _UPT_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *); extern int _UPT_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *, - void *); + void *); extern int _UPT_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int, - void *); + void *); extern int _UPT_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *, - int, void *); + int, void *); extern int _UPT_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, - int, void *); + int, void *); extern int _UPT_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t, - unw_word_t *, void *); + unw_word_t *, void *); extern int _UPT_resume (unw_addr_space_t, unw_cursor_t *, void *); extern unw_accessors_t _UPT_accessors; diff --git a/include/libunwind-sh.h b/include/libunwind-sh.h index a3edc863..927f61ff 100644 --- a/include/libunwind-sh.h +++ b/include/libunwind-sh.h @@ -34,10 +34,10 @@ extern "C" { #include #include -#define UNW_TARGET sh -#define UNW_TARGET_SH 1 +#define UNW_TARGET sh +#define UNW_TARGET_SH 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* This needs to be big enough to accommodate "struct cursor", while leaving some slack for future expansion. Changing this value will @@ -45,7 +45,7 @@ extern "C" { relatively cheap and unwind-state copying is relatively rare, so we want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 4096 +#define UNW_TDEP_CURSOR_LEN 4096 typedef uint32_t unw_word_t; typedef int32_t unw_sword_t; @@ -82,11 +82,11 @@ typedef enum } sh_regnum_t; -#define UNW_TDEP_NUM_EH_REGS 2 +#define UNW_TDEP_NUM_EH_REGS 2 typedef ucontext_t unw_tdep_context_t; -#define unw_tdep_getcontext(uc) (getcontext (uc), 0) +#define unw_tdep_getcontext(uc) (getcontext (uc), 0) typedef struct unw_tdep_save_loc { @@ -104,7 +104,7 @@ unw_tdep_proc_info_t; #include "libunwind-common.h" -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) extern int unw_tdep_is_fpreg (int); #if defined(__cplusplus) || defined(c_plusplus) diff --git a/include/libunwind-x86.h b/include/libunwind-x86.h index 32533df9..40fe0464 100644 --- a/include/libunwind-x86.h +++ b/include/libunwind-x86.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -34,17 +34,17 @@ extern "C" { #include #include -#define UNW_TARGET x86 -#define UNW_TARGET_X86 1 +#define UNW_TARGET x86 +#define UNW_TARGET_X86 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* This needs to be big enough to accommodate "struct cursor", while leaving some slack for future expansion. Changing this value will require recompiling all users of this library. Stack allocation is relatively cheap and unwind-state copying is relatively rare, so we want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 127 +#define UNW_TDEP_CURSOR_LEN 127 typedef uint32_t unw_word_t; typedef int32_t unw_sword_t; @@ -72,78 +72,78 @@ typedef enum DWARF, but that doesn't work because the libunwind requires that the exception argument registers be consecutive, which the wouldn't be with the DWARF numbering. */ - UNW_X86_EAX, /* scratch (exception argument 1) */ - UNW_X86_EDX, /* scratch (exception argument 2) */ - UNW_X86_ECX, /* scratch */ - UNW_X86_EBX, /* preserved */ - UNW_X86_ESI, /* preserved */ - UNW_X86_EDI, /* preserved */ - UNW_X86_EBP, /* (optional) frame-register */ - UNW_X86_ESP, /* (optional) frame-register */ - UNW_X86_EIP, /* frame-register */ - UNW_X86_EFLAGS, /* scratch (except for "direction", which is fixed */ - UNW_X86_TRAPNO, /* scratch */ + UNW_X86_EAX, /* scratch (exception argument 1) */ + UNW_X86_EDX, /* scratch (exception argument 2) */ + UNW_X86_ECX, /* scratch */ + UNW_X86_EBX, /* preserved */ + UNW_X86_ESI, /* preserved */ + UNW_X86_EDI, /* preserved */ + UNW_X86_EBP, /* (optional) frame-register */ + UNW_X86_ESP, /* (optional) frame-register */ + UNW_X86_EIP, /* frame-register */ + UNW_X86_EFLAGS, /* scratch (except for "direction", which is fixed */ + UNW_X86_TRAPNO, /* scratch */ /* MMX/stacked-fp registers */ - UNW_X86_ST0, /* fp return value */ - UNW_X86_ST1, /* scratch */ - UNW_X86_ST2, /* scratch */ - UNW_X86_ST3, /* scratch */ - UNW_X86_ST4, /* scratch */ - UNW_X86_ST5, /* scratch */ - UNW_X86_ST6, /* scratch */ - UNW_X86_ST7, /* scratch */ + UNW_X86_ST0, /* fp return value */ + UNW_X86_ST1, /* scratch */ + UNW_X86_ST2, /* scratch */ + UNW_X86_ST3, /* scratch */ + UNW_X86_ST4, /* scratch */ + UNW_X86_ST5, /* scratch */ + UNW_X86_ST6, /* scratch */ + UNW_X86_ST7, /* scratch */ - UNW_X86_FCW, /* scratch */ - UNW_X86_FSW, /* scratch */ - UNW_X86_FTW, /* scratch */ - UNW_X86_FOP, /* scratch */ - UNW_X86_FCS, /* scratch */ - UNW_X86_FIP, /* scratch */ - UNW_X86_FEA, /* scratch */ - UNW_X86_FDS, /* scratch */ + UNW_X86_FCW, /* scratch */ + UNW_X86_FSW, /* scratch */ + UNW_X86_FTW, /* scratch */ + UNW_X86_FOP, /* scratch */ + UNW_X86_FCS, /* scratch */ + UNW_X86_FIP, /* scratch */ + UNW_X86_FEA, /* scratch */ + UNW_X86_FDS, /* scratch */ /* SSE registers */ - UNW_X86_XMM0_lo, /* scratch */ - UNW_X86_XMM0_hi, /* scratch */ - UNW_X86_XMM1_lo, /* scratch */ - UNW_X86_XMM1_hi, /* scratch */ - UNW_X86_XMM2_lo, /* scratch */ - UNW_X86_XMM2_hi, /* scratch */ - UNW_X86_XMM3_lo, /* scratch */ - UNW_X86_XMM3_hi, /* scratch */ - UNW_X86_XMM4_lo, /* scratch */ - UNW_X86_XMM4_hi, /* scratch */ - UNW_X86_XMM5_lo, /* scratch */ - UNW_X86_XMM5_hi, /* scratch */ - UNW_X86_XMM6_lo, /* scratch */ - UNW_X86_XMM6_hi, /* scratch */ - UNW_X86_XMM7_lo, /* scratch */ - UNW_X86_XMM7_hi, /* scratch */ + UNW_X86_XMM0_lo, /* scratch */ + UNW_X86_XMM0_hi, /* scratch */ + UNW_X86_XMM1_lo, /* scratch */ + UNW_X86_XMM1_hi, /* scratch */ + UNW_X86_XMM2_lo, /* scratch */ + UNW_X86_XMM2_hi, /* scratch */ + UNW_X86_XMM3_lo, /* scratch */ + UNW_X86_XMM3_hi, /* scratch */ + UNW_X86_XMM4_lo, /* scratch */ + UNW_X86_XMM4_hi, /* scratch */ + UNW_X86_XMM5_lo, /* scratch */ + UNW_X86_XMM5_hi, /* scratch */ + UNW_X86_XMM6_lo, /* scratch */ + UNW_X86_XMM6_hi, /* scratch */ + UNW_X86_XMM7_lo, /* scratch */ + UNW_X86_XMM7_hi, /* scratch */ - UNW_X86_MXCSR, /* scratch */ + UNW_X86_MXCSR, /* scratch */ /* segment registers */ - UNW_X86_GS, /* special */ - UNW_X86_FS, /* special */ - UNW_X86_ES, /* special */ - UNW_X86_DS, /* special */ - UNW_X86_SS, /* special */ - UNW_X86_CS, /* special */ - UNW_X86_TSS, /* special */ - UNW_X86_LDT, /* special */ + UNW_X86_GS, /* special */ + UNW_X86_FS, /* special */ + UNW_X86_ES, /* special */ + UNW_X86_DS, /* special */ + UNW_X86_SS, /* special */ + UNW_X86_CS, /* special */ + UNW_X86_TSS, /* special */ + UNW_X86_LDT, /* special */ /* frame info (read-only) */ UNW_X86_CFA, - UNW_X86_XMM0, /* scratch */ - UNW_X86_XMM1, /* scratch */ - UNW_X86_XMM2, /* scratch */ - UNW_X86_XMM3, /* scratch */ - UNW_X86_XMM4, /* scratch */ - UNW_X86_XMM5, /* scratch */ - UNW_X86_XMM6, /* scratch */ - UNW_X86_XMM7, /* scratch */ + UNW_X86_XMM0, /* scratch */ + UNW_X86_XMM1, /* scratch */ + UNW_X86_XMM2, /* scratch */ + UNW_X86_XMM3, /* scratch */ + UNW_X86_XMM4, /* scratch */ + UNW_X86_XMM5, /* scratch */ + UNW_X86_XMM6, /* scratch */ + UNW_X86_XMM7, /* scratch */ UNW_TDEP_LAST_REG = UNW_X86_XMM7, @@ -153,7 +153,7 @@ typedef enum } x86_regnum_t; -#define UNW_TDEP_NUM_EH_REGS 2 /* eax and edx are exception args */ +#define UNW_TDEP_NUM_EH_REGS 2 /* eax and edx are exception args */ typedef struct unw_tdep_save_loc { @@ -174,10 +174,10 @@ unw_tdep_proc_info_t; #include "libunwind-common.h" -#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) +#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) extern int unw_tdep_getcontext (unw_tdep_context_t *); -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) extern int unw_tdep_is_fpreg (int); #if defined(__cplusplus) || defined(c_plusplus) diff --git a/include/libunwind-x86_64.h b/include/libunwind-x86_64.h index 34324f30..78eb541a 100644 --- a/include/libunwind-x86_64.h +++ b/include/libunwind-x86_64.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -36,17 +36,17 @@ extern "C" { #include #include -#define UNW_TARGET x86_64 -#define UNW_TARGET_X86_64 1 +#define UNW_TARGET x86_64 +#define UNW_TARGET_X86_64 1 -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ /* This needs to be big enough to accommodate "struct cursor", while leaving some slack for future expansion. Changing this value will require recompiling all users of this library. Stack allocation is relatively cheap and unwind-state copying is relatively rare, so we want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 127 +#define UNW_TDEP_CURSOR_LEN 127 typedef uint64_t unw_word_t; typedef int64_t unw_sword_t; @@ -106,7 +106,7 @@ typedef enum } x86_64_regnum_t; -#define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */ +#define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */ typedef struct unw_tdep_save_loc { @@ -128,8 +128,8 @@ unw_tdep_proc_info_t; #include "libunwind-dynamic.h" #include "libunwind-common.h" -#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) extern int unw_tdep_getcontext (unw_tdep_context_t *); extern int unw_tdep_is_fpreg (int); diff --git a/include/libunwind_i.h b/include/libunwind_i.h index 8fa94e23..ee2ea2fb 100644 --- a/include/libunwind_i.h +++ b/include/libunwind_i.h @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -46,7 +46,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Platform-independent libunwind-internal declarations. */ -#include /* HP-UX needs this before include of pthread.h */ +#include /* HP-UX needs this before include of pthread.h */ #include #include @@ -70,8 +70,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #elif defined(HAVE_SYS_ENDIAN_H) # include #else -# define __LITTLE_ENDIAN 1234 -# define __BIG_ENDIAN 4321 +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 # if defined(__hpux) # define __BYTE_ORDER __BIG_ENDIAN # elif defined(__QNX__) @@ -94,9 +94,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #endif #ifdef DEBUG -# define UNW_DEBUG 1 +# define UNW_DEBUG 1 #else -# define UNW_DEBUG 0 +# define UNW_DEBUG 0 #endif /* Make it easy to write thread-safe code which may or may not be @@ -108,12 +108,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma weak pthread_mutex_lock #pragma weak pthread_mutex_unlock -#define mutex_init(l) \ - (pthread_mutex_init != NULL ? pthread_mutex_init ((l), NULL) : 0) -#define mutex_lock(l) \ - (pthread_mutex_lock != NULL ? pthread_mutex_lock (l) : 0) -#define mutex_unlock(l) \ - (pthread_mutex_unlock != NULL ? pthread_mutex_unlock (l) : 0) +#define mutex_init(l) \ + (pthread_mutex_init != NULL ? pthread_mutex_init ((l), NULL) : 0) +#define mutex_lock(l) \ + (pthread_mutex_lock != NULL ? pthread_mutex_lock (l) : 0) +#define mutex_unlock(l) \ + (pthread_mutex_unlock != NULL ? pthread_mutex_unlock (l) : 0) #ifdef HAVE_ATOMIC_OPS_H # include @@ -130,8 +130,8 @@ cmpxchg_ptr (void *addr, void *old, void *new) u.vp = addr; return AO_compare_and_swap(u.aop, (AO_t) old, (AO_t) new); } -# define fetch_and_add1(_ptr) AO_fetch_and_add1(_ptr) -# define fetch_and_add(_ptr, value) AO_fetch_and_add(_ptr, value) +# define fetch_and_add1(_ptr) AO_fetch_and_add1(_ptr) +# define fetch_and_add(_ptr, value) AO_fetch_and_add(_ptr, value) /* GCC 3.2.0 on HP-UX crashes on cmpxchg_ptr() */ # if !(defined(__hpux) && __GNUC__ == 3 && __GNUC_MINOR__ == 2) # define HAVE_CMPXCHG @@ -154,14 +154,14 @@ cmpxchg_ptr (void *addr, void *old, void *new) u.vp = addr; return __sync_bool_compare_and_swap(u.vlp, (long) old, (long) new); } -# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1) -# define fetch_and_add(_ptr, value) __sync_fetch_and_add(_ptr, value) +# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1) +# define fetch_and_add(_ptr, value) __sync_fetch_and_add(_ptr, value) # define HAVE_CMPXCHG # define HAVE_FETCH_AND_ADD #endif -#define atomic_read(ptr) (*(ptr)) +#define atomic_read(ptr) (*(ptr)) -#define UNWI_OBJ(fn) UNW_PASTE(UNW_PREFIX,UNW_PASTE(I,fn)) +#define UNWI_OBJ(fn) UNW_PASTE(UNW_PREFIX,UNW_PASTE(I,fn)) #define UNWI_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_UI,UNW_TARGET),_), fn) #define unwi_full_mask UNWI_ARCH_OBJ(full_mask) @@ -195,85 +195,85 @@ static inline void mark_as_used(void *v UNUSED) { #define define_lock(name) \ pthread_mutex_t name = UNW_PTHREAD_MUTEX_INITIALIZER -#define lock_init(l) mutex_init (l) -#define lock_acquire(l,m) \ -do { \ - SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &(m)); \ - mutex_lock (l); \ +#define lock_init(l) mutex_init (l) +#define lock_acquire(l,m) \ +do { \ + SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &(m)); \ + mutex_lock (l); \ } while (0) -#define lock_release(l,m) \ -do { \ - mutex_unlock (l); \ - SIGPROCMASK (SIG_SETMASK, &(m), NULL); \ +#define lock_release(l,m) \ +do { \ + mutex_unlock (l); \ + SIGPROCMASK (SIG_SETMASK, &(m), NULL); \ } while (0) -#define SOS_MEMORY_SIZE 16384 /* see src/mi/mempool.c */ +#define SOS_MEMORY_SIZE 16384 /* see src/mi/mempool.c */ #ifndef MAP_ANONYMOUS # define MAP_ANONYMOUS MAP_ANON #endif -#define GET_MEMORY(mem, size) \ -do { \ +#define GET_MEMORY(mem, size) \ +do { \ /* Hopefully, mmap() goes straight through to a system call stub... */ \ - mem = mmap (NULL, size, PROT_READ | PROT_WRITE, \ - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \ - if (mem == MAP_FAILED) \ - mem = NULL; \ + mem = mmap (NULL, size, PROT_READ | PROT_WRITE, \ + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); \ + if (mem == MAP_FAILED) \ + mem = NULL; \ } while (0) -#define unwi_find_dynamic_proc_info UNWI_OBJ(find_dynamic_proc_info) -#define unwi_extract_dynamic_proc_info UNWI_OBJ(extract_dynamic_proc_info) -#define unwi_put_dynamic_unwind_info UNWI_OBJ(put_dynamic_unwind_info) -#define unwi_dyn_remote_find_proc_info UNWI_OBJ(dyn_remote_find_proc_info) -#define unwi_dyn_remote_put_unwind_info UNWI_OBJ(dyn_remote_put_unwind_info) -#define unwi_dyn_validate_cache UNWI_OBJ(dyn_validate_cache) +#define unwi_find_dynamic_proc_info UNWI_OBJ(find_dynamic_proc_info) +#define unwi_extract_dynamic_proc_info UNWI_OBJ(extract_dynamic_proc_info) +#define unwi_put_dynamic_unwind_info UNWI_OBJ(put_dynamic_unwind_info) +#define unwi_dyn_remote_find_proc_info UNWI_OBJ(dyn_remote_find_proc_info) +#define unwi_dyn_remote_put_unwind_info UNWI_OBJ(dyn_remote_put_unwind_info) +#define unwi_dyn_validate_cache UNWI_OBJ(dyn_validate_cache) extern int unwi_find_dynamic_proc_info (unw_addr_space_t as, - unw_word_t ip, - unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_word_t ip, + unw_proc_info_t *pi, + int need_unwind_info, void *arg); extern int unwi_extract_dynamic_proc_info (unw_addr_space_t as, - unw_word_t ip, - unw_proc_info_t *pi, - unw_dyn_info_t *di, - int need_unwind_info, - void *arg); + unw_word_t ip, + unw_proc_info_t *pi, + unw_dyn_info_t *di, + int need_unwind_info, + void *arg); extern void unwi_put_dynamic_unwind_info (unw_addr_space_t as, - unw_proc_info_t *pi, void *arg); + unw_proc_info_t *pi, void *arg); /* These handle the remote (cross-address-space) case of accessing dynamic unwind info. */ extern int unwi_dyn_remote_find_proc_info (unw_addr_space_t as, - unw_word_t ip, - unw_proc_info_t *pi, - int need_unwind_info, - void *arg); + unw_word_t ip, + unw_proc_info_t *pi, + int need_unwind_info, + void *arg); extern void unwi_dyn_remote_put_unwind_info (unw_addr_space_t as, - unw_proc_info_t *pi, - void *arg); + unw_proc_info_t *pi, + void *arg); extern int unwi_dyn_validate_cache (unw_addr_space_t as, void *arg); extern unw_dyn_info_list_t _U_dyn_info_list; extern pthread_mutex_t _U_dyn_info_list_lock; #if UNW_DEBUG -#define unwi_debug_level UNWI_ARCH_OBJ(debug_level) +#define unwi_debug_level UNWI_ARCH_OBJ(debug_level) extern long unwi_debug_level; # include -# define Debug(level,format...) \ -do { \ - if (unwi_debug_level >= level) \ - { \ - int _n = level; \ - if (_n > 16) \ - _n = 16; \ - fprintf (stderr, "%*c>%s: ", _n, ' ', __FUNCTION__); \ - fprintf (stderr, format); \ - } \ +# define Debug(level,format...) \ +do { \ + if (unwi_debug_level >= level) \ + { \ + int _n = level; \ + if (_n > 16) \ + _n = 16; \ + fprintf (stderr, "%*c>%s: ", _n, ' ', __FUNCTION__); \ + fprintf (stderr, format); \ + } \ } while (0) -# define Dprintf(format...) fprintf (stderr, format) +# define Dprintf(format...) fprintf (stderr, format) #else # define Debug(level,format...) # define Dprintf(format...) @@ -285,17 +285,17 @@ print_error (const char *string) return write (2, string, strlen (string)); } -#define mi_init UNWI_ARCH_OBJ(mi_init) +#define mi_init UNWI_ARCH_OBJ(mi_init) -extern void mi_init (void); /* machine-independent initializations */ +extern void mi_init (void); /* machine-independent initializations */ extern unw_word_t _U_dyn_info_list_addr (void); /* This is needed/used by ELF targets only. */ struct elf_image { - void *image; /* pointer to mmap'd image */ - size_t size; /* (file-) size of the image */ + void *image; /* pointer to mmap'd image */ + size_t size; /* (file-) size of the image */ }; struct elf_dyn_info @@ -335,21 +335,21 @@ static inline void invalidate_edi (struct elf_dyn_info *edi) /* Define GNU and processor specific values for the Phdr p_type field in case they aren't defined by . */ #ifndef PT_GNU_EH_FRAME -# define PT_GNU_EH_FRAME 0x6474e550 +# define PT_GNU_EH_FRAME 0x6474e550 #endif /* !PT_GNU_EH_FRAME */ #ifndef PT_ARM_EXIDX -# define PT_ARM_EXIDX 0x70000001 /* ARM unwind segment */ +# define PT_ARM_EXIDX 0x70000001 /* ARM unwind segment */ #endif /* !PT_ARM_EXIDX */ #include "tdep/libunwind_i.h" #ifndef tdep_get_func_addr -# define tdep_get_func_addr(as,addr,v) (*(v) = addr, 0) +# define tdep_get_func_addr(as,addr,v) (*(v) = addr, 0) #endif #ifndef DWARF_VAL_LOC -# define DWARF_IS_VAL_LOC(l) 0 -# define DWARF_VAL_LOC(c,v) DWARF_NULL_LOC +# define DWARF_IS_VAL_LOC(l) 0 +# define DWARF_VAL_LOC(c,v) DWARF_NULL_LOC #endif #define UNW_ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL)) diff --git a/include/mempool.h b/include/mempool.h index 4b55974f..1f1c7700 100644 --- a/include/mempool.h +++ b/include/mempool.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -51,23 +51,23 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" -#define sos_alloc(s) UNWI_ARCH_OBJ(_sos_alloc)(s) -#define mempool_init(p,s,r) UNWI_ARCH_OBJ(_mempool_init)(p,s,r) -#define mempool_alloc(p) UNWI_ARCH_OBJ(_mempool_alloc)(p) -#define mempool_free(p,o) UNWI_ARCH_OBJ(_mempool_free)(p,o) +#define sos_alloc(s) UNWI_ARCH_OBJ(_sos_alloc)(s) +#define mempool_init(p,s,r) UNWI_ARCH_OBJ(_mempool_init)(p,s,r) +#define mempool_alloc(p) UNWI_ARCH_OBJ(_mempool_alloc)(p) +#define mempool_free(p,o) UNWI_ARCH_OBJ(_mempool_free)(p,o) /* The mempool structure should be treated as an opaque object. It's declared here only to enable static allocation of mempools. */ struct mempool { pthread_mutex_t lock; - size_t obj_size; /* object size (rounded up for alignment) */ - size_t chunk_size; /* allocation granularity */ - unsigned int reserve; /* minimum (desired) size of the free-list */ - unsigned int num_free; /* number of objects on the free-list */ + size_t obj_size; /* object size (rounded up for alignment) */ + size_t chunk_size; /* allocation granularity */ + unsigned int reserve; /* minimum (desired) size of the free-list */ + unsigned int num_free; /* number of objects on the free-list */ struct object { - struct object *next; + struct object *next; } *free_list; }; @@ -82,7 +82,7 @@ extern void *sos_alloc (size_t size); tight memory situations. If it is zero, mempool attempts to pick a reasonable default value. */ extern void mempool_init (struct mempool *pool, - size_t obj_size, size_t reserve); + size_t obj_size, size_t reserve); extern void *mempool_alloc (struct mempool *pool); extern void mempool_free (struct mempool *pool, void *object); diff --git a/include/remote.h b/include/remote.h index 9fb90c3d..6fdf64c1 100644 --- a/include/remote.h +++ b/include/remote.h @@ -9,7 +9,7 @@ static inline int fetch8 (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, int8_t *valp, void *arg) + unw_word_t *addr, int8_t *valp, void *arg) { *valp = *(int8_t *) (uintptr_t) *addr; *addr += 1; @@ -18,7 +18,7 @@ fetch8 (unw_addr_space_t as, unw_accessors_t *a, static inline int fetch16 (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, int16_t *valp, void *arg) + unw_word_t *addr, int16_t *valp, void *arg) { *valp = *(int16_t *) (uintptr_t) *addr; *addr += 2; @@ -27,7 +27,7 @@ fetch16 (unw_addr_space_t as, unw_accessors_t *a, static inline int fetch32 (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, int32_t *valp, void *arg) + unw_word_t *addr, int32_t *valp, void *arg) { *valp = *(int32_t *) (uintptr_t) *addr; *addr += 4; @@ -36,7 +36,7 @@ fetch32 (unw_addr_space_t as, unw_accessors_t *a, static inline int fetchw (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, unw_word_t *valp, void *arg) + unw_word_t *addr, unw_word_t *valp, void *arg) { *valp = *(unw_word_t *) (uintptr_t) *addr; *addr += sizeof (unw_word_t); @@ -45,11 +45,11 @@ fetchw (unw_addr_space_t as, unw_accessors_t *a, #else /* !UNW_LOCAL_ONLY */ -#define WSIZE (sizeof (unw_word_t)) +#define WSIZE (sizeof (unw_word_t)) static inline int fetch8 (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, int8_t *valp, void *arg) + unw_word_t *addr, int8_t *valp, void *arg) { unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr; int ret; @@ -69,7 +69,7 @@ fetch8 (unw_addr_space_t as, unw_accessors_t *a, static inline int fetch16 (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, int16_t *valp, void *arg) + unw_word_t *addr, int16_t *valp, void *arg) { unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr; int ret; @@ -91,7 +91,7 @@ fetch16 (unw_addr_space_t as, unw_accessors_t *a, static inline int fetch32 (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, int32_t *valp, void *arg) + unw_word_t *addr, int32_t *valp, void *arg) { unw_word_t val, aligned_addr = *addr & -WSIZE, off = *addr - aligned_addr; int ret; @@ -113,7 +113,7 @@ fetch32 (unw_addr_space_t as, unw_accessors_t *a, static inline int fetchw (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, unw_word_t *valp, void *arg) + unw_word_t *addr, unw_word_t *valp, void *arg) { int ret; diff --git a/include/tdep-aarch64/dwarf-config.h b/include/tdep-aarch64/dwarf-config.h index 1876c483..f65db17e 100644 --- a/include/tdep-aarch64/dwarf-config.h +++ b/include/tdep-aarch64/dwarf-config.h @@ -29,22 +29,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* This matches the value udes by GCC (see gcc/config/aarch64/aarch64.h:DWARF_FRAME_REGISTERS. */ -#define DWARF_NUM_PRESERVED_REGS 97 +#define DWARF_NUM_PRESERVED_REGS 97 /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) 0 +#define dwarf_is_big_endian(addr_space) 0 #define dwarf_to_unw_regnum(reg) (((reg) <= UNW_AARCH64_V31) ? (reg) : 0) /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) typedef struct dwarf_loc { unw_word_t val; #ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ + unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ #endif } dwarf_loc_t; diff --git a/include/tdep-aarch64/jmpbuf.h b/include/tdep-aarch64/jmpbuf.h index 2eb53a79..3f01a442 100644 --- a/include/tdep-aarch64/jmpbuf.h +++ b/include/tdep-aarch64/jmpbuf.h @@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* FIXME for AArch64 */ -#define JB_SP 13 -#define JB_RP 14 -#define JB_MASK_SAVED 15 -#define JB_MASK 16 +#define JB_SP 13 +#define JB_RP 14 +#define JB_MASK_SAVED 15 +#define JB_MASK 16 diff --git a/include/tdep-aarch64/libunwind_i.h b/include/tdep-aarch64/libunwind_i.h index 9f0c0cc3..ca281550 100644 --- a/include/tdep-aarch64/libunwind_i.h +++ b/include/tdep-aarch64/libunwind_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Copyright (C) 2013 Linaro Limited This file is part of libunwind. @@ -84,7 +84,7 @@ struct unw_addr_space uint32_t cache_generation; #endif unw_word_t dyn_generation; /* see dyn-common.h */ - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ struct dwarf_rs_cache global_cache; struct unw_debug_frame_list *debug_frames; }; @@ -93,7 +93,7 @@ struct cursor { struct dwarf_cursor dwarf; /* must be first */ - unw_tdep_frame_t frame_info; /* quick tracing assist info */ + unw_tdep_frame_t frame_info; /* quick tracing assist info */ enum { @@ -261,21 +261,21 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) #define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace) -#define tdep_init_done UNW_OBJ(init_done) -#define tdep_init UNW_OBJ(init) +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table dwarf_search_unwind_table -#define tdep_find_unwind_table dwarf_find_unwind_table -#define tdep_uc_addr UNW_OBJ(uc_addr) -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) -#define tdep_fetch_frame(c,ip,n) do {} while(0) -#define tdep_cache_frame(c,rs) do {} while(0) -#define tdep_reuse_frame(c,rs) do {} while(0) -#define tdep_stash_frame UNW_OBJ(tdep_stash_frame) -#define tdep_trace UNW_OBJ(tdep_trace) +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame UNW_OBJ(tdep_stash_frame) +#define tdep_trace UNW_OBJ(tdep_trace) #ifdef UNW_LOCAL_ONLY # define tdep_find_proc_info(c,ip,n) \ @@ -300,19 +300,19 @@ extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t *valp, int write); + unw_word_t *valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t *valp, int write); + unw_fpreg_t *valp, int write); extern int tdep_trace (unw_cursor_t *cursor, void **addresses, int *n); extern void tdep_stash_frame (struct dwarf_cursor *c, - struct dwarf_reg_state *rs); + struct dwarf_reg_state *rs); extern int tdep_getcontext_trace (unw_tdep_context_t *); #endif /* AARCH64_LIBUNWIND_I_H */ diff --git a/include/tdep-arm/dwarf-config.h b/include/tdep-arm/dwarf-config.h index c997f3a7..f5022897 100644 --- a/include/tdep-arm/dwarf-config.h +++ b/include/tdep-arm/dwarf-config.h @@ -28,22 +28,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* This is FIRST_PSEUDO_REGISTER in GCC, since DWARF_FRAME_REGISTERS is not explicitly defined. */ -#define DWARF_NUM_PRESERVED_REGS 128 +#define DWARF_NUM_PRESERVED_REGS 128 #define dwarf_to_unw_regnum(reg) (((reg) < 16) ? (reg) : 0) /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) 0 +#define dwarf_is_big_endian(addr_space) 0 /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) typedef struct dwarf_loc { unw_word_t val; #ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ + unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ #endif } dwarf_loc_t; diff --git a/include/tdep-arm/ex_tables.h b/include/tdep-arm/ex_tables.h index 8906f13a..9df5e0a9 100644 --- a/include/tdep-arm/ex_tables.h +++ b/include/tdep-arm/ex_tables.h @@ -44,9 +44,9 @@ struct arm_exbuf_data uint32_t data; }; -#define arm_exidx_extract UNW_OBJ(arm_exidx_extract) -#define arm_exidx_decode UNW_OBJ(arm_exidx_decode) -#define arm_exidx_apply_cmd UNW_OBJ(arm_exidx_apply_cmd) +#define arm_exidx_extract UNW_OBJ(arm_exidx_extract) +#define arm_exidx_decode UNW_OBJ(arm_exidx_decode) +#define arm_exidx_apply_cmd UNW_OBJ(arm_exidx_apply_cmd) int arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf); int arm_exidx_decode (const uint8_t *buf, uint8_t len, struct dwarf_cursor *c); diff --git a/include/tdep-arm/jmpbuf.h b/include/tdep-arm/jmpbuf.h index 499e7deb..008e77f7 100644 --- a/include/tdep-arm/jmpbuf.h +++ b/include/tdep-arm/jmpbuf.h @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* FIXME for ARM! */ -#define JB_SP 4 -#define JB_RP 5 -#define JB_MASK_SAVED 6 -#define JB_MASK 7 +#define JB_SP 4 +#define JB_RP 5 +#define JB_MASK_SAVED 6 +#define JB_MASK 7 diff --git a/include/tdep-arm/libunwind_i.h b/include/tdep-arm/libunwind_i.h index e5ec9553..d3a279c9 100644 --- a/include/tdep-arm/libunwind_i.h +++ b/include/tdep-arm/libunwind_i.h @@ -68,17 +68,17 @@ struct unw_addr_space #else uint32_t cache_generation; #endif - unw_word_t dyn_generation; /* see dyn-common.h */ - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ struct dwarf_rs_cache global_cache; struct unw_debug_frame_list *debug_frames; }; struct cursor { - struct dwarf_cursor dwarf; /* must be first */ + struct dwarf_cursor dwarf; /* must be first */ - unw_tdep_frame_t frame_info; /* quick tracing assist info */ + unw_tdep_frame_t frame_info; /* quick tracing assist info */ enum { @@ -95,18 +95,18 @@ struct cursor int validate; }; -#define DWARF_GET_LOC(l) ((l).val) +#define DWARF_GET_LOC(l) ((l).val) #ifdef UNW_LOCAL_ONLY -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) -# define DWARF_IS_REG_LOC(l) 0 -# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) static inline int dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) @@ -145,18 +145,18 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) } #else /* !UNW_LOCAL_ONLY */ -# define DWARF_LOC_TYPE_FP (1 << 0) -# define DWARF_LOC_TYPE_REG (1 << 1) -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) \ - ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) -# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) -# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) -# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_FP)) +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) static inline int dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) @@ -170,15 +170,15 @@ dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 0, c->as_arg)) < 0) + 0, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, - c->as_arg); + c->as_arg); } static inline int @@ -193,15 +193,15 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - &val, 1, c->as_arg); + &val, 1, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 1, c->as_arg)) < 0) + 1, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, - 1, c->as_arg); + 1, c->as_arg); } static inline int @@ -218,10 +218,10 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); } static inline int @@ -238,74 +238,74 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); } #endif /* !UNW_LOCAL_ONLY */ #define tdep_getcontext_trace unw_getcontext -#define tdep_init_done UNW_OBJ(init_done) -#define tdep_init UNW_OBJ(init) -#define arm_find_proc_info UNW_OBJ(find_proc_info) -#define arm_put_unwind_info UNW_OBJ(put_unwind_info) +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) +#define arm_find_proc_info UNW_OBJ(find_proc_info) +#define arm_put_unwind_info UNW_OBJ(put_unwind_info) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table UNW_OBJ(search_unwind_table) -#define tdep_find_unwind_table dwarf_find_unwind_table -#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) -#define tdep_fetch_frame(c,ip,n) do {} while(0) -#define tdep_cache_frame(c,rs) do {} while(0) -#define tdep_reuse_frame(c,rs) do {} while(0) -#define tdep_stash_frame UNW_OBJ(tdep_stash_frame) -#define tdep_trace UNW_OBJ(tdep_trace) +#define tdep_search_unwind_table UNW_OBJ(search_unwind_table) +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame UNW_OBJ(tdep_stash_frame) +#define tdep_trace UNW_OBJ(tdep_trace) #ifdef UNW_LOCAL_ONLY -# define tdep_find_proc_info(c,ip,n) \ - arm_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - arm_put_unwind_info((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + arm_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + arm_put_unwind_info((as), (pi), (arg)) #else -# define tdep_find_proc_info(c,ip,n) \ - (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) #endif -#define tdep_get_as(c) ((c)->dwarf.as) -#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) -#define tdep_get_ip(c) ((c)->dwarf.ip) -#define tdep_big_endian(as) ((as)->big_endian) +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) ((as)->big_endian) extern int tdep_init_done; extern void tdep_init (void); extern int arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, int need_unwind_info, - void *arg); + unw_proc_info_t *pi, int need_unwind_info, + void *arg); extern void arm_put_unwind_info (unw_addr_space_t as, - unw_proc_info_t *pi, void *arg); + unw_proc_info_t *pi, void *arg); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t *valp, int write); + unw_word_t *valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t *valp, int write); + unw_fpreg_t *valp, int write); extern int tdep_trace (unw_cursor_t *cursor, void **addresses, int *n); extern void tdep_stash_frame (struct dwarf_cursor *c, - struct dwarf_reg_state *rs); + struct dwarf_reg_state *rs); /* unwinding method selection support */ #define UNW_ARM_METHOD_ALL 0xFF diff --git a/include/tdep-hppa/dwarf-config.h b/include/tdep-hppa/dwarf-config.h index 29f9eee4..fb963c7d 100644 --- a/include/tdep-hppa/dwarf-config.h +++ b/include/tdep-hppa/dwarf-config.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,26 +27,26 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define dwarf_config_h /* See DWARF_FRAME_REGNUM() macro in gcc/config/pa/pa32-regs.h: */ -#define dwarf_to_unw_regnum(reg) \ +#define dwarf_to_unw_regnum(reg) \ (((reg) < DWARF_NUM_PRESERVED_REGS) ? (reg) : 0) /* This matches the value used by GCC (see gcc/config/pa/pa32-regs.h:FIRST_PSEUDO_REGISTER), which leaves plenty of room for expansion. */ -#define DWARF_NUM_PRESERVED_REGS 89 +#define DWARF_NUM_PRESERVED_REGS 89 /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) 1 +#define dwarf_is_big_endian(addr_space) 1 /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) typedef struct dwarf_loc { unw_word_t val; #ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see X86_LOC_TYPE_* macros. */ + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ #endif } dwarf_loc_t; diff --git a/include/tdep-hppa/jmpbuf.h b/include/tdep-hppa/jmpbuf.h index 6735b21a..91f062ff 100644 --- a/include/tdep-hppa/jmpbuf.h +++ b/include/tdep-hppa/jmpbuf.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -26,8 +26,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Use glibc's jump-buffer indices; NPTL peeks at SP: */ #ifndef JB_SP -# define JB_SP 19 +# define JB_SP 19 #endif -#define JB_RP 20 -#define JB_MASK_SAVED 21 -#define JB_MASK 22 +#define JB_RP 20 +#define JB_MASK_SAVED 21 +#define JB_MASK 22 diff --git a/include/tdep-hppa/libunwind_i.h b/include/tdep-hppa/libunwind_i.h index b5bbcecc..d5cc1b92 100644 --- a/include/tdep-hppa/libunwind_i.h +++ b/include/tdep-hppa/libunwind_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -51,39 +51,39 @@ struct unw_addr_space #else uint32_t cache_generation; #endif - unw_word_t dyn_generation; /* see dyn-common.h */ - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ struct dwarf_rs_cache global_cache; struct unw_debug_frame_list *debug_frames; }; struct cursor { - struct dwarf_cursor dwarf; /* must be first */ + struct dwarf_cursor dwarf; /* must be first */ /* Format of sigcontext structure and address at which it is stored: */ enum { - HPPA_SCF_NONE, /* no signal frame encountered */ - HPPA_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ + HPPA_SCF_NONE, /* no signal frame encountered */ + HPPA_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ } sigcontext_format; unw_word_t sigcontext_addr; }; -#define DWARF_GET_LOC(l) ((l).val) +#define DWARF_GET_LOC(l) ((l).val) #ifdef UNW_LOCAL_ONLY -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) -# define DWARF_IS_REG_LOC(l) 0 -# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) static inline int dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) @@ -122,18 +122,18 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) } #else /* !UNW_LOCAL_ONLY */ -# define DWARF_LOC_TYPE_FP (1 << 0) -# define DWARF_LOC_TYPE_REG (1 << 1) -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) \ - ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) -# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) -# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) -# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_FP)) +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) static inline int dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) @@ -147,15 +147,15 @@ dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 0, c->as_arg)) < 0) + 0, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, - c->as_arg); + c->as_arg); } static inline int @@ -170,15 +170,15 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - &val, 1, c->as_arg); + &val, 1, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 1, c->as_arg)) < 0) + 1, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, - 1, c->as_arg); + 1, c->as_arg); } static inline int @@ -195,10 +195,10 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); } static inline int @@ -215,63 +215,63 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); } #endif /* !UNW_LOCAL_ONLY */ #define tdep_getcontext_trace unw_getcontext -#define tdep_init_done UNW_OBJ(init_done) -#define tdep_init UNW_OBJ(init) +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table dwarf_search_unwind_table -#define tdep_find_unwind_table dwarf_find_unwind_table -#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) -#define tdep_fetch_frame(c,ip,n) do {} while(0) -#define tdep_cache_frame(c,rs) do {} while(0) -#define tdep_reuse_frame(c,rs) do {} while(0) -#define tdep_stash_frame(c,rs) do {} while(0) -#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) #ifdef UNW_LOCAL_ONLY -# define tdep_find_proc_info(c,ip,n) \ - dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - dwarf_put_unwind_info((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) #else -# define tdep_find_proc_info(c,ip,n) \ - (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) #endif -#define tdep_get_as(c) ((c)->dwarf.as) -#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) -#define tdep_get_ip(c) ((c)->dwarf.ip) -#define tdep_big_endian(as) 1 +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) 1 extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, int reg); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t *valp, int write); + unw_word_t *valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t *valp, int write); + unw_fpreg_t *valp, int write); #endif /* HPPA_LIBUNWIND_I_H */ diff --git a/include/tdep-ia64/jmpbuf.h b/include/tdep-ia64/jmpbuf.h index faa1f344..d642af20 100644 --- a/include/tdep-ia64/jmpbuf.h +++ b/include/tdep-ia64/jmpbuf.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -25,8 +25,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Use glibc's jump-buffer indices; NPTL peeks at SP and BSP: */ -#define JB_SP 0 -#define JB_RP 8 -#define JB_BSP 17 -#define JB_MASK_SAVED 70 -#define JB_MASK 71 +#define JB_SP 0 +#define JB_RP 8 +#define JB_BSP 17 +#define JB_MASK_SAVED 70 +#define JB_MASK 71 diff --git a/include/tdep-ia64/libunwind_i.h b/include/tdep-ia64/libunwind_i.h index 2bea8301..7e57c7b6 100644 --- a/include/tdep-ia64/libunwind_i.h +++ b/include/tdep-ia64/libunwind_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -45,11 +45,11 @@ enum ia64_pregnum IA64_REG_PRI_UNAT_MEM, /* memory stack (order matters: see build_script() */ - IA64_REG_PSP, /* previous memory stack pointer */ + IA64_REG_PSP, /* previous memory stack pointer */ /* register stack */ - IA64_REG_BSP, /* register stack pointer */ + IA64_REG_BSP, /* register stack pointer */ IA64_REG_BSPSTORE, - IA64_REG_PFS, /* previous function state */ + IA64_REG_PFS, /* previous function state */ IA64_REG_RNAT, /* instruction pointer: */ IA64_REG_IP, @@ -83,19 +83,19 @@ ia64_loc_t; #include "script.h" -#define ABI_UNKNOWN 0 -#define ABI_LINUX 1 -#define ABI_HPUX 2 -#define ABI_FREEBSD 3 -#define ABI_OPENVMS 4 -#define ABI_NSK 5 /* Tandem/HP Non-Stop Kernel */ -#define ABI_WINDOWS 6 +#define ABI_UNKNOWN 0 +#define ABI_LINUX 1 +#define ABI_HPUX 2 +#define ABI_FREEBSD 3 +#define ABI_OPENVMS 4 +#define ABI_NSK 5 /* Tandem/HP Non-Stop Kernel */ +#define ABI_WINDOWS 6 struct unw_addr_space { struct unw_accessors acc; int big_endian; - int abi; /* abi < 0 => unknown, 0 => SysV, 1 => HP-UX, 2 => Windows */ + int abi; /* abi < 0 => unknown, 0 => SysV, 1 => HP-UX, 2 => Windows */ unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; @@ -103,7 +103,7 @@ struct unw_addr_space uint32_t cache_generation; #endif unw_word_t dyn_generation; - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ #ifndef UNW_REMOTE_ONLY unsigned long long shared_object_removals; #endif @@ -113,47 +113,47 @@ struct unw_addr_space /* Note: The ABI numbers in the ABI-markers (.unwabi directive) are not the same as the above ABI numbers. */ -#define ABI_MARKER_OLD_LINUX_SIGTRAMP ((0 << 8) | 's') -#define ABI_MARKER_OLD_LINUX_INTERRUPT ((0 << 8) | 'i') -#define ABI_MARKER_HP_UX_SIGTRAMP ((1 << 8) | 1) -#define ABI_MARKER_LINUX_SIGTRAMP ((3 << 8) | 's') -#define ABI_MARKER_LINUX_INTERRUPT ((3 << 8) | 'i') +#define ABI_MARKER_OLD_LINUX_SIGTRAMP ((0 << 8) | 's') +#define ABI_MARKER_OLD_LINUX_INTERRUPT ((0 << 8) | 'i') +#define ABI_MARKER_HP_UX_SIGTRAMP ((1 << 8) | 1) +#define ABI_MARKER_LINUX_SIGTRAMP ((3 << 8) | 's') +#define ABI_MARKER_LINUX_INTERRUPT ((3 << 8) | 'i') struct cursor { - void *as_arg; /* argument to address-space callbacks */ - unw_addr_space_t as; /* reference to per-address-space info */ + void *as_arg; /* argument to address-space callbacks */ + unw_addr_space_t as; /* reference to per-address-space info */ /* IP, CFM, and predicate cache (these are always equal to the values stored in ip_loc, cfm_loc, and pr_loc, respectively). */ - unw_word_t ip; /* instruction pointer value */ - unw_word_t cfm; /* current frame mask */ - unw_word_t pr; /* current predicate values */ + unw_word_t ip; /* instruction pointer value */ + unw_word_t cfm; /* current frame mask */ + unw_word_t pr; /* current predicate values */ /* current frame info: */ - unw_word_t bsp; /* backing store pointer value */ - unw_word_t sp; /* stack pointer value */ - unw_word_t psp; /* previous sp value */ - ia64_loc_t cfm_loc; /* cfm save location (or NULL) */ - ia64_loc_t ec_loc; /* ar.ec save location (usually cfm_loc) */ + unw_word_t bsp; /* backing store pointer value */ + unw_word_t sp; /* stack pointer value */ + unw_word_t psp; /* previous sp value */ + ia64_loc_t cfm_loc; /* cfm save location (or NULL) */ + ia64_loc_t ec_loc; /* ar.ec save location (usually cfm_loc) */ ia64_loc_t loc[IA64_NUM_PREGS]; - unw_word_t eh_args[4]; /* exception handler arguments */ - unw_word_t sigcontext_addr; /* address of sigcontext or 0 */ - unw_word_t sigcontext_off; /* sigcontext-offset relative to signal sp */ + unw_word_t eh_args[4]; /* exception handler arguments */ + unw_word_t sigcontext_addr; /* address of sigcontext or 0 */ + unw_word_t sigcontext_off; /* sigcontext-offset relative to signal sp */ short hint; short prev_script; - uint8_t nat_bitnr[4]; /* NaT bit numbers for r4-r7 */ - uint16_t abi_marker; /* abi_marker for current frame (if any) */ - uint16_t last_abi_marker; /* last abi_marker encountered so far */ + uint8_t nat_bitnr[4]; /* NaT bit numbers for r4-r7 */ + uint16_t abi_marker; /* abi_marker for current frame (if any) */ + uint16_t last_abi_marker; /* last abi_marker encountered so far */ uint8_t eh_valid_mask; - unsigned int pi_valid :1; /* is proc_info valid? */ + unsigned int pi_valid :1; /* is proc_info valid? */ unsigned int pi_is_dynamic :1; /* proc_info found via dynamic proc info? */ - unw_proc_info_t pi; /* info about current procedure */ + unw_proc_info_t pi; /* info about current procedure */ /* In case of stack-discontiguities, such as those introduced by signal-delivery on an alternate signal-stack (see @@ -171,20 +171,20 @@ struct cursor register may not have gotten spilled until much later, when a possibly different rbs-area might have been in effect already. */ - uint8_t rbs_curr; /* index of curr. rbs-area (contains c->bsp) */ - uint8_t rbs_left_edge; /* index of inner-most valid rbs-area */ + uint8_t rbs_curr; /* index of curr. rbs-area (contains c->bsp) */ + uint8_t rbs_left_edge; /* index of inner-most valid rbs-area */ struct rbs_area { - unw_word_t end; - unw_word_t size; - ia64_loc_t rnat_loc; + unw_word_t end; + unw_word_t size; + ia64_loc_t rnat_loc; } - rbs_area[96 + 2]; /* 96 stacked regs + 1 extra stack on each side... */ + rbs_area[96 + 2]; /* 96 stacked regs + 1 extra stack on each side... */ }; struct ia64_global_unwind_state { - pthread_mutex_t lock; /* global data lock */ + pthread_mutex_t lock; /* global data lock */ volatile char init_done; @@ -200,9 +200,9 @@ struct ia64_global_unwind_state */ struct { - unw_word_t r0; /* r0 is byte-order neutral */ - unw_fpreg_t f0; /* f0 is byte-order neutral */ - unw_fpreg_t f1_le, f1_be; /* f1 is byte-order dependent */ + unw_word_t r0; /* r0 is byte-order neutral */ + unw_fpreg_t f0; /* f0 is byte-order neutral */ + unw_fpreg_t f1_le, f1_be; /* f1 is byte-order dependent */ } read_only; unw_fpreg_t nat_val_le, nat_val_be; @@ -217,63 +217,63 @@ struct ia64_global_unwind_state }; #define tdep_getcontext_trace unw_getcontext -#define tdep_init_done unw.init_done -#define tdep_init UNW_OBJ(init) +#define tdep_init_done unw.init_done +#define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table unw_search_ia64_unwind_table -#define tdep_find_unwind_table ia64_find_unwind_table -#define tdep_find_proc_info UNW_OBJ(find_proc_info) -#define tdep_uc_addr UNW_OBJ(uc_addr) -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) -#define tdep_fetch_frame(c,ip,n) do {} while(0) -#define tdep_cache_frame(c,rs) do {} while(0) -#define tdep_reuse_frame(c,rs) do {} while(0) -#define tdep_stash_frame(c,rs) do {} while(0) -#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) -#define tdep_get_as(c) ((c)->as) -#define tdep_get_as_arg(c) ((c)->as_arg) -#define tdep_get_ip(c) ((c)->ip) -#define tdep_big_endian(as) ((c)->as->big_endian != 0) +#define tdep_search_unwind_table unw_search_ia64_unwind_table +#define tdep_find_unwind_table ia64_find_unwind_table +#define tdep_find_proc_info UNW_OBJ(find_proc_info) +#define tdep_uc_addr UNW_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_get_as(c) ((c)->as) +#define tdep_get_as_arg(c) ((c)->as_arg) +#define tdep_get_ip(c) ((c)->ip) +#define tdep_big_endian(as) ((c)->as->big_endian != 0) #ifndef UNW_LOCAL_ONLY -# define tdep_put_unwind_info UNW_OBJ(put_unwind_info) +# define tdep_put_unwind_info UNW_OBJ(put_unwind_info) #endif /* This can't be an UNW_ARCH_OBJ() because we need separate unw.initialized flags for the local-only and generic versions of the library. Also, if we wanted to have a single, shared global data structure, we couldn't declare "unw" as HIDDEN/PROTECTED. */ -#define unw UNW_OBJ(data) +#define unw UNW_OBJ(data) extern void tdep_init (void); extern int tdep_find_unwind_table (struct elf_dyn_info *edi, - unw_addr_space_t as, char *path, - unw_word_t segbase, unw_word_t mapoff, - unw_word_t ip); + unw_addr_space_t as, char *path, + unw_word_t segbase, unw_word_t mapoff, + unw_word_t ip); extern int tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, int need_unwind_info, - void *arg); + unw_proc_info_t *pi, int need_unwind_info, + void *arg); extern void tdep_put_unwind_info (unw_addr_space_t as, - unw_proc_info_t *pi, void *arg); + unw_proc_info_t *pi, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, unw_regnum_t regnum, - uint8_t *nat_bitnr); + uint8_t *nat_bitnr); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t *valp, int write); + unw_word_t *valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t *valp, int write); + unw_fpreg_t *valp, int write); extern struct ia64_global_unwind_state unw; /* In user-level, we have no reasonable way of determining the base of an arbitrary backing-store. We default to half the address-space. */ -#define rbs_get_base(c,bspstore,rbs_basep) \ - (*(rbs_basep) = (bspstore) - (((unw_word_t) 1) << 63), 0) +#define rbs_get_base(c,bspstore,rbs_basep) \ + (*(rbs_basep) = (bspstore) - (((unw_word_t) 1) << 63), 0) #endif /* IA64_LIBUNWIND_I_H */ diff --git a/include/tdep-ia64/rse.h b/include/tdep-ia64/rse.h index c5fe4b58..ee521a59 100644 --- a/include/tdep-ia64/rse.h +++ b/include/tdep-ia64/rse.h @@ -1,6 +1,6 @@ /* * Copyright (C) 1998, 1999, 2002, 2003, 2005 Hewlett-Packard Co - * David Mosberger-Tang + * David Mosberger-Tang * * Register stack engine related helper functions. This file may be * used in applications, so be careful about the name-space and give @@ -15,7 +15,7 @@ static inline uint64_t rse_slot_num (uint64_t addr) { - return (addr >> 3) & 0x3f; + return (addr >> 3) & 0x3f; } /* @@ -24,7 +24,7 @@ rse_slot_num (uint64_t addr) static inline uint64_t rse_is_rnat_slot (uint64_t addr) { - return rse_slot_num (addr) == 0x3f; + return rse_slot_num (addr) == 0x3f; } /* @@ -34,7 +34,7 @@ rse_is_rnat_slot (uint64_t addr) static inline uint64_t rse_rnat_addr (uint64_t slot_addr) { - return slot_addr | (0x3f << 3); + return slot_addr | (0x3f << 3); } /* @@ -45,9 +45,9 @@ rse_rnat_addr (uint64_t slot_addr) static inline uint64_t rse_num_regs (uint64_t bspstore, uint64_t bsp) { - uint64_t slots = (bsp - bspstore) >> 3; + uint64_t slots = (bsp - bspstore) >> 3; - return slots - (rse_slot_num(bspstore) + slots)/0x40; + return slots - (rse_slot_num(bspstore) + slots)/0x40; } /* @@ -57,11 +57,11 @@ rse_num_regs (uint64_t bspstore, uint64_t bsp) static inline uint64_t rse_skip_regs (uint64_t addr, long num_regs) { - long delta = rse_slot_num(addr) + num_regs; + long delta = rse_slot_num(addr) + num_regs; - if (num_regs < 0) - delta -= 0x3e; - return addr + ((num_regs + delta/0x3f) << 3); + if (num_regs < 0) + delta -= 0x3e; + return addr + ((num_regs + delta/0x3f) << 3); } #endif /* RSE_H */ diff --git a/include/tdep-ia64/script.h b/include/tdep-ia64/script.h index 48a9fe56..fe3360bf 100644 --- a/include/tdep-ia64/script.h +++ b/include/tdep-ia64/script.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -23,17 +23,17 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#define IA64_LOG_UNW_CACHE_SIZE 7 -#define IA64_UNW_CACHE_SIZE (1 << IA64_LOG_UNW_CACHE_SIZE) +#define IA64_LOG_UNW_CACHE_SIZE 7 +#define IA64_UNW_CACHE_SIZE (1 << IA64_LOG_UNW_CACHE_SIZE) -#define IA64_LOG_UNW_HASH_SIZE (IA64_LOG_UNW_CACHE_SIZE + 1) -#define IA64_UNW_HASH_SIZE (1 << IA64_LOG_UNW_HASH_SIZE) +#define IA64_LOG_UNW_HASH_SIZE (IA64_LOG_UNW_CACHE_SIZE + 1) +#define IA64_UNW_HASH_SIZE (1 << IA64_LOG_UNW_HASH_SIZE) typedef unsigned char unw_hash_index_t; struct ia64_script_insn { - unsigned int opc; /* see enum ia64_script_insn_opcode */ + unsigned int opc; /* see enum ia64_script_insn_opcode */ unsigned int dst; unw_word_t val; }; @@ -41,18 +41,18 @@ struct ia64_script_insn /* Updating each preserved register may result in one script instruction each. At the end of the script, psp gets popped, accounting for one more instruction. */ -#define IA64_MAX_SCRIPT_LEN (IA64_NUM_PREGS + 1) +#define IA64_MAX_SCRIPT_LEN (IA64_NUM_PREGS + 1) struct ia64_script { - unw_word_t ip; /* ip this script is for */ - unw_word_t pr_mask; /* mask of predicates script depends on */ - unw_word_t pr_val; /* predicate values this script is for */ - unw_proc_info_t pi; /* info about underlying procedure */ - unsigned short lru_chain; /* used for least-recently-used chain */ - unsigned short coll_chain; /* used for hash collisions */ - unsigned short hint; /* hint for next script to try (or -1) */ - unsigned short count; /* number of instructions in script */ + unw_word_t ip; /* ip this script is for */ + unw_word_t pr_mask; /* mask of predicates script depends on */ + unw_word_t pr_val; /* predicate values this script is for */ + unw_proc_info_t pi; /* info about underlying procedure */ + unsigned short lru_chain; /* used for least-recently-used chain */ + unsigned short coll_chain; /* used for hash collisions */ + unsigned short hint; /* hint for next script to try (or -1) */ + unsigned short count; /* number of instructions in script */ unsigned short abi_marker; struct ia64_script_insn insn[IA64_MAX_SCRIPT_LEN]; }; @@ -60,26 +60,26 @@ struct ia64_script struct ia64_script_cache { #ifdef HAVE_ATOMIC_OPS_H - AO_TS_t busy; /* is the script-cache busy? */ + AO_TS_t busy; /* is the script-cache busy? */ #else pthread_mutex_t lock; #endif - unsigned short lru_head; /* index of lead-recently used script */ - unsigned short lru_tail; /* index of most-recently used script */ + unsigned short lru_head; /* index of lead-recently used script */ + unsigned short lru_tail; /* index of most-recently used script */ /* hash table that maps instruction pointer to script index: */ unsigned short hash[IA64_UNW_HASH_SIZE]; - uint32_t generation; /* generation number */ + uint32_t generation; /* generation number */ /* script cache: */ struct ia64_script buckets[IA64_UNW_CACHE_SIZE]; }; -#define ia64_cache_proc_info UNW_OBJ(cache_proc_info) -#define ia64_get_cached_proc_info UNW_OBJ(get_cached_proc_info) +#define ia64_cache_proc_info UNW_OBJ(cache_proc_info) +#define ia64_get_cached_proc_info UNW_OBJ(get_cached_proc_info) -struct cursor; /* forward declaration */ +struct cursor; /* forward declaration */ extern int ia64_cache_proc_info (struct cursor *c); extern int ia64_get_cached_proc_info (struct cursor *c); diff --git a/include/tdep-mips/dwarf-config.h b/include/tdep-mips/dwarf-config.h index 0dbdc5a0..8006d0b8 100644 --- a/include/tdep-mips/dwarf-config.h +++ b/include/tdep-mips/dwarf-config.h @@ -28,25 +28,25 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* This is FIRST_PSEUDO_REGISTER in GCC, since DWARF_FRAME_REGISTERS is not explicitly defined. */ -#define DWARF_NUM_PRESERVED_REGS 188 +#define DWARF_NUM_PRESERVED_REGS 188 #define dwarf_to_unw_regnum(reg) (((reg) < 32) ? (reg) : 0) /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian) +#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian) /* Return the size of an address, for DWARF purposes. */ #define dwarf_addr_size(addr_space) ((addr_space)->addr_size) /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) typedef struct dwarf_loc { unw_word_t val; #ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ + unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ #endif } dwarf_loc_t; diff --git a/include/tdep-mips/jmpbuf.h b/include/tdep-mips/jmpbuf.h index 1adb2bca..c099f926 100644 --- a/include/tdep-mips/jmpbuf.h +++ b/include/tdep-mips/jmpbuf.h @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* FIXME for MIPS! */ -#define JB_SP 4 -#define JB_RP 5 -#define JB_MASK_SAVED 6 -#define JB_MASK 7 +#define JB_SP 4 +#define JB_RP 5 +#define JB_MASK_SAVED 6 +#define JB_MASK 7 diff --git a/include/tdep-mips/libunwind_i.h b/include/tdep-mips/libunwind_i.h index 3ef1cef3..d11894d9 100644 --- a/include/tdep-mips/libunwind_i.h +++ b/include/tdep-mips/libunwind_i.h @@ -59,21 +59,21 @@ struct unw_addr_space #else uint32_t cache_generation; #endif - unw_word_t dyn_generation; /* see dyn-common.h */ - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ struct dwarf_rs_cache global_cache; struct unw_debug_frame_list *debug_frames; }; -#define tdep_big_endian(as) ((as)->big_endian) +#define tdep_big_endian(as) ((as)->big_endian) struct cursor { - struct dwarf_cursor dwarf; /* must be first */ + struct dwarf_cursor dwarf; /* must be first */ unw_word_t sigcontext_addr; }; -#define DWARF_GET_LOC(l) ((l).val) +#define DWARF_GET_LOC(l) ((l).val) #ifndef UNW_REMOTE_ONLY # if _MIPS_SIM == _ABIN32 @@ -84,15 +84,15 @@ typedef long mips_reg_t; #endif #ifdef UNW_LOCAL_ONLY -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) -# define DWARF_IS_REG_LOC(l) 0 -# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) /* FIXME: Implement these for the MIPS FPU. */ static inline int @@ -132,18 +132,18 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) } #else /* !UNW_LOCAL_ONLY */ -# define DWARF_LOC_TYPE_FP (1 << 0) -# define DWARF_LOC_TYPE_REG (1 << 1) -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) \ - ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) -# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) -# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) -# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_FP)) +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) static inline int read_s32 (struct dwarf_cursor *c, unw_word_t addr, unw_word_t *val) @@ -196,15 +196,15 @@ dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 0, c->as_arg)) < 0) + 0, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, - c->as_arg); + c->as_arg); } static inline int @@ -219,15 +219,15 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - &val, 1, c->as_arg); + &val, 1, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 1, c->as_arg)) < 0) + 1, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, - 1, c->as_arg); + 1, c->as_arg); } static inline int @@ -244,12 +244,12 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); else if (c->as->abi == UNW_MIPS_ABI_O32) return read_s32 (c, DWARF_GET_LOC (loc), val); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); } static inline int @@ -266,64 +266,64 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); else if (c->as->abi == UNW_MIPS_ABI_O32) return write_s32 (c, DWARF_GET_LOC (loc), &val); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); } #endif /* !UNW_LOCAL_ONLY */ #define tdep_getcontext_trace unw_getcontext -#define tdep_init_done UNW_OBJ(init_done) -#define tdep_init UNW_OBJ(init) +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table dwarf_search_unwind_table -#define tdep_find_unwind_table dwarf_find_unwind_table -#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) -#define tdep_fetch_frame(c,ip,n) do {} while(0) -#define tdep_cache_frame(c,rs) do {} while(0) -#define tdep_reuse_frame(c,rs) do {} while(0) -#define tdep_stash_frame(c,rs) do {} while(0) -#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) #ifdef UNW_LOCAL_ONLY -# define tdep_find_proc_info(c,ip,n) \ - dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - dwarf_put_unwind_info((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) #else -# define tdep_find_proc_info(c,ip,n) \ - (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) #endif -#define tdep_get_as(c) ((c)->dwarf.as) -#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) -#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, int reg); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t *valp, int write); + unw_word_t *valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t *valp, int write); + unw_fpreg_t *valp, int write); #endif /* MIPS_LIBUNWIND_I_H */ diff --git a/include/tdep-ppc32/dwarf-config.h b/include/tdep-ppc32/dwarf-config.h index e2676a82..bf6886b0 100644 --- a/include/tdep-ppc32/dwarf-config.h +++ b/include/tdep-ppc32/dwarf-config.h @@ -33,22 +33,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define dwarf_config_h /* For PPC64, 48 GPRs + 33 FPRs + 33 AltiVec + 1 SPE */ -#define DWARF_NUM_PRESERVED_REGS 115 +#define DWARF_NUM_PRESERVED_REGS 115 -#define DWARF_REGNUM_MAP_LENGTH 115 +#define DWARF_REGNUM_MAP_LENGTH 115 /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ #define dwarf_is_big_endian(addr_space) 1 /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) typedef struct dwarf_loc { unw_word_t val; #ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see X86_LOC_TYPE_* macros. */ + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ #endif } dwarf_loc_t; diff --git a/include/tdep-ppc32/jmpbuf.h b/include/tdep-ppc32/jmpbuf.h index 3780d5b5..861e94d9 100644 --- a/include/tdep-ppc32/jmpbuf.h +++ b/include/tdep-ppc32/jmpbuf.h @@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Use glibc's jump-buffer indices; NPTL peeks at SP: */ -#define JB_SP 6 -#define JB_RP 7 -#define JB_MASK_SAVED 8 -#define JB_MASK 9 +#define JB_SP 6 +#define JB_RP 7 +#define JB_MASK_SAVED 8 +#define JB_MASK 9 diff --git a/include/tdep-ppc32/libunwind_i.h b/include/tdep-ppc32/libunwind_i.h index 06c00236..cc113c56 100644 --- a/include/tdep-ppc32/libunwind_i.h +++ b/include/tdep-ppc32/libunwind_i.h @@ -57,8 +57,8 @@ struct unw_addr_space #else uint32_t cache_generation; #endif - unw_word_t dyn_generation; /* see dyn-common.h */ - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ struct dwarf_rs_cache global_cache; struct unw_debug_frame_list *debug_frames; int validate; @@ -66,53 +66,53 @@ struct unw_addr_space struct cursor { - struct dwarf_cursor dwarf; /* must be first */ + struct dwarf_cursor dwarf; /* must be first */ /* Format of sigcontext structure and address at which it is stored: */ enum { - PPC_SCF_NONE, /* no signal frame encountered */ - PPC_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ + PPC_SCF_NONE, /* no signal frame encountered */ + PPC_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ } sigcontext_format; unw_word_t sigcontext_addr; }; -#define DWARF_GET_LOC(l) ((l).val) +#define DWARF_GET_LOC(l) ((l).val) #ifdef UNW_LOCAL_ONLY -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) -# define DWARF_IS_REG_LOC(l) 0 -# define DWARF_IS_FP_LOC(l) 0 -# define DWARF_IS_V_LOC(l) 0 -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) -# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) -# define DWARF_VREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_IS_FP_LOC(l) 0 +# define DWARF_IS_V_LOC(l) 0 +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_VREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) #else /* !UNW_LOCAL_ONLY */ -# define DWARF_LOC_TYPE_FP (1 << 0) -# define DWARF_LOC_TYPE_REG (1 << 1) -# define DWARF_LOC_TYPE_V (1 << 2) -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) \ - ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) -# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) -# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) -# define DWARF_IS_V_LOC(l) (((l).type & DWARF_LOC_TYPE_V) != 0) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) -# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_FP)) -# define DWARF_VREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_V)) +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_LOC_TYPE_V (1 << 2) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_IS_V_LOC(l) (((l).type & DWARF_LOC_TYPE_V) != 0) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) +# define DWARF_VREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_V)) #endif /* !UNW_LOCAL_ONLY */ @@ -131,12 +131,12 @@ dwarf_getvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp, - 0, c->as_arg)) < 0) + 0, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 0, c->as_arg); @@ -157,11 +157,11 @@ dwarf_putvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - &val, 1, c->as_arg); + &val, 1, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp, - 1, c->as_arg)) < 0) + 1, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 1, c->as_arg); @@ -181,7 +181,7 @@ dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = DWARF_GET_LOC (loc); return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 0, c->as_arg); @@ -202,7 +202,7 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - &val, 1, c->as_arg); + &val, 1, c->as_arg); addr = DWARF_GET_LOC (loc); @@ -224,10 +224,10 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t * val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); } static inline int @@ -245,68 +245,68 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); } #define tdep_getcontext_trace unw_getcontext -#define tdep_init_done UNW_OBJ(init_done) -#define tdep_init UNW_OBJ(init) +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table dwarf_search_unwind_table -#define tdep_find_unwind_table dwarf_find_unwind_table -#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) -#define tdep_fetch_frame(c,ip,n) do {} while(0) -#define tdep_cache_frame(c,rs) do {} while(0) -#define tdep_reuse_frame(c,rs) do {} while(0) -#define tdep_stash_frame(c,rs) do {} while(0) -#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) -#define tdep_get_func_addr UNW_OBJ(get_func_addr) +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_get_func_addr UNW_OBJ(get_func_addr) #ifdef UNW_LOCAL_ONLY -# define tdep_find_proc_info(c,ip,n) \ - dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - dwarf_put_unwind_info((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) #else -# define tdep_find_proc_info(c,ip,n) \ - (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) #endif extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip, - int need_unwind_info); + int need_unwind_info); -#define tdep_get_as(c) ((c)->dwarf.as) -#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) -#define tdep_get_ip(c) ((c)->dwarf.ip) -#define tdep_big_endian(as) 1 +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) 1 extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t * di, - unw_proc_info_t * pi, - int need_unwind_info, void *arg); + unw_dyn_info_t * di, + unw_proc_info_t * pi, + int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t * uc, int reg); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t * valp, int write); + unw_word_t * valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t * valp, int write); + unw_fpreg_t * valp, int write); extern int tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr, - unw_word_t *entry_point); + unw_word_t *entry_point); #endif /* PPC64_LIBUNWIND_I_H */ diff --git a/include/tdep-ppc64/dwarf-config.h b/include/tdep-ppc64/dwarf-config.h index 7603d189..6d8ef0a9 100644 --- a/include/tdep-ppc64/dwarf-config.h +++ b/include/tdep-ppc64/dwarf-config.h @@ -33,22 +33,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #define dwarf_config_h /* For PPC64, 48 GPRs + 33 FPRs + 33 AltiVec + 1 SPE */ -#define DWARF_NUM_PRESERVED_REGS 115 +#define DWARF_NUM_PRESERVED_REGS 115 -#define DWARF_REGNUM_MAP_LENGTH 115 +#define DWARF_REGNUM_MAP_LENGTH 115 /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian) +#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian) /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) typedef struct dwarf_loc { unw_word_t val; #ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see X86_LOC_TYPE_* macros. */ + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ #endif } dwarf_loc_t; diff --git a/include/tdep-ppc64/jmpbuf.h b/include/tdep-ppc64/jmpbuf.h index 3780d5b5..861e94d9 100644 --- a/include/tdep-ppc64/jmpbuf.h +++ b/include/tdep-ppc64/jmpbuf.h @@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Use glibc's jump-buffer indices; NPTL peeks at SP: */ -#define JB_SP 6 -#define JB_RP 7 -#define JB_MASK_SAVED 8 -#define JB_MASK 9 +#define JB_SP 6 +#define JB_RP 7 +#define JB_MASK_SAVED 8 +#define JB_MASK 9 diff --git a/include/tdep-ppc64/libunwind_i.h b/include/tdep-ppc64/libunwind_i.h index 6024455a..41fb4335 100644 --- a/include/tdep-ppc64/libunwind_i.h +++ b/include/tdep-ppc64/libunwind_i.h @@ -59,8 +59,8 @@ struct unw_addr_space #else uint32_t cache_generation; #endif - unw_word_t dyn_generation; /* see dyn-common.h */ - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ struct dwarf_rs_cache global_cache; struct unw_debug_frame_list *debug_frames; int validate; @@ -68,53 +68,53 @@ struct unw_addr_space struct cursor { - struct dwarf_cursor dwarf; /* must be first */ + struct dwarf_cursor dwarf; /* must be first */ /* Format of sigcontext structure and address at which it is stored: */ enum { - PPC_SCF_NONE, /* no signal frame encountered */ - PPC_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ + PPC_SCF_NONE, /* no signal frame encountered */ + PPC_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */ } sigcontext_format; unw_word_t sigcontext_addr; }; -#define DWARF_GET_LOC(l) ((l).val) +#define DWARF_GET_LOC(l) ((l).val) #ifdef UNW_LOCAL_ONLY -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) -# define DWARF_IS_REG_LOC(l) 0 -# define DWARF_IS_FP_LOC(l) 0 -# define DWARF_IS_V_LOC(l) 0 -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) -# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) -# define DWARF_VREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_IS_FP_LOC(l) 0 +# define DWARF_IS_V_LOC(l) 0 +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_VREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) #else /* !UNW_LOCAL_ONLY */ -# define DWARF_LOC_TYPE_FP (1 << 0) -# define DWARF_LOC_TYPE_REG (1 << 1) -# define DWARF_LOC_TYPE_V (1 << 2) -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) \ - ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) -# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) -# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) -# define DWARF_IS_V_LOC(l) (((l).type & DWARF_LOC_TYPE_V) != 0) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) -# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_FP)) -# define DWARF_VREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_V)) +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_LOC_TYPE_V (1 << 2) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_IS_V_LOC(l) (((l).type & DWARF_LOC_TYPE_V) != 0) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) +# define DWARF_VREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_V)) #endif /* !UNW_LOCAL_ONLY */ @@ -133,12 +133,12 @@ dwarf_getvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp, - 0, c->as_arg)) < 0) + 0, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 0, c->as_arg); @@ -159,11 +159,11 @@ dwarf_putvr (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - &val, 1, c->as_arg); + &val, 1, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, valp, - 1, c->as_arg)) < 0) + 1, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 8, valp + 1, 1, c->as_arg); @@ -183,7 +183,7 @@ dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t * val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = DWARF_GET_LOC (loc); return (*c->as->acc.access_mem) (c->as, addr + 0, valp, 0, c->as_arg); @@ -204,7 +204,7 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - &val, 1, c->as_arg); + &val, 1, c->as_arg); addr = DWARF_GET_LOC (loc); @@ -226,10 +226,10 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t * val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); } static inline int @@ -247,68 +247,68 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); } #define tdep_getcontext_trace unw_getcontext -#define tdep_init_done UNW_OBJ(init_done) -#define tdep_init UNW_OBJ(init) +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table dwarf_search_unwind_table -#define tdep_find_unwind_table dwarf_find_unwind_table -#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) -#define tdep_fetch_frame(c,ip,n) do {} while(0) -#define tdep_cache_frame(c,rs) do {} while(0) -#define tdep_reuse_frame(c,rs) do {} while(0) -#define tdep_stash_frame(c,rs) do {} while(0) -#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) -#define tdep_get_func_addr UNW_OBJ(get_func_addr) +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_get_func_addr UNW_OBJ(get_func_addr) #ifdef UNW_LOCAL_ONLY -# define tdep_find_proc_info(c,ip,n) \ - dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - dwarf_put_unwind_info((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) #else -# define tdep_find_proc_info(c,ip,n) \ - (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) #endif extern int tdep_fetch_proc_info_post (struct dwarf_cursor *c, unw_word_t ip, - int need_unwind_info); + int need_unwind_info); -#define tdep_get_as(c) ((c)->dwarf.as) -#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) -#define tdep_get_ip(c) ((c)->dwarf.ip) -#define tdep_big_endian(as) ((as)->big_endian) +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) ((as)->big_endian) extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t * di, - unw_proc_info_t * pi, - int need_unwind_info, void *arg); + unw_dyn_info_t * di, + unw_proc_info_t * pi, + int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t * uc, int reg); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t * valp, int write); + unw_word_t * valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t * valp, int write); + unw_fpreg_t * valp, int write); extern int tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr, - unw_word_t *entry_point); + unw_word_t *entry_point); #endif /* PPC64_LIBUNWIND_I_H */ diff --git a/include/tdep-sh/dwarf-config.h b/include/tdep-sh/dwarf-config.h index 2a7116f3..2f76f5be 100644 --- a/include/tdep-sh/dwarf-config.h +++ b/include/tdep-sh/dwarf-config.h @@ -26,22 +26,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef dwarf_config_h #define dwarf_config_h -#define DWARF_NUM_PRESERVED_REGS 18 +#define DWARF_NUM_PRESERVED_REGS 18 #define dwarf_to_unw_regnum(reg) (((reg) <= UNW_SH_PR) ? (reg) : 0) /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian) +#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian) /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) typedef struct dwarf_loc { unw_word_t val; #ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ + unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ #endif } dwarf_loc_t; diff --git a/include/tdep-sh/jmpbuf.h b/include/tdep-sh/jmpbuf.h index 684a4054..8b44b5b2 100644 --- a/include/tdep-sh/jmpbuf.h +++ b/include/tdep-sh/jmpbuf.h @@ -42,7 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ * 14. fr15 */ -#define JB_SP 7 -#define JB_RP 8 -#define JB_MASK_SAVED 15 -#define JB_MASK 16 +#define JB_SP 7 +#define JB_RP 8 +#define JB_MASK_SAVED 15 +#define JB_MASK 16 diff --git a/include/tdep-sh/libunwind_i.h b/include/tdep-sh/libunwind_i.h index 51234d16..7bbb29b3 100644 --- a/include/tdep-sh/libunwind_i.h +++ b/include/tdep-sh/libunwind_i.h @@ -52,15 +52,15 @@ struct unw_addr_space #else uint32_t cache_generation; #endif - unw_word_t dyn_generation; /* see dyn-common.h */ - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ struct dwarf_rs_cache global_cache; struct unw_debug_frame_list *debug_frames; }; struct cursor { - struct dwarf_cursor dwarf; /* must be first */ + struct dwarf_cursor dwarf; /* must be first */ enum { SH_SCF_NONE, /* no signal frame */ @@ -73,18 +73,18 @@ struct cursor unw_word_t sigcontext_pc; }; -#define DWARF_GET_LOC(l) ((l).val) +#define DWARF_GET_LOC(l) ((l).val) #ifdef UNW_LOCAL_ONLY -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) -# define DWARF_IS_REG_LOC(l) 0 -# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) static inline int dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) @@ -123,18 +123,18 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) } #else /* !UNW_LOCAL_ONLY */ -# define DWARF_LOC_TYPE_FP (1 << 0) -# define DWARF_LOC_TYPE_REG (1 << 1) -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) \ - ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) -# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) -# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) -# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_FP)) +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) static inline int dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) @@ -148,15 +148,15 @@ dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 0, c->as_arg)) < 0) + 0, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, - c->as_arg); + c->as_arg); } static inline int @@ -171,15 +171,15 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - &val, 1, c->as_arg); + &val, 1, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 1, c->as_arg)) < 0) + 1, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, - 1, c->as_arg); + 1, c->as_arg); } static inline int @@ -196,10 +196,10 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); } static inline int @@ -216,63 +216,63 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); } #endif /* !UNW_LOCAL_ONLY */ #define tdep_getcontext_trace unw_getcontext -#define tdep_init_done UNW_OBJ(init_done) -#define tdep_init UNW_OBJ(init) +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table dwarf_search_unwind_table -#define tdep_find_unwind_table dwarf_find_unwind_table -#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) -#define tdep_fetch_frame(c,ip,n) do {} while(0) -#define tdep_cache_frame(c,rs) do {} while(0) -#define tdep_reuse_frame(c,rs) do {} while(0) -#define tdep_stash_frame(c,rs) do {} while(0) -#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) #ifdef UNW_LOCAL_ONLY -# define tdep_find_proc_info(c,ip,n) \ - dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - dwarf_put_unwind_info((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) #else -# define tdep_find_proc_info(c,ip,n) \ - (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) #endif -#define tdep_get_as(c) ((c)->dwarf.as) -#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) -#define tdep_get_ip(c) ((c)->dwarf.ip) -#define tdep_big_endian(as) ((as)->big_endian) +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) ((as)->big_endian) extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t *valp, int write); + unw_word_t *valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t *valp, int write); + unw_fpreg_t *valp, int write); #endif /* SH_LIBUNWIND_I_H */ diff --git a/include/tdep-x86/dwarf-config.h b/include/tdep-x86/dwarf-config.h index 898ab796..f76f9c1c 100644 --- a/include/tdep-x86/dwarf-config.h +++ b/include/tdep-x86/dwarf-config.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -29,22 +29,22 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* This matches the value used by GCC (see gcc/config/i386.h:DWARF_FRAME_REGISTERS), which leaves plenty of room for expansion. */ -#define DWARF_NUM_PRESERVED_REGS 17 +#define DWARF_NUM_PRESERVED_REGS 17 -#define DWARF_REGNUM_MAP_LENGTH 19 +#define DWARF_REGNUM_MAP_LENGTH 19 /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) 0 +#define dwarf_is_big_endian(addr_space) 0 /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) typedef struct dwarf_loc { unw_word_t val; #ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see X86_LOC_TYPE_* macros. */ + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ #endif } dwarf_loc_t; diff --git a/include/tdep-x86/jmpbuf.h b/include/tdep-x86/jmpbuf.h index 56149509..521dfa69 100644 --- a/include/tdep-x86/jmpbuf.h +++ b/include/tdep-x86/jmpbuf.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,16 +27,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if defined __linux__ -#define JB_SP 4 -#define JB_RP 5 -#define JB_MASK_SAVED 6 -#define JB_MASK 7 +#define JB_SP 4 +#define JB_RP 5 +#define JB_MASK_SAVED 6 +#define JB_MASK 7 #elif defined __FreeBSD__ -#define JB_SP 2 -#define JB_RP 0 -#define JB_MASK_SAVED 11 -#define JB_MASK 7 +#define JB_SP 2 +#define JB_RP 0 +#define JB_MASK_SAVED 11 +#define JB_MASK 7 #endif diff --git a/include/tdep-x86/libunwind_i.h b/include/tdep-x86/libunwind_i.h index f59a3cfb..b1c8b983 100644 --- a/include/tdep-x86/libunwind_i.h +++ b/include/tdep-x86/libunwind_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -51,27 +51,27 @@ struct unw_addr_space #else uint32_t cache_generation; #endif - unw_word_t dyn_generation; /* see dyn-common.h */ - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ struct dwarf_rs_cache global_cache; struct unw_debug_frame_list *debug_frames; }; struct cursor { - struct dwarf_cursor dwarf; /* must be first */ + struct dwarf_cursor dwarf; /* must be first */ /* Format of sigcontext structure and address at which it is stored: */ enum { - X86_SCF_NONE, /* no signal frame encountered */ - X86_SCF_LINUX_SIGFRAME, /* Linux x86 sigcontext */ - X86_SCF_LINUX_RT_SIGFRAME, /* POSIX ucontext_t */ - X86_SCF_FREEBSD_SIGFRAME, /* FreeBSD x86 sigcontext */ - X86_SCF_FREEBSD_SIGFRAME4, /* FreeBSD 4.x x86 sigcontext */ - X86_SCF_FREEBSD_OSIGFRAME, /* FreeBSD pre-4.x x86 sigcontext */ - X86_SCF_FREEBSD_SYSCALL, /* FreeBSD x86 syscall */ + X86_SCF_NONE, /* no signal frame encountered */ + X86_SCF_LINUX_SIGFRAME, /* Linux x86 sigcontext */ + X86_SCF_LINUX_RT_SIGFRAME, /* POSIX ucontext_t */ + X86_SCF_FREEBSD_SIGFRAME, /* FreeBSD x86 sigcontext */ + X86_SCF_FREEBSD_SIGFRAME4, /* FreeBSD 4.x x86 sigcontext */ + X86_SCF_FREEBSD_OSIGFRAME, /* FreeBSD pre-4.x x86 sigcontext */ + X86_SCF_FREEBSD_SYSCALL, /* FreeBSD x86 syscall */ } sigcontext_format; unw_word_t sigcontext_addr; @@ -86,18 +86,18 @@ dwarf_get_uc(const struct dwarf_cursor *cursor) return c->uc; } -#define DWARF_GET_LOC(l) ((l).val) +#define DWARF_GET_LOC(l) ((l).val) #ifdef UNW_LOCAL_ONLY -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) -# define DWARF_IS_REG_LOC(l) 0 -# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr(dwarf_get_uc(c), (r)), 0)) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - tdep_uc_addr(dwarf_get_uc(c), (r)), 0)) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr(dwarf_get_uc(c), (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr(dwarf_get_uc(c), (r)), 0)) static inline int dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) @@ -123,7 +123,7 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) if (!DWARF_GET_LOC (loc)) return -1; return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); } static inline int @@ -132,22 +132,22 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) if (!DWARF_GET_LOC (loc)) return -1; return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); } #else /* !UNW_LOCAL_ONLY */ -# define DWARF_LOC_TYPE_FP (1 << 0) -# define DWARF_LOC_TYPE_REG (1 << 1) -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) \ - ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) -# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) -# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) -# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_FP)) +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) static inline int dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) @@ -161,15 +161,15 @@ dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 0, c->as_arg)) < 0) + 0, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, - c->as_arg); + c->as_arg); } static inline int @@ -184,15 +184,15 @@ dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), - &val, 1, c->as_arg); + &val, 1, c->as_arg); addr = DWARF_GET_LOC (loc); if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, - 1, c->as_arg)) < 0) + 1, c->as_arg)) < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, - 1, c->as_arg); + 1, c->as_arg); } static inline int @@ -209,10 +209,10 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); } static inline int @@ -229,63 +229,63 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); } #endif /* !UNW_LOCAL_ONLY */ #define tdep_getcontext_trace unw_getcontext -#define tdep_init_done UNW_OBJ(init_done) -#define tdep_init UNW_OBJ(init) +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table dwarf_search_unwind_table -#define tdep_find_unwind_table dwarf_find_unwind_table -#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) -#define tdep_fetch_frame(c,ip,n) do {} while(0) -#define tdep_cache_frame(c,rs) do {} while(0) -#define tdep_reuse_frame(c,rs) do {} while(0) -#define tdep_stash_frame(c,rs) do {} while(0) -#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) #ifdef UNW_LOCAL_ONLY -# define tdep_find_proc_info(c,ip,n) \ - dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - dwarf_put_unwind_info((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) #else -# define tdep_find_proc_info(c,ip,n) \ - (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) #endif -#define tdep_get_as(c) ((c)->dwarf.as) -#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) -#define tdep_get_ip(c) ((c)->dwarf.ip) -#define tdep_big_endian(as) 0 +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) 0 extern int tdep_init_done; extern void tdep_init (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); extern void *tdep_uc_addr (ucontext_t *uc, int reg); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t *valp, int write); + unw_word_t *valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t *valp, int write); + unw_fpreg_t *valp, int write); #endif /* X86_LIBUNWIND_I_H */ diff --git a/include/tdep-x86_64/dwarf-config.h b/include/tdep-x86_64/dwarf-config.h index d3cbe7c2..16d8aa57 100644 --- a/include/tdep-x86_64/dwarf-config.h +++ b/include/tdep-x86_64/dwarf-config.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -33,25 +33,25 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* XXX need to verify if this value is correct */ #ifdef CONFIG_MSABI_SUPPORT -#define DWARF_NUM_PRESERVED_REGS 33 +#define DWARF_NUM_PRESERVED_REGS 33 #else -#define DWARF_NUM_PRESERVED_REGS 17 +#define DWARF_NUM_PRESERVED_REGS 17 #endif -#define DWARF_REGNUM_MAP_LENGTH DWARF_NUM_PRESERVED_REGS +#define DWARF_REGNUM_MAP_LENGTH DWARF_NUM_PRESERVED_REGS /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) 0 +#define dwarf_is_big_endian(addr_space) 0 /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ -#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) typedef struct dwarf_loc { unw_word_t val; #ifndef UNW_LOCAL_ONLY - unw_word_t type; /* see X86_LOC_TYPE_* macros. */ + unw_word_t type; /* see X86_LOC_TYPE_* macros. */ #endif } dwarf_loc_t; diff --git a/include/tdep-x86_64/jmpbuf.h b/include/tdep-x86_64/jmpbuf.h index 44fcd69b..d5719667 100644 --- a/include/tdep-x86_64/jmpbuf.h +++ b/include/tdep-x86_64/jmpbuf.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,17 +27,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Use glibc's jump-buffer indices; NPTL peeks at SP: */ -#define JB_SP 6 -#define JB_RP 7 -#define JB_MASK_SAVED 8 -#define JB_MASK 9 +#define JB_SP 6 +#define JB_RP 7 +#define JB_MASK_SAVED 8 +#define JB_MASK 9 #elif defined __FreeBSD__ -#define JB_SP 2 -#define JB_RP 0 +#define JB_SP 2 +#define JB_RP 0 /* Pretend the ip cannot be 0 and mask is always saved */ -#define JB_MASK_SAVED 0 -#define JB_MASK 9 +#define JB_MASK_SAVED 0 +#define JB_MASK 9 #endif diff --git a/include/tdep-x86_64/libunwind_i.h b/include/tdep-x86_64/libunwind_i.h index 53177667..a6b301b5 100644 --- a/include/tdep-x86_64/libunwind_i.h +++ b/include/tdep-x86_64/libunwind_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -68,26 +68,26 @@ struct unw_addr_space #else uint32_t cache_generation; #endif - unw_word_t dyn_generation; /* see dyn-common.h */ - unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ struct dwarf_rs_cache global_cache; struct unw_debug_frame_list *debug_frames; }; struct cursor { - struct dwarf_cursor dwarf; /* must be first */ + struct dwarf_cursor dwarf; /* must be first */ - unw_tdep_frame_t frame_info; /* quick tracing assist info */ + unw_tdep_frame_t frame_info; /* quick tracing assist info */ /* Format of sigcontext structure and address at which it is stored: */ enum { - X86_64_SCF_NONE, /* no signal frame encountered */ - X86_64_SCF_LINUX_RT_SIGFRAME, /* Linux ucontext_t */ - X86_64_SCF_FREEBSD_SIGFRAME, /* FreeBSD signal frame */ - X86_64_SCF_FREEBSD_SYSCALL, /* FreeBSD syscall */ + X86_64_SCF_NONE, /* no signal frame encountered */ + X86_64_SCF_LINUX_RT_SIGFRAME, /* Linux ucontext_t */ + X86_64_SCF_FREEBSD_SIGFRAME, /* FreeBSD signal frame */ + X86_64_SCF_FREEBSD_SYSCALL, /* FreeBSD syscall */ } sigcontext_format; unw_word_t sigcontext_addr; @@ -102,40 +102,40 @@ dwarf_get_uc(const struct dwarf_cursor *cursor) return c->uc; } -#define DWARF_GET_LOC(l) ((l).val) +#define DWARF_GET_LOC(l) ((l).val) #ifdef UNW_LOCAL_ONLY -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) -# define DWARF_IS_REG_LOC(l) 0 -# define DWARF_IS_MEM_LOC(l) 1 -# define DWARF_IS_VAL_LOC(l) 0 -# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0)) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ - x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0)) -# define DWARF_VAL_LOC(c,v) DWARF_NULL_LOC +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_IS_MEM_LOC(l) 1 +# define DWARF_IS_VAL_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + x86_64_r_uc_addr(dwarf_get_uc(c), (r)), 0)) +# define DWARF_VAL_LOC(c,v) DWARF_NULL_LOC #else /* !UNW_LOCAL_ONLY */ -# define DWARF_LOC_TYPE_FP (1 << 0) -# define DWARF_LOC_TYPE_REG (1 << 1) -# define DWARF_LOC_TYPE_VAL (1 << 2) -# define DWARF_NULL_LOC DWARF_LOC (0, 0) -# define DWARF_IS_NULL_LOC(l) \ - ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) -# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) -# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) -# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) -# define DWARF_IS_MEM_LOC(l) ((l).type == 0) -# define DWARF_IS_VAL_LOC(l) (((l).type & DWARF_LOC_TYPE_VAL) != 0) -# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) -# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) -# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ - | DWARF_LOC_TYPE_FP)) -# define DWARF_VAL_LOC(c,v) DWARF_LOC ((v), DWARF_LOC_TYPE_VAL) +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_LOC_TYPE_VAL (1 << 2) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_IS_MEM_LOC(l) ((l).type == 0) +# define DWARF_IS_VAL_LOC(l) (((l).type & DWARF_LOC_TYPE_VAL) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) +# define DWARF_VAL_LOC(c,v) DWARF_LOC ((v), DWARF_LOC_TYPE_VAL) #endif /* !UNW_LOCAL_ONLY */ @@ -165,10 +165,10 @@ dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); if (DWARF_IS_MEM_LOC (loc)) return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, - 0, c->as_arg); + 0, c->as_arg); assert(DWARF_IS_VAL_LOC (loc)); *val = DWARF_GET_LOC (loc); return 0; @@ -184,79 +184,79 @@ dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) if (DWARF_IS_REG_LOC (loc)) return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); else return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, - 1, c->as_arg); + 1, c->as_arg); } -#define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace) -#define tdep_init_done UNW_OBJ(init_done) -#define tdep_init_mem_validate UNW_OBJ(init_mem_validate) -#define tdep_init UNW_OBJ(init) +#define tdep_getcontext_trace UNW_ARCH_OBJ(getcontext_trace) +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init_mem_validate UNW_OBJ(init_mem_validate) +#define tdep_init UNW_OBJ(init) /* Platforms that support UNW_INFO_FORMAT_TABLE need to define tdep_search_unwind_table. */ -#define tdep_search_unwind_table dwarf_search_unwind_table -#define tdep_find_unwind_table dwarf_find_unwind_table -#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) -#define tdep_access_reg UNW_OBJ(access_reg) -#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) #if __linux__ -# define tdep_fetch_frame UNW_OBJ(fetch_frame) -# define tdep_cache_frame UNW_OBJ(cache_frame) -# define tdep_reuse_frame UNW_OBJ(reuse_frame) +# define tdep_fetch_frame UNW_OBJ(fetch_frame) +# define tdep_cache_frame UNW_OBJ(cache_frame) +# define tdep_reuse_frame UNW_OBJ(reuse_frame) #else -# define tdep_fetch_frame(c,ip,n) do {} while(0) -# define tdep_cache_frame(c,rs) do {} while(0) -# define tdep_reuse_frame(c,rs) do {} while(0) +# define tdep_fetch_frame(c,ip,n) do {} while(0) +# define tdep_cache_frame(c,rs) do {} while(0) +# define tdep_reuse_frame(c,rs) do {} while(0) #endif -#define tdep_stash_frame UNW_OBJ(stash_frame) -#define tdep_trace UNW_OBJ(tdep_trace) +#define tdep_stash_frame UNW_OBJ(stash_frame) +#define tdep_trace UNW_OBJ(tdep_trace) #define x86_64_r_uc_addr UNW_OBJ(r_uc_addr) #ifdef UNW_LOCAL_ONLY -# define tdep_find_proc_info(c,ip,n) \ - dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - dwarf_put_unwind_info((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) #else -# define tdep_find_proc_info(c,ip,n) \ - (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define tdep_put_unwind_info(as,pi,arg) \ - (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) #endif -#define tdep_get_as(c) ((c)->dwarf.as) -#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) -#define tdep_get_ip(c) ((c)->dwarf.ip) -#define tdep_big_endian(as) 0 +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) 0 extern int tdep_init_done; extern void tdep_init (void); extern void tdep_init_mem_validate (void); extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg); + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg); extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen); + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, - unw_word_t *valp, int write); + unw_word_t *valp, int write); extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, - unw_fpreg_t *valp, int write); + unw_fpreg_t *valp, int write); #if __linux__ extern void tdep_fetch_frame (struct dwarf_cursor *c, unw_word_t ip, - int need_unwind_info); + int need_unwind_info); extern void tdep_cache_frame (struct dwarf_cursor *c, - struct dwarf_reg_state *rs); + struct dwarf_reg_state *rs); extern void tdep_reuse_frame (struct dwarf_cursor *c, - struct dwarf_reg_state *rs); + struct dwarf_reg_state *rs); extern void tdep_stash_frame (struct dwarf_cursor *c, - struct dwarf_reg_state *rs); + struct dwarf_reg_state *rs); #endif extern int tdep_getcontext_trace (unw_tdep_context_t *); diff --git a/include/unwind.h b/include/unwind.h index f8d43d0d..7cf128de 100644 --- a/include/unwind.h +++ b/include/unwind.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -35,7 +35,7 @@ extern "C" { /* Minimal interface as per C++ ABI draft standard: - http://www.codesourcery.com/cxx-abi/abi-eh.html */ + http://www.codesourcery.com/cxx-abi/abi-eh.html */ typedef enum { @@ -53,22 +53,22 @@ _Unwind_Reason_Code; typedef int _Unwind_Action; -#define _UA_SEARCH_PHASE 1 -#define _UA_CLEANUP_PHASE 2 -#define _UA_HANDLER_FRAME 4 -#define _UA_FORCE_UNWIND 8 +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 -struct _Unwind_Context; /* opaque data-structure */ -struct _Unwind_Exception; /* forward-declaration */ +struct _Unwind_Context; /* opaque data-structure */ +struct _Unwind_Exception; /* forward-declaration */ typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, - struct _Unwind_Exception *); + struct _Unwind_Exception *); typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action, - uint64_t, - struct _Unwind_Exception *, - struct _Unwind_Context *, - void *); + uint64_t, + struct _Unwind_Exception *, + struct _Unwind_Context *, + void *); /* The C++ ABI requires exception_class, private_1, and private_2 to be of type uint64 and the entire structure to be @@ -84,7 +84,7 @@ struct _Unwind_Exception extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, - _Unwind_Stop_Fn, void *); + _Unwind_Stop_Fn, void *); extern void _Unwind_Resume (struct _Unwind_Exception *); extern void _Unwind_DeleteException (struct _Unwind_Exception *); extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int); @@ -100,17 +100,17 @@ extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *); /* Callback for _Unwind_Backtrace(). The backtrace stops immediately if the callback returns any value other than _URC_NO_REASON. */ typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, - void *); + void *); /* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why _UA_END_OF_STACK exists. */ -# define _UA_END_OF_STACK 16 +# define _UA_END_OF_STACK 16 /* If the unwind was initiated due to a forced unwind, resume that operation, else re-raise the exception. This is used by __cxa_rethrow(). */ extern _Unwind_Reason_Code - _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); /* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why _Unwind_GetBSP() exists. */ diff --git a/include/x86/jmpbuf.h b/include/x86/jmpbuf.h index a0eb072e..94d5984f 100644 --- a/include/x86/jmpbuf.h +++ b/include/x86/jmpbuf.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -25,7 +25,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Use glibc's jump-buffer indices; NPTL peeks at SP: */ -#define JB_SP 4 -#define JB_RP 5 -#define JB_MASK_SAVED 6 -#define JB_MASK 7 +#define JB_SP 4 +#define JB_RP 5 +#define JB_MASK_SAVED 6 +#define JB_MASK 7 diff --git a/src/aarch64/Gget_save_loc.c b/src/aarch64/Gget_save_loc.c index c76eb9c8..5ccf5cfd 100644 --- a/src/aarch64/Gget_save_loc.c +++ b/src/aarch64/Gget_save_loc.c @@ -72,7 +72,7 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) break; default: - loc = DWARF_NULL_LOC; /* default to "not saved" */ + loc = DWARF_NULL_LOC; /* default to "not saved" */ break; } diff --git a/src/aarch64/Gglobal.c b/src/aarch64/Gglobal.c index b0a7e268..72e36b2d 100644 --- a/src/aarch64/Gglobal.c +++ b/src/aarch64/Gglobal.c @@ -50,7 +50,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY aarch64_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&aarch64_lock, saved_mask); diff --git a/src/aarch64/Ginit.c b/src/aarch64/Ginit.c index 3c821b2d..0bc89971 100644 --- a/src/aarch64/Ginit.c +++ b/src/aarch64/Ginit.c @@ -74,7 +74,7 @@ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; return 0; @@ -82,7 +82,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (write) { @@ -99,7 +99,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, - void *arg) + void *arg) { unw_word_t *addr; ucontext_t *uc = arg; @@ -129,7 +129,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = arg; unw_fpreg_t *addr; @@ -143,14 +143,14 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, if (write) { Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); *(unw_fpreg_t *) addr = *val; } else { *val = *(unw_fpreg_t *) addr; Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); } return 0; @@ -162,8 +162,8 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); } diff --git a/src/aarch64/Gregs.c b/src/aarch64/Gregs.c index 0f6b9c67..6288275b 100644 --- a/src/aarch64/Gregs.c +++ b/src/aarch64/Gregs.c @@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { dwarf_loc_t loc = DWARF_NULL_LOC; unsigned int mask; @@ -106,7 +106,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, - int write) + int write) { Debug (1, "bad register number %u\n", reg); return -UNW_EBADREG; diff --git a/src/aarch64/Gresume.c b/src/aarch64/Gresume.c index 07f2f2b4..57e72abf 100644 --- a/src/aarch64/Gresume.c +++ b/src/aarch64/Gresume.c @@ -39,7 +39,7 @@ aarch64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) if (c->sigcontext_format == AARCH64_SCF_NONE) { /* Since there are no signals involved here we restore the non scratch - registers only. */ + registers only. */ unsigned long regs[11]; regs[0] = uc->uc_mcontext.regs[19]; regs[1] = uc->uc_mcontext.regs[20]; @@ -143,15 +143,15 @@ establish_machine_state (struct cursor *c) { Debug (16, "copying %s %d\n", unw_regname (reg), reg); if (unw_is_fpreg (reg)) - { - if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) - as->acc.access_fpreg (as, reg, &fpval, 1, arg); - } + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + as->acc.access_fpreg (as, reg, &fpval, 1, arg); + } else - { - if (tdep_access_reg (c, reg, &val, 0) >= 0) - as->acc.access_reg (as, reg, &val, 1, arg); - } + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + as->acc.access_reg (as, reg, &val, 1, arg); + } } } @@ -165,7 +165,7 @@ unw_resume (unw_cursor_t *cursor) if (!c->dwarf.ip) { /* This can happen easily when the frame-chain gets truncated - due to bad or missing unwind-info. */ + due to bad or missing unwind-info. */ Debug (1, "refusing to resume execution at address 0\n"); return -UNW_EINVAL; } @@ -173,5 +173,5 @@ unw_resume (unw_cursor_t *cursor) establish_machine_state (c); return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, - c->dwarf.as_arg); + c->dwarf.as_arg); } diff --git a/src/aarch64/Gstash_frame.c b/src/aarch64/Gstash_frame.c index da1ff2cb..9c1a54d4 100644 --- a/src/aarch64/Gstash_frame.c +++ b/src/aarch64/Gstash_frame.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY Copyright (C) 2014 CERN and Aalto University - Contributed by Filip Nyback + Contributed by Filip Nyback This file is part of libunwind. @@ -33,16 +33,16 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs) unw_tdep_frame_t *f = &c->frame_info; Debug (4, "ip=0x%lx cfa=0x%lx type %d cfa [where=%d val=%ld] cfaoff=%ld" - " ra=0x%lx fp [where=%d val=%ld @0x%lx] lr [where=%d val=%ld @0x%lx] " - "sp [where=%d val=%ld @0x%lx]\n", - d->ip, d->cfa, f->frame_type, - rs->reg[DWARF_CFA_REG_COLUMN].where, - rs->reg[DWARF_CFA_REG_COLUMN].val, - rs->reg[DWARF_CFA_OFF_COLUMN].val, - DWARF_GET_LOC(d->loc[d->ret_addr_column]), - rs->reg[FP].where, rs->reg[FP].val, DWARF_GET_LOC(d->loc[FP]), - rs->reg[LR].where, rs->reg[LR].val, DWARF_GET_LOC(d->loc[LR]), - rs->reg[SP].where, rs->reg[SP].val, DWARF_GET_LOC(d->loc[SP])); + " ra=0x%lx fp [where=%d val=%ld @0x%lx] lr [where=%d val=%ld @0x%lx] " + "sp [where=%d val=%ld @0x%lx]\n", + d->ip, d->cfa, f->frame_type, + rs->reg[DWARF_CFA_REG_COLUMN].where, + rs->reg[DWARF_CFA_REG_COLUMN].val, + rs->reg[DWARF_CFA_OFF_COLUMN].val, + DWARF_GET_LOC(d->loc[d->ret_addr_column]), + rs->reg[FP].where, rs->reg[FP].val, DWARF_GET_LOC(d->loc[FP]), + rs->reg[LR].where, rs->reg[LR].val, DWARF_GET_LOC(d->loc[LR]), + rs->reg[SP].where, rs->reg[SP].val, DWARF_GET_LOC(d->loc[SP])); /* A standard frame is defined as: - CFA is register-relative offset off FP or SP; @@ -53,24 +53,24 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs) if (f->frame_type == UNW_AARCH64_FRAME_OTHER && (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG) && (rs->reg[DWARF_CFA_REG_COLUMN].val == FP - || rs->reg[DWARF_CFA_REG_COLUMN].val == SP) + || rs->reg[DWARF_CFA_REG_COLUMN].val == SP) && labs(rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 29) && d->ret_addr_column == LR && (rs->reg[FP].where == DWARF_WHERE_UNDEF - || rs->reg[FP].where == DWARF_WHERE_SAME - || (rs->reg[FP].where == DWARF_WHERE_CFAREL - && labs(rs->reg[FP].val) < (1 << 29) - && rs->reg[FP].val+1 != 0)) + || rs->reg[FP].where == DWARF_WHERE_SAME + || (rs->reg[FP].where == DWARF_WHERE_CFAREL + && labs(rs->reg[FP].val) < (1 << 29) + && rs->reg[FP].val+1 != 0)) && (rs->reg[LR].where == DWARF_WHERE_UNDEF - || rs->reg[LR].where == DWARF_WHERE_SAME - || (rs->reg[LR].where == DWARF_WHERE_CFAREL - && labs(rs->reg[LR].val) < (1 << 29) - && rs->reg[LR].val+1 != 0)) + || rs->reg[LR].where == DWARF_WHERE_SAME + || (rs->reg[LR].where == DWARF_WHERE_CFAREL + && labs(rs->reg[LR].val) < (1 << 29) + && rs->reg[LR].val+1 != 0)) && (rs->reg[SP].where == DWARF_WHERE_UNDEF - || rs->reg[SP].where == DWARF_WHERE_SAME - || (rs->reg[SP].where == DWARF_WHERE_CFAREL - && labs(rs->reg[SP].val) < (1 << 29) - && rs->reg[SP].val+1 != 0))) + || rs->reg[SP].where == DWARF_WHERE_SAME + || (rs->reg[SP].where == DWARF_WHERE_CFAREL + && labs(rs->reg[SP].val) < (1 << 29) + && rs->reg[SP].val+1 != 0))) { /* Save information for a standard frame. */ f->frame_type = UNW_AARCH64_FRAME_STANDARD; diff --git a/src/aarch64/Gstep.c b/src/aarch64/Gstep.c index 61891f82..0c35f986 100644 --- a/src/aarch64/Gstep.c +++ b/src/aarch64/Gstep.c @@ -112,7 +112,7 @@ unw_step (unw_cursor_t *cursor) int ret; Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx))\n", - c, c->dwarf.ip, c->dwarf.cfa); + c, c->dwarf.ip, c->dwarf.cfa); /* Check if this is a signal frame. */ if (unw_is_signal_frame (cursor)) diff --git a/src/aarch64/Gtrace.c b/src/aarch64/Gtrace.c index c64cc764..c67faf0e 100644 --- a/src/aarch64/Gtrace.c +++ b/src/aarch64/Gtrace.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY Copyright (C) 2014 CERN and Aalto University - Contributed by Filip Nyback + Contributed by Filip Nyback This file is part of libunwind. @@ -43,7 +43,7 @@ typedef struct size_t log_size; size_t used; size_t dtor_count; /* Counts how many times our destructor has already - been called. */ + been called. */ } unw_trace_cache_t; static const unw_tdep_frame_t empty_frame = { 0, UNW_AARCH64_FRAME_OTHER, -1, -1, 0, -1, -1, -1 }; @@ -65,7 +65,7 @@ trace_cache_free (void *arg) /* Not yet our turn to get destroyed. Re-install ourselves into the key. */ pthread_setspecific(trace_cache_key, cache); Debug(5, "delayed freeing cache %p (%zx to go)\n", cache, - PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count); + PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count); return; } tls_cache_destroyed = 1; @@ -111,7 +111,7 @@ trace_cache_create (void) /* The current thread is in the process of exiting. Don't recreate cache, as we wouldn't have another chance to free it. */ Debug(5, "refusing to reallocate cache: " - "thread-locals are being deallocated\n"); + "thread-locals are being deallocated\n"); return NULL; } @@ -214,11 +214,11 @@ trace_cache_get (void) highly unusual unwind info which uses these creatively. */ static unw_tdep_frame_t * trace_init_addr (unw_tdep_frame_t *f, - unw_cursor_t *cursor, - unw_word_t cfa, - unw_word_t pc, - unw_word_t fp, - unw_word_t sp) + unw_cursor_t *cursor, + unw_word_t cfa, + unw_word_t pc, + unw_word_t fp, + unw_word_t sp) { struct cursor *c = (struct cursor *) cursor; struct dwarf_cursor *d = &c->dwarf; @@ -261,9 +261,9 @@ trace_init_addr (unw_tdep_frame_t *f, f->last_frame = -1; Debug (3, "frame va %lx type %d last %d cfa %s+%d fp @ cfa%+d lr @ cfa%+d sp @ cfa%+d\n", - f->virtual_address, f->frame_type, f->last_frame, - f->cfa_reg_sp ? "sp" : "fp", f->cfa_reg_offset, - f->fp_cfa_offset, f->lr_cfa_offset, f->sp_cfa_offset); + f->virtual_address, f->frame_type, f->last_frame, + f->cfa_reg_sp ? "sp" : "fp", f->cfa_reg_offset, + f->fp_cfa_offset, f->lr_cfa_offset, f->sp_cfa_offset); return f; } @@ -274,11 +274,11 @@ trace_init_addr (unw_tdep_frame_t *f, frame cache slot which describes RIP. */ static unw_tdep_frame_t * trace_lookup (unw_cursor_t *cursor, - unw_trace_cache_t *cache, - unw_word_t cfa, - unw_word_t pc, - unw_word_t fp, - unw_word_t sp) + unw_trace_cache_t *cache, + unw_word_t cfa, + unw_word_t pc, + unw_word_t fp, + unw_word_t sp) { /* First look up for previously cached information using cache as linear probing hash table with probe step of 1. Majority of @@ -441,7 +441,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) { pc -= d->use_prev_instr; Debug (2, "depth %d cfa 0x%lx pc 0x%lx sp 0x%lx fp 0x%lx\n", - depth, cfa, pc, sp, fp); + depth, cfa, pc, sp, fp); /* See if we have this address cached. If not, evaluate enough of the dwarf unwind information to fill the cache line data, or to @@ -483,7 +483,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) /* Advance standard traceable frame. */ cfa = (f->cfa_reg_sp ? sp : fp) + f->cfa_reg_offset; if (likely(f->lr_cfa_offset != -1)) - ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->lr_cfa_offset, pc); + ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->lr_cfa_offset, pc); else if (lr != 0) { /* Use the saved link register as the new pc. */ @@ -491,7 +491,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) lr = 0; } if (likely(ret >= 0) && likely(f->fp_cfa_offset != -1)) - ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->fp_cfa_offset, fp); + ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->fp_cfa_offset, fp); /* Don't bother reading SP from DWARF, CFA becomes new SP. */ sp = cfa; @@ -523,14 +523,14 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) default: /* We cannot trace through this frame, give up and tell the - caller we had to stop. Data collected so far may still be - useful to the caller, so let it know how far we got. */ + caller we had to stop. Data collected so far may still be + useful to the caller, so let it know how far we got. */ ret = -UNW_ESTOPUNWIND; break; } Debug (4, "new cfa 0x%lx pc 0x%lx sp 0x%lx fp 0x%lx\n", - cfa, pc, sp, fp); + cfa, pc, sp, fp); /* If we failed or ended up somewhere bogus, stop. */ if (unlikely(ret < 0 || pc < 0x4000)) diff --git a/src/aarch64/offsets.h b/src/aarch64/offsets.h index 81aa74f4..e78251d0 100644 --- a/src/aarch64/offsets.h +++ b/src/aarch64/offsets.h @@ -4,46 +4,46 @@ /* Offsets for AArch64 Linux "ucontext_t": */ -#define LINUX_UC_FLAGS_OFF 0x0 -#define LINUX_UC_LINK_OFF 0x8 -#define LINUX_UC_STACK_OFF 0x10 -#define LINUX_UC_SIGMASK_OFF 0x28 -#define LINUX_UC_MCONTEXT_OFF 0xb0 +#define LINUX_UC_FLAGS_OFF 0x0 +#define LINUX_UC_LINK_OFF 0x8 +#define LINUX_UC_STACK_OFF 0x10 +#define LINUX_UC_SIGMASK_OFF 0x28 +#define LINUX_UC_MCONTEXT_OFF 0xb0 /* Offsets for AArch64 Linux "struct sigcontext": */ -#define LINUX_SC_FAULTADDRESS_OFF 0x00 -#define LINUX_SC_X0_OFF 0x008 -#define LINUX_SC_X1_OFF 0x010 -#define LINUX_SC_X2_OFF 0x018 -#define LINUX_SC_X3_OFF 0x020 -#define LINUX_SC_X4_OFF 0x028 -#define LINUX_SC_X5_OFF 0x030 -#define LINUX_SC_X6_OFF 0x038 -#define LINUX_SC_X7_OFF 0x040 -#define LINUX_SC_X8_OFF 0x048 -#define LINUX_SC_X9_OFF 0x050 -#define LINUX_SC_X10_OFF 0x058 -#define LINUX_SC_X11_OFF 0x060 -#define LINUX_SC_X12_OFF 0x068 -#define LINUX_SC_X13_OFF 0x070 -#define LINUX_SC_X14_OFF 0x078 -#define LINUX_SC_X15_OFF 0x080 -#define LINUX_SC_X16_OFF 0x088 -#define LINUX_SC_X17_OFF 0x090 -#define LINUX_SC_X18_OFF 0x098 -#define LINUX_SC_X19_OFF 0x0a0 -#define LINUX_SC_X20_OFF 0x0a8 -#define LINUX_SC_X21_OFF 0x0b0 -#define LINUX_SC_X22_OFF 0x0b8 -#define LINUX_SC_X23_OFF 0x0c0 -#define LINUX_SC_X24_OFF 0x0c8 -#define LINUX_SC_X25_OFF 0x0d0 -#define LINUX_SC_X26_OFF 0x0d8 -#define LINUX_SC_X27_OFF 0x0e0 -#define LINUX_SC_X28_OFF 0x0e8 -#define LINUX_SC_X29_OFF 0x0f0 -#define LINUX_SC_X30_OFF 0x0f8 -#define LINUX_SC_SP_OFF 0x100 -#define LINUX_SC_PC_OFF 0x108 -#define LINUX_SC_PSTATE_OFF 0x110 +#define LINUX_SC_FAULTADDRESS_OFF 0x00 +#define LINUX_SC_X0_OFF 0x008 +#define LINUX_SC_X1_OFF 0x010 +#define LINUX_SC_X2_OFF 0x018 +#define LINUX_SC_X3_OFF 0x020 +#define LINUX_SC_X4_OFF 0x028 +#define LINUX_SC_X5_OFF 0x030 +#define LINUX_SC_X6_OFF 0x038 +#define LINUX_SC_X7_OFF 0x040 +#define LINUX_SC_X8_OFF 0x048 +#define LINUX_SC_X9_OFF 0x050 +#define LINUX_SC_X10_OFF 0x058 +#define LINUX_SC_X11_OFF 0x060 +#define LINUX_SC_X12_OFF 0x068 +#define LINUX_SC_X13_OFF 0x070 +#define LINUX_SC_X14_OFF 0x078 +#define LINUX_SC_X15_OFF 0x080 +#define LINUX_SC_X16_OFF 0x088 +#define LINUX_SC_X17_OFF 0x090 +#define LINUX_SC_X18_OFF 0x098 +#define LINUX_SC_X19_OFF 0x0a0 +#define LINUX_SC_X20_OFF 0x0a8 +#define LINUX_SC_X21_OFF 0x0b0 +#define LINUX_SC_X22_OFF 0x0b8 +#define LINUX_SC_X23_OFF 0x0c0 +#define LINUX_SC_X24_OFF 0x0c8 +#define LINUX_SC_X25_OFF 0x0d0 +#define LINUX_SC_X26_OFF 0x0d8 +#define LINUX_SC_X27_OFF 0x0e0 +#define LINUX_SC_X28_OFF 0x0e8 +#define LINUX_SC_X29_OFF 0x0f0 +#define LINUX_SC_X30_OFF 0x0f8 +#define LINUX_SC_SP_OFF 0x100 +#define LINUX_SC_PC_OFF 0x108 +#define LINUX_SC_PSTATE_OFF 0x110 diff --git a/src/aarch64/unwind_i.h b/src/aarch64/unwind_i.h index 2bea8f3d..79b342cd 100644 --- a/src/aarch64/unwind_i.h +++ b/src/aarch64/unwind_i.h @@ -33,19 +33,19 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" /* DWARF column numbers for AArch64: */ -#define X29 29 -#define FP 29 -#define X30 30 -#define LR 30 -#define SP 31 +#define X29 29 +#define FP 29 +#define X30 30 +#define LR 30 +#define SP 31 -#define aarch64_lock UNW_OBJ(lock) -#define aarch64_local_resume UNW_OBJ(local_resume) -#define aarch64_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define aarch64_lock UNW_OBJ(lock) +#define aarch64_local_resume UNW_OBJ(local_resume) +#define aarch64_local_addr_space_init UNW_OBJ(local_addr_space_init) extern void aarch64_local_addr_space_init (void); extern int aarch64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, - void *arg); + void *arg); /* By-pass calls to access_mem() when known to be safe. */ #ifdef UNW_LOCAL_ONLY diff --git a/src/arm/Gex_tables.c b/src/arm/Gex_tables.c index 8004fb5f..34706cf4 100644 --- a/src/arm/Gex_tables.c +++ b/src/arm/Gex_tables.c @@ -30,14 +30,14 @@ http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf #include "libunwind_i.h" -#define ARM_EXBUF_START(x) (((x) >> 4) & 0x0f) -#define ARM_EXBUF_COUNT(x) ((x) & 0x0f) -#define ARM_EXBUF_END(x) (ARM_EXBUF_START(x) + ARM_EXBUF_COUNT(x)) +#define ARM_EXBUF_START(x) (((x) >> 4) & 0x0f) +#define ARM_EXBUF_COUNT(x) ((x) & 0x0f) +#define ARM_EXBUF_END(x) (ARM_EXBUF_START(x) + ARM_EXBUF_COUNT(x)) -#define ARM_EXIDX_CANT_UNWIND 0x00000001 -#define ARM_EXIDX_COMPACT 0x80000000 +#define ARM_EXIDX_CANT_UNWIND 0x00000001 +#define ARM_EXIDX_COMPACT 0x80000000 -#define ARM_EXTBL_OP_FINISH 0xb0 +#define ARM_EXTBL_OP_FINISH 0xb0 enum arm_exbuf_cmd_flags { ARM_EXIDX_VFP_SHIFT_16 = 1 << 16, @@ -61,7 +61,7 @@ prel31_read (uint32_t prel31) static inline int prel31_to_addr (unw_addr_space_t as, void *arg, unw_word_t prel31, - unw_word_t *val) + unw_word_t *val) { unw_word_t offset; @@ -88,7 +88,7 @@ arm_exidx_apply_cmd (struct arm_exbuf_data *edata, struct dwarf_cursor *c) case ARM_EXIDX_CMD_FINISH: /* Set LR to PC if not set already. */ if (DWARF_IS_NULL_LOC (c->loc[UNW_ARM_R15])) - c->loc[UNW_ARM_R15] = c->loc[UNW_ARM_R14]; + c->loc[UNW_ARM_R15] = c->loc[UNW_ARM_R14]; /* Set IP. */ dwarf_get (c, c->loc[UNW_ARM_R15], &c->ip); break; @@ -102,15 +102,15 @@ arm_exidx_apply_cmd (struct arm_exbuf_data *edata, struct dwarf_cursor *c) break; case ARM_EXIDX_CMD_REG_POP: for (i = 0; i < 16; i++) - if (edata->data & (1 << i)) - { - Debug (2, "pop {r%d}\n", i); - c->loc[UNW_ARM_R0 + i] = DWARF_LOC (c->cfa, 0); - c->cfa += 4; - } + if (edata->data & (1 << i)) + { + Debug (2, "pop {r%d}\n", i); + c->loc[UNW_ARM_R0 + i] = DWARF_LOC (c->cfa, 0); + c->cfa += 4; + } /* Set cfa in case the SP got popped. */ if (edata->data & (1 << 13)) - dwarf_get (c, c->loc[UNW_ARM_R13], &c->cfa); + dwarf_get (c, c->loc[UNW_ARM_R13], &c->cfa); break; case ARM_EXIDX_CMD_REG_TO_SP: assert (edata->data < 16); @@ -121,20 +121,20 @@ arm_exidx_apply_cmd (struct arm_exbuf_data *edata, struct dwarf_cursor *c) case ARM_EXIDX_CMD_VFP_POP: /* Skip VFP registers, but be sure to adjust stack */ for (i = ARM_EXBUF_START (edata->data); i <= ARM_EXBUF_END (edata->data); - i++) - c->cfa += 8; + i++) + c->cfa += 8; if (!(edata->data & ARM_EXIDX_VFP_DOUBLE)) - c->cfa += 4; + c->cfa += 4; break; case ARM_EXIDX_CMD_WREG_POP: for (i = ARM_EXBUF_START (edata->data); i <= ARM_EXBUF_END (edata->data); - i++) - c->cfa += 8; + i++) + c->cfa += 8; break; case ARM_EXIDX_CMD_WCGR_POP: for (i = 0; i < 4; i++) - if (edata->data & (1 << i)) - c->cfa += 4; + if (edata->data & (1 << i)) + c->cfa += 4; break; case ARM_EXIDX_CMD_REFUSED: case ARM_EXIDX_CMD_RESERVED: @@ -163,119 +163,119 @@ arm_exidx_decode (const uint8_t *buf, uint8_t len, struct dwarf_cursor *c) { uint8_t op = READ_OP (); if ((op & 0xc0) == 0x00) - { - edata.cmd = ARM_EXIDX_CMD_DATA_POP; - edata.data = (((int)op & 0x3f) << 2) + 4; - } + { + edata.cmd = ARM_EXIDX_CMD_DATA_POP; + edata.data = (((int)op & 0x3f) << 2) + 4; + } else if ((op & 0xc0) == 0x40) - { - edata.cmd = ARM_EXIDX_CMD_DATA_PUSH; - edata.data = (((int)op & 0x3f) << 2) + 4; - } + { + edata.cmd = ARM_EXIDX_CMD_DATA_PUSH; + edata.data = (((int)op & 0x3f) << 2) + 4; + } else if ((op & 0xf0) == 0x80) - { - uint8_t op2 = READ_OP (); - if (op == 0x80 && op2 == 0x00) - edata.cmd = ARM_EXIDX_CMD_REFUSED; - else - { - edata.cmd = ARM_EXIDX_CMD_REG_POP; - edata.data = ((op & 0xf) << 8) | op2; - edata.data = edata.data << 4; - } - } + { + uint8_t op2 = READ_OP (); + if (op == 0x80 && op2 == 0x00) + edata.cmd = ARM_EXIDX_CMD_REFUSED; + else + { + edata.cmd = ARM_EXIDX_CMD_REG_POP; + edata.data = ((op & 0xf) << 8) | op2; + edata.data = edata.data << 4; + } + } else if ((op & 0xf0) == 0x90) - { - if (op == 0x9d || op == 0x9f) - edata.cmd = ARM_EXIDX_CMD_RESERVED; - else - { - edata.cmd = ARM_EXIDX_CMD_REG_TO_SP; - edata.data = op & 0x0f; - } - } + { + if (op == 0x9d || op == 0x9f) + edata.cmd = ARM_EXIDX_CMD_RESERVED; + else + { + edata.cmd = ARM_EXIDX_CMD_REG_TO_SP; + edata.data = op & 0x0f; + } + } else if ((op & 0xf0) == 0xa0) - { - unsigned end = (op & 0x07); - edata.data = (1 << (end + 1)) - 1; - edata.data = edata.data << 4; - if (op & 0x08) - edata.data |= 1 << 14; - edata.cmd = ARM_EXIDX_CMD_REG_POP; - } + { + unsigned end = (op & 0x07); + edata.data = (1 << (end + 1)) - 1; + edata.data = edata.data << 4; + if (op & 0x08) + edata.data |= 1 << 14; + edata.cmd = ARM_EXIDX_CMD_REG_POP; + } else if (op == ARM_EXTBL_OP_FINISH) - { - edata.cmd = ARM_EXIDX_CMD_FINISH; - buf = end; - } + { + edata.cmd = ARM_EXIDX_CMD_FINISH; + buf = end; + } else if (op == 0xb1) - { - uint8_t op2 = READ_OP (); - if (op2 == 0 || (op2 & 0xf0)) - edata.cmd = ARM_EXIDX_CMD_RESERVED; - else - { - edata.cmd = ARM_EXIDX_CMD_REG_POP; - edata.data = op2 & 0x0f; - } - } + { + uint8_t op2 = READ_OP (); + if (op2 == 0 || (op2 & 0xf0)) + edata.cmd = ARM_EXIDX_CMD_RESERVED; + else + { + edata.cmd = ARM_EXIDX_CMD_REG_POP; + edata.data = op2 & 0x0f; + } + } else if (op == 0xb2) - { - uint32_t offset = 0; - uint8_t byte, shift = 0; - do - { - byte = READ_OP (); - offset |= (byte & 0x7f) << shift; - shift += 7; - } - while (byte & 0x80); - edata.data = offset * 4 + 0x204; - edata.cmd = ARM_EXIDX_CMD_DATA_POP; - } + { + uint32_t offset = 0; + uint8_t byte, shift = 0; + do + { + byte = READ_OP (); + offset |= (byte & 0x7f) << shift; + shift += 7; + } + while (byte & 0x80); + edata.data = offset * 4 + 0x204; + edata.cmd = ARM_EXIDX_CMD_DATA_POP; + } else if (op == 0xb3 || op == 0xc8 || op == 0xc9) - { - edata.cmd = ARM_EXIDX_CMD_VFP_POP; - edata.data = READ_OP (); - if (op == 0xc8) - edata.data |= ARM_EXIDX_VFP_SHIFT_16; - if (op != 0xb3) - edata.data |= ARM_EXIDX_VFP_DOUBLE; - } + { + edata.cmd = ARM_EXIDX_CMD_VFP_POP; + edata.data = READ_OP (); + if (op == 0xc8) + edata.data |= ARM_EXIDX_VFP_SHIFT_16; + if (op != 0xb3) + edata.data |= ARM_EXIDX_VFP_DOUBLE; + } else if ((op & 0xf8) == 0xb8 || (op & 0xf8) == 0xd0) - { - edata.cmd = ARM_EXIDX_CMD_VFP_POP; - edata.data = 0x80 | (op & 0x07); - if ((op & 0xf8) == 0xd0) - edata.data |= ARM_EXIDX_VFP_DOUBLE; - } + { + edata.cmd = ARM_EXIDX_CMD_VFP_POP; + edata.data = 0x80 | (op & 0x07); + if ((op & 0xf8) == 0xd0) + edata.data |= ARM_EXIDX_VFP_DOUBLE; + } else if (op >= 0xc0 && op <= 0xc5) - { - edata.cmd = ARM_EXIDX_CMD_WREG_POP; - edata.data = 0xa0 | (op & 0x07); - } + { + edata.cmd = ARM_EXIDX_CMD_WREG_POP; + edata.data = 0xa0 | (op & 0x07); + } else if (op == 0xc6) - { - edata.cmd = ARM_EXIDX_CMD_WREG_POP; - edata.data = READ_OP (); - } + { + edata.cmd = ARM_EXIDX_CMD_WREG_POP; + edata.data = READ_OP (); + } else if (op == 0xc7) - { - uint8_t op2 = READ_OP (); - if (op2 == 0 || (op2 & 0xf0)) - edata.cmd = ARM_EXIDX_CMD_RESERVED; - else - { - edata.cmd = ARM_EXIDX_CMD_WCGR_POP; - edata.data = op2 & 0x0f; - } - } + { + uint8_t op2 = READ_OP (); + if (op2 == 0 || (op2 & 0xf0)) + edata.cmd = ARM_EXIDX_CMD_RESERVED; + else + { + edata.cmd = ARM_EXIDX_CMD_WCGR_POP; + edata.data = op2 & 0x0f; + } + } else - edata.cmd = ARM_EXIDX_CMD_RESERVED; + edata.cmd = ARM_EXIDX_CMD_RESERVED; ret = arm_exidx_apply_cmd (&edata, c); if (ret < 0) - return ret; + return ret; } return 0; } @@ -299,7 +299,7 @@ arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf) * if set to 0x1: the function cannot be unwound (EXIDX_CANTUNWIND) * if bit 31 is one: this is a table entry itself (ARM_EXIDX_COMPACT) * if bit 31 is zero: this is a prel31 offset of the start of the - table entry for this function */ + table entry for this function */ if (prel31_to_addr(c->as, c->as_arg, entry, &addr) < 0) return -UNW_EINVAL; @@ -314,7 +314,7 @@ arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf) else if (data & ARM_EXIDX_COMPACT) { Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, - (data >> 24) & 0x7f, data); + (data >> 24) & 0x7f, data); buf[nbuf++] = data >> 16; buf[nbuf++] = data >> 8; buf[nbuf++] = data; @@ -328,51 +328,51 @@ arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf) return -UNW_EINVAL; if ((*c->as->acc.access_mem)(c->as, extbl_data, &data, 0, c->as_arg) < 0) - return -UNW_EINVAL; + return -UNW_EINVAL; if (data & ARM_EXIDX_COMPACT) - { - int pers = (data >> 24) & 0x0f; - Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, pers, data); - if (pers == 1 || pers == 2) - { - n_table_words = (data >> 16) & 0xff; - extbl_data += 4; - } - else - buf[nbuf++] = data >> 16; - buf[nbuf++] = data >> 8; - buf[nbuf++] = data; - } + { + int pers = (data >> 24) & 0x0f; + Debug (2, "%p compact model %d [%8.8x]\n", (void *)addr, pers, data); + if (pers == 1 || pers == 2) + { + n_table_words = (data >> 16) & 0xff; + extbl_data += 4; + } + else + buf[nbuf++] = data >> 16; + buf[nbuf++] = data >> 8; + buf[nbuf++] = data; + } else - { - unw_word_t pers; - if (prel31_to_addr (c->as, c->as_arg, extbl_data, &pers) < 0) - return -UNW_EINVAL; - Debug (2, "%p Personality routine: %8p\n", (void *)addr, - (void *)pers); - if ((*c->as->acc.access_mem)(c->as, extbl_data + 4, &data, 0, - c->as_arg) < 0) - return -UNW_EINVAL; - n_table_words = data >> 24; - buf[nbuf++] = data >> 16; - buf[nbuf++] = data >> 8; - buf[nbuf++] = data; - extbl_data += 8; - } + { + unw_word_t pers; + if (prel31_to_addr (c->as, c->as_arg, extbl_data, &pers) < 0) + return -UNW_EINVAL; + Debug (2, "%p Personality routine: %8p\n", (void *)addr, + (void *)pers); + if ((*c->as->acc.access_mem)(c->as, extbl_data + 4, &data, 0, + c->as_arg) < 0) + return -UNW_EINVAL; + n_table_words = data >> 24; + buf[nbuf++] = data >> 16; + buf[nbuf++] = data >> 8; + buf[nbuf++] = data; + extbl_data += 8; + } assert (n_table_words <= 5); unsigned j; for (j = 0; j < n_table_words; j++) - { - if ((*c->as->acc.access_mem)(c->as, extbl_data, &data, 0, - c->as_arg) < 0) - return -UNW_EINVAL; - extbl_data += 4; - buf[nbuf++] = data >> 24; - buf[nbuf++] = data >> 16; - buf[nbuf++] = data >> 8; - buf[nbuf++] = data >> 0; - } + { + if ((*c->as->acc.access_mem)(c->as, extbl_data, &data, 0, + c->as_arg) < 0) + return -UNW_EINVAL; + extbl_data += 4; + buf[nbuf++] = data >> 24; + buf[nbuf++] = data >> 16; + buf[nbuf++] = data >> 8; + buf[nbuf++] = data >> 0; + } } if (nbuf > 0 && buf[nbuf - 1] != ARM_EXTBL_OP_FINISH) @@ -383,71 +383,71 @@ arm_exidx_extract (struct dwarf_cursor *c, uint8_t *buf) PROTECTED int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg) + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg) { if (UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX) && di->format == UNW_INFO_FORMAT_ARM_EXIDX) { /* The .ARM.exidx section contains a sorted list of key-value pairs - - the unwind entries. The 'key' is a prel31 offset to the start of a - function. We binary search this section in order to find the - appropriate unwind entry. */ + the unwind entries. The 'key' is a prel31 offset to the start of a + function. We binary search this section in order to find the + appropriate unwind entry. */ unw_word_t first = di->u.rti.table_data; unw_word_t last = di->u.rti.table_data + di->u.rti.table_len - 8; unw_word_t entry, val; if (prel31_to_addr (as, arg, first, &val) < 0 || ip < val) - return -UNW_ENOINFO; + return -UNW_ENOINFO; if (prel31_to_addr (as, arg, last, &val) < 0) - return -UNW_EINVAL; + return -UNW_EINVAL; if (ip >= val) - { - entry = last; + { + entry = last; - if (prel31_to_addr (as, arg, last, &pi->start_ip) < 0) - return -UNW_EINVAL; + if (prel31_to_addr (as, arg, last, &pi->start_ip) < 0) + return -UNW_EINVAL; - pi->end_ip = di->end_ip -1; - } + pi->end_ip = di->end_ip -1; + } else - { - while (first < last - 8) - { - entry = first + (((last - first) / 8 + 1) >> 1) * 8; + { + while (first < last - 8) + { + entry = first + (((last - first) / 8 + 1) >> 1) * 8; - if (prel31_to_addr (as, arg, entry, &val) < 0) - return -UNW_EINVAL; + if (prel31_to_addr (as, arg, entry, &val) < 0) + return -UNW_EINVAL; - if (ip < val) - last = entry; - else - first = entry; - } + if (ip < val) + last = entry; + else + first = entry; + } - entry = first; + entry = first; - if (prel31_to_addr (as, arg, entry, &pi->start_ip) < 0) - return -UNW_EINVAL; + if (prel31_to_addr (as, arg, entry, &pi->start_ip) < 0) + return -UNW_EINVAL; - if (prel31_to_addr (as, arg, entry + 8, &pi->end_ip) < 0) - return -UNW_EINVAL; + if (prel31_to_addr (as, arg, entry + 8, &pi->end_ip) < 0) + return -UNW_EINVAL; - pi->end_ip--; - } + pi->end_ip--; + } if (need_unwind_info) - { - pi->unwind_info_size = 8; - pi->unwind_info = (void *) entry; - pi->format = UNW_INFO_FORMAT_ARM_EXIDX; - } + { + pi->unwind_info_size = 8; + pi->unwind_info = (void *) entry; + pi->format = UNW_INFO_FORMAT_ARM_EXIDX; + } return 0; } else if (UNW_TRY_METHOD(UNW_ARM_METHOD_DWARF) - && di->format != UNW_INFO_FORMAT_ARM_EXIDX) + && di->format != UNW_INFO_FORMAT_ARM_EXIDX) return dwarf_search_unwind_table (as, ip, di, pi, need_unwind_info, arg); return -UNW_ENOINFO; @@ -469,20 +469,20 @@ arm_phdr_cb (struct dl_phdr_info *info, size_t size, void *data) for (n = info->dlpi_phnum; --n >= 0; phdr++) { switch (phdr->p_type) - { - case PT_LOAD: - if (cb_data->ip >= phdr->p_vaddr + info->dlpi_addr && - cb_data->ip < phdr->p_vaddr + info->dlpi_addr + phdr->p_memsz) - p_text = phdr; - break; + { + case PT_LOAD: + if (cb_data->ip >= phdr->p_vaddr + info->dlpi_addr && + cb_data->ip < phdr->p_vaddr + info->dlpi_addr + phdr->p_memsz) + p_text = phdr; + break; - case PT_ARM_EXIDX: - p_arm_exidx = phdr; - break; + case PT_ARM_EXIDX: + p_arm_exidx = phdr; + break; - default: - break; - } + default: + break; + } } if (p_text && p_arm_exidx) @@ -501,7 +501,7 @@ arm_phdr_cb (struct dl_phdr_info *info, size_t size, void *data) HIDDEN int arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, int need_unwind_info, void *arg) + unw_proc_info_t *pi, int need_unwind_info, void *arg) { int ret = -1; intrmask_t saved_mask; @@ -524,14 +524,14 @@ arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); if (cb_data.single_fde) - /* already got the result in *pi */ - return 0; + /* already got the result in *pi */ + return 0; if (cb_data.di_debug.format != -1) - ret = tdep_search_unwind_table (as, ip, &cb_data.di_debug, pi, - need_unwind_info, arg); + ret = tdep_search_unwind_table (as, ip, &cb_data.di_debug, pi, + need_unwind_info, arg); else - ret = -UNW_ENOINFO; + ret = -UNW_ENOINFO; } if (ret < 0 && UNW_TRY_METHOD (UNW_ARM_METHOD_EXIDX)) @@ -548,10 +548,10 @@ arm_find_proc_info (unw_addr_space_t as, unw_word_t ip, SIGPROCMASK (SIG_SETMASK, &saved_mask, NULL); if (cb_data.di.format != -1) - ret = tdep_search_unwind_table (as, ip, &cb_data.di, pi, - need_unwind_info, arg); + ret = tdep_search_unwind_table (as, ip, &cb_data.di, pi, + need_unwind_info, arg); else - ret = -UNW_ENOINFO; + ret = -UNW_ENOINFO; } if (ret < 0) diff --git a/src/arm/Gget_save_loc.c b/src/arm/Gget_save_loc.c index 151ba0f9..63b711d8 100644 --- a/src/arm/Gget_save_loc.c +++ b/src/arm/Gget_save_loc.c @@ -30,7 +30,7 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) struct cursor *c = (struct cursor *) cursor; dwarf_loc_t loc; - loc = DWARF_NULL_LOC; /* default to "not saved" */ + loc = DWARF_NULL_LOC; /* default to "not saved" */ switch (reg) { diff --git a/src/arm/Gglobal.c b/src/arm/Gglobal.c index b3d3a6d8..7b93fbd8 100644 --- a/src/arm/Gglobal.c +++ b/src/arm/Gglobal.c @@ -58,7 +58,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY arm_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&arm_lock, saved_mask); diff --git a/src/arm/Ginit.c b/src/arm/Ginit.c index b6fabca6..3484cb5d 100644 --- a/src/arm/Ginit.c +++ b/src/arm/Ginit.c @@ -66,7 +66,7 @@ HIDDEN unw_dyn_info_list_t _U_dyn_info_list; static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; return 0; @@ -74,7 +74,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (write) { @@ -91,7 +91,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, - void *arg) + void *arg) { unw_word_t *addr; unw_tdep_context_t *uc = arg; @@ -122,7 +122,7 @@ Debug (16, "reg = %s\n", unw_regname (reg)); static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { unw_tdep_context_t *uc = arg; unw_fpreg_t *addr; @@ -136,14 +136,14 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, if (write) { Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); *(unw_fpreg_t *) addr = *val; } else { *val = *(unw_fpreg_t *) addr; Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); } return 0; @@ -155,8 +155,8 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); } diff --git a/src/arm/Gregs.c b/src/arm/Gregs.c index 03693a27..688771f3 100644 --- a/src/arm/Gregs.c +++ b/src/arm/Gregs.c @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { dwarf_loc_t loc = DWARF_NULL_LOC; @@ -74,7 +74,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, - int write) + int write) { Debug (1, "bad register number %u\n", reg); return -UNW_EBADREG; diff --git a/src/arm/Gresume.c b/src/arm/Gresume.c index 2e5e9fdd..9fe264ea 100644 --- a/src/arm/Gresume.c +++ b/src/arm/Gresume.c @@ -39,7 +39,7 @@ arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) if (c->sigcontext_format == ARM_SCF_NONE) { /* Since there are no signals involved here we restore the non scratch - registers only. */ + registers only. */ unsigned long regs[10]; regs[0] = uc->regs[4]; regs[1] = uc->regs[5]; @@ -53,21 +53,21 @@ arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) regs[9] = uc->regs[14]; /* LR */ struct regs_overlay { - char x[sizeof(regs)]; + char x[sizeof(regs)]; }; asm __volatile__ ( - "ldmia %0, {r4-r12, lr}\n" - "mov sp, r12\n" - "bx lr\n" - : : "r" (regs), - "m" (*(struct regs_overlay *)regs) + "ldmia %0, {r4-r12, lr}\n" + "mov sp, r12\n" + "bx lr\n" + : : "r" (regs), + "m" (*(struct regs_overlay *)regs) ); } else { /* In case a signal frame is involved, we're using its trampoline which - calls sigreturn. */ + calls sigreturn. */ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; sc->arm_r0 = uc->regs[0]; sc->arm_r1 = uc->regs[1]; @@ -89,11 +89,11 @@ arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) sc->arm_cpsr &= 0xf9ff03ffUL; /* Set the SP and the PC in order to continue execution at the modified - trampoline which restores the signal mask and the registers. */ + trampoline which restores the signal mask and the registers. */ asm __volatile__ ( - "mov sp, %0\n" - "bx %1\n" - : : "r" (c->sigcontext_sp), "r" (c->sigcontext_pc) + "mov sp, %0\n" + "bx %1\n" + : : "r" (c->sigcontext_sp), "r" (c->sigcontext_pc) ); } unreachable(); @@ -120,15 +120,15 @@ establish_machine_state (struct cursor *c) { Debug (16, "copying %s %d\n", unw_regname (reg), reg); if (unw_is_fpreg (reg)) - { - if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) - as->acc.access_fpreg (as, reg, &fpval, 1, arg); - } + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + as->acc.access_fpreg (as, reg, &fpval, 1, arg); + } else - { - if (tdep_access_reg (c, reg, &val, 0) >= 0) - as->acc.access_reg (as, reg, &val, 1, arg); - } + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + as->acc.access_reg (as, reg, &val, 1, arg); + } } } @@ -142,7 +142,7 @@ unw_resume (unw_cursor_t *cursor) if (!c->dwarf.ip) { /* This can happen easily when the frame-chain gets truncated - due to bad or missing unwind-info. */ + due to bad or missing unwind-info. */ Debug (1, "refusing to resume execution at address 0\n"); return -UNW_EINVAL; } @@ -150,5 +150,5 @@ unw_resume (unw_cursor_t *cursor) establish_machine_state (c); return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, - c->dwarf.as_arg); + c->dwarf.as_arg); } diff --git a/src/arm/Gstash_frame.c b/src/arm/Gstash_frame.c index c5fe2dfc..2cce409d 100644 --- a/src/arm/Gstash_frame.c +++ b/src/arm/Gstash_frame.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY Copyright (C) 2014 CERN and Aalto University - Contributed by Filip Nyback + Contributed by Filip Nyback This file is part of libunwind. @@ -33,16 +33,16 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs) unw_tdep_frame_t *f = &c->frame_info; Debug (4, "ip=0x%x cfa=0x%x type %d cfa [where=%d val=%d] cfaoff=%d" - " ra=0x%x r7 [where=%d val=%d @0x%x] lr [where=%d val=%d @0x%x] " - "sp [where=%d val=%d @0x%x]\n", - d->ip, d->cfa, f->frame_type, - rs->reg[DWARF_CFA_REG_COLUMN].where, - rs->reg[DWARF_CFA_REG_COLUMN].val, - rs->reg[DWARF_CFA_OFF_COLUMN].val, - DWARF_GET_LOC(d->loc[d->ret_addr_column]), - rs->reg[R7].where, rs->reg[R7].val, DWARF_GET_LOC(d->loc[R7]), - rs->reg[LR].where, rs->reg[LR].val, DWARF_GET_LOC(d->loc[LR]), - rs->reg[SP].where, rs->reg[SP].val, DWARF_GET_LOC(d->loc[SP])); + " ra=0x%x r7 [where=%d val=%d @0x%x] lr [where=%d val=%d @0x%x] " + "sp [where=%d val=%d @0x%x]\n", + d->ip, d->cfa, f->frame_type, + rs->reg[DWARF_CFA_REG_COLUMN].where, + rs->reg[DWARF_CFA_REG_COLUMN].val, + rs->reg[DWARF_CFA_OFF_COLUMN].val, + DWARF_GET_LOC(d->loc[d->ret_addr_column]), + rs->reg[R7].where, rs->reg[R7].val, DWARF_GET_LOC(d->loc[R7]), + rs->reg[LR].where, rs->reg[LR].val, DWARF_GET_LOC(d->loc[LR]), + rs->reg[SP].where, rs->reg[SP].val, DWARF_GET_LOC(d->loc[SP])); /* A standard frame is defined as: - CFA is register-relative offset off R7 or SP; @@ -53,24 +53,24 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs) if (f->frame_type == UNW_ARM_FRAME_OTHER && (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG) && (rs->reg[DWARF_CFA_REG_COLUMN].val == R7 - || rs->reg[DWARF_CFA_REG_COLUMN].val == SP) + || rs->reg[DWARF_CFA_REG_COLUMN].val == SP) && labs(rs->reg[DWARF_CFA_OFF_COLUMN].val) < (1 << 29) && d->ret_addr_column == LR && (rs->reg[R7].where == DWARF_WHERE_UNDEF - || rs->reg[R7].where == DWARF_WHERE_SAME - || (rs->reg[R7].where == DWARF_WHERE_CFAREL - && labs(rs->reg[R7].val) < (1 << 29) - && rs->reg[R7].val+1 != 0)) + || rs->reg[R7].where == DWARF_WHERE_SAME + || (rs->reg[R7].where == DWARF_WHERE_CFAREL + && labs(rs->reg[R7].val) < (1 << 29) + && rs->reg[R7].val+1 != 0)) && (rs->reg[LR].where == DWARF_WHERE_UNDEF - || rs->reg[LR].where == DWARF_WHERE_SAME - || (rs->reg[LR].where == DWARF_WHERE_CFAREL - && labs(rs->reg[LR].val) < (1 << 29) - && rs->reg[LR].val+1 != 0)) + || rs->reg[LR].where == DWARF_WHERE_SAME + || (rs->reg[LR].where == DWARF_WHERE_CFAREL + && labs(rs->reg[LR].val) < (1 << 29) + && rs->reg[LR].val+1 != 0)) && (rs->reg[SP].where == DWARF_WHERE_UNDEF - || rs->reg[SP].where == DWARF_WHERE_SAME - || (rs->reg[SP].where == DWARF_WHERE_CFAREL - && labs(rs->reg[SP].val) < (1 << 29) - && rs->reg[SP].val+1 != 0))) + || rs->reg[SP].where == DWARF_WHERE_SAME + || (rs->reg[SP].where == DWARF_WHERE_CFAREL + && labs(rs->reg[SP].val) < (1 << 29) + && rs->reg[SP].val+1 != 0))) { /* Save information for a standard frame. */ f->frame_type = UNW_ARM_FRAME_STANDARD; diff --git a/src/arm/Gstep.c b/src/arm/Gstep.c index 71965835..79f2dd22 100644 --- a/src/arm/Gstep.c +++ b/src/arm/Gstep.c @@ -30,7 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include -#define arm_exidx_step UNW_OBJ(arm_exidx_step) +#define arm_exidx_step UNW_OBJ(arm_exidx_step) static inline int arm_exidx_step (struct cursor *c) @@ -64,7 +64,7 @@ arm_exidx_step (struct cursor *c) if (c->dwarf.ip == old_ip && c->dwarf.cfa == old_cfa) { Dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n", - __FUNCTION__, (long) c->dwarf.ip); + __FUNCTION__, (long) c->dwarf.ip); return -UNW_EBADFRAME; } @@ -103,32 +103,32 @@ unw_handle_signal_frame (unw_cursor_t *cursor) if (ret == 1) { /* Handle non-RT signal frames. Check if the first word on the stack - is the magic number. */ + is the magic number. */ if (sp == 0x5ac3c35a) - { - c->sigcontext_format = ARM_SCF_LINUX_SIGFRAME; - sc_addr = sp_addr + LINUX_UC_MCONTEXT_OFF; - } + { + c->sigcontext_format = ARM_SCF_LINUX_SIGFRAME; + sc_addr = sp_addr + LINUX_UC_MCONTEXT_OFF; + } else - { - c->sigcontext_format = ARM_SCF_LINUX_OLD_SIGFRAME; - sc_addr = sp_addr; - } + { + c->sigcontext_format = ARM_SCF_LINUX_OLD_SIGFRAME; + sc_addr = sp_addr; + } } else if (ret == 2) { /* Handle RT signal frames. Check if the first word on the stack is a - pointer to the siginfo structure. */ + pointer to the siginfo structure. */ if (sp == sp_addr + 8) - { - c->sigcontext_format = ARM_SCF_LINUX_OLD_RT_SIGFRAME; - sc_addr = sp_addr + 8 + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF; - } + { + c->sigcontext_format = ARM_SCF_LINUX_OLD_RT_SIGFRAME; + sc_addr = sp_addr + 8 + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF; + } else - { - c->sigcontext_format = ARM_SCF_LINUX_RT_SIGFRAME; - sc_addr = sp_addr + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF; - } + { + c->sigcontext_format = ARM_SCF_LINUX_RT_SIGFRAME; + sc_addr = sp_addr + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF; + } } else return -UNW_EUNSPEC; @@ -186,9 +186,9 @@ unw_step (unw_cursor_t *cursor) Debug(1, "dwarf_step()=%d\n", ret); if (likely (ret > 0)) - return 1; + return 1; else if (unlikely (ret == -UNW_ESTOPUNWIND)) - return ret; + return ret; if (ret < 0 && ret != -UNW_ENOINFO) { @@ -203,9 +203,9 @@ unw_step (unw_cursor_t *cursor) { ret = arm_exidx_step (c); if (ret > 0) - return 1; + return 1; if (ret == -UNW_ESTOPUNWIND || ret == 0) - return ret; + return ret; } /* Fall back on APCS frame parsing. diff --git a/src/arm/Gtrace.c b/src/arm/Gtrace.c index 999a8739..135563a3 100644 --- a/src/arm/Gtrace.c +++ b/src/arm/Gtrace.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY Copyright (C) 2014 CERN and Aalto University - Contributed by Filip Nyback + Contributed by Filip Nyback This file is part of libunwind. @@ -43,7 +43,7 @@ typedef struct size_t log_size; size_t used; size_t dtor_count; /* Counts how many times our destructor has already - been called. */ + been called. */ } unw_trace_cache_t; static const unw_tdep_frame_t empty_frame = { 0, UNW_ARM_FRAME_OTHER, -1, -1, 0, -1, -1, -1 }; @@ -65,7 +65,7 @@ trace_cache_free (void *arg) /* Not yet our turn to get destroyed. Re-install ourselves into the key. */ pthread_setspecific(trace_cache_key, cache); Debug(5, "delayed freeing cache %p (%zx to go)\n", cache, - PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count); + PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count); return; } tls_cache_destroyed = 1; @@ -111,7 +111,7 @@ trace_cache_create (void) /* The current thread is in the process of exiting. Don't recreate cache, as we wouldn't have another chance to free it. */ Debug(5, "refusing to reallocate cache: " - "thread-locals are being deallocated\n"); + "thread-locals are being deallocated\n"); return NULL; } @@ -215,11 +215,11 @@ trace_cache_get (void) highly unusual unwind info which uses these creatively. */ static unw_tdep_frame_t * trace_init_addr (unw_tdep_frame_t *f, - unw_cursor_t *cursor, - unw_word_t cfa, - unw_word_t pc, - unw_word_t r7, - unw_word_t sp) + unw_cursor_t *cursor, + unw_word_t cfa, + unw_word_t pc, + unw_word_t r7, + unw_word_t sp) { struct cursor *c = (struct cursor *) cursor; struct dwarf_cursor *d = &c->dwarf; @@ -262,9 +262,9 @@ trace_init_addr (unw_tdep_frame_t *f, f->last_frame = -1; Debug (3, "frame va %x type %d last %d cfa %s+%d r7 @ cfa%+d lr @ cfa%+d sp @ cfa%+d\n", - f->virtual_address, f->frame_type, f->last_frame, - f->cfa_reg_sp ? "sp" : "r7", f->cfa_reg_offset, - f->r7_cfa_offset, f->lr_cfa_offset, f->sp_cfa_offset); + f->virtual_address, f->frame_type, f->last_frame, + f->cfa_reg_sp ? "sp" : "r7", f->cfa_reg_offset, + f->r7_cfa_offset, f->lr_cfa_offset, f->sp_cfa_offset); return f; } @@ -275,11 +275,11 @@ trace_init_addr (unw_tdep_frame_t *f, frame cache slot which describes RIP. */ static unw_tdep_frame_t * trace_lookup (unw_cursor_t *cursor, - unw_trace_cache_t *cache, - unw_word_t cfa, - unw_word_t pc, - unw_word_t r7, - unw_word_t sp) + unw_trace_cache_t *cache, + unw_word_t cfa, + unw_word_t pc, + unw_word_t r7, + unw_word_t sp) { /* First look up for previously cached information using cache as linear probing hash table with probe step of 1. Majority of @@ -442,7 +442,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) { pc -= d->use_prev_instr; Debug (2, "depth %d cfa 0x%x pc 0x%x sp 0x%x r7 0x%x\n", - depth, cfa, pc, sp, r7); + depth, cfa, pc, sp, r7); /* See if we have this address cached. If not, evaluate enough of the dwarf unwind information to fill the cache line data, or to @@ -484,7 +484,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) /* Advance standard traceable frame. */ cfa = (f->cfa_reg_sp ? sp : r7) + f->cfa_reg_offset; if (likely(f->lr_cfa_offset != -1)) - ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->lr_cfa_offset, pc); + ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->lr_cfa_offset, pc); else if (lr != 0) { /* Use the saved link register as the new pc. */ @@ -492,7 +492,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) lr = 0; } if (likely(ret >= 0) && likely(f->r7_cfa_offset != -1)) - ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->r7_cfa_offset, r7); + ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->r7_cfa_offset, r7); /* Don't bother reading SP from DWARF, CFA becomes new SP. */ sp = cfa; @@ -524,14 +524,14 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) default: /* We cannot trace through this frame, give up and tell the - caller we had to stop. Data collected so far may still be - useful to the caller, so let it know how far we got. */ + caller we had to stop. Data collected so far may still be + useful to the caller, so let it know how far we got. */ ret = -UNW_ESTOPUNWIND; break; } Debug (4, "new cfa 0x%x pc 0x%x sp 0x%x r7 0x%x\n", - cfa, pc, sp, r7); + cfa, pc, sp, r7); /* If we failed or ended up somewhere bogus, stop. */ if (unlikely(ret < 0 || pc < 0x4000)) diff --git a/src/arm/init.h b/src/arm/init.h index 676c3407..6379d8ec 100644 --- a/src/arm/init.h +++ b/src/arm/init.h @@ -54,7 +54,7 @@ common_init (struct cursor *c, unsigned use_prev_instr) /* FIXME: correct for ARM? */ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_ARM_R13), - &c->dwarf.cfa); + &c->dwarf.cfa); if (ret < 0) return ret; diff --git a/src/arm/is_fpreg.c b/src/arm/is_fpreg.c index d8b17ae7..3b36a03d 100644 --- a/src/arm/is_fpreg.c +++ b/src/arm/is_fpreg.c @@ -31,9 +31,9 @@ PROTECTED int unw_is_fpreg (int regnum) { return ((regnum >= UNW_ARM_S0 && regnum <= UNW_ARM_S31) - || (regnum >= UNW_ARM_F0 && regnum <= UNW_ARM_F7) - || (regnum >= UNW_ARM_wCGR0 && regnum <= UNW_ARM_wCGR7) - || (regnum >= UNW_ARM_wR0 && regnum <= UNW_ARM_wR15) - || (regnum >= UNW_ARM_wC0 && regnum <= UNW_ARM_wC7) - || (regnum >= UNW_ARM_D0 && regnum <= UNW_ARM_D31)); + || (regnum >= UNW_ARM_F0 && regnum <= UNW_ARM_F7) + || (regnum >= UNW_ARM_wCGR0 && regnum <= UNW_ARM_wCGR7) + || (regnum >= UNW_ARM_wR0 && regnum <= UNW_ARM_wR15) + || (regnum >= UNW_ARM_wC0 && regnum <= UNW_ARM_wC7) + || (regnum >= UNW_ARM_D0 && regnum <= UNW_ARM_D31)); } diff --git a/src/arm/offsets.h b/src/arm/offsets.h index 0593685c..a63847be 100644 --- a/src/arm/offsets.h +++ b/src/arm/offsets.h @@ -4,33 +4,33 @@ /* Offsets for ARM Linux "ucontext_t": */ -#define LINUX_UC_FLAGS_OFF 0x00 -#define LINUX_UC_LINK_OFF 0x04 -#define LINUX_UC_STACK_OFF 0x08 -#define LINUX_UC_MCONTEXT_OFF 0x14 -#define LINUX_UC_SIGMASK_OFF 0x68 -#define LINUX_UC_REGSPACE_OFF 0xE8 +#define LINUX_UC_FLAGS_OFF 0x00 +#define LINUX_UC_LINK_OFF 0x04 +#define LINUX_UC_STACK_OFF 0x08 +#define LINUX_UC_MCONTEXT_OFF 0x14 +#define LINUX_UC_SIGMASK_OFF 0x68 +#define LINUX_UC_REGSPACE_OFF 0xE8 /* Offsets for ARM Linux "struct sigcontext": */ -#define LINUX_SC_TRAPNO_OFF 0x00 -#define LINUX_SC_ERRORCODE_OFF 0x04 -#define LINUX_SC_OLDMASK_OFF 0x08 -#define LINUX_SC_R0_OFF 0x0C -#define LINUX_SC_R1_OFF 0x10 -#define LINUX_SC_R2_OFF 0x14 -#define LINUX_SC_R3_OFF 0x18 -#define LINUX_SC_R4_OFF 0x1C -#define LINUX_SC_R5_OFF 0x20 -#define LINUX_SC_R6_OFF 0x24 -#define LINUX_SC_R7_OFF 0x28 -#define LINUX_SC_R8_OFF 0x2C -#define LINUX_SC_R9_OFF 0x30 -#define LINUX_SC_R10_OFF 0x34 -#define LINUX_SC_FP_OFF 0x38 -#define LINUX_SC_IP_OFF 0x3C -#define LINUX_SC_SP_OFF 0x40 -#define LINUX_SC_LR_OFF 0x44 -#define LINUX_SC_PC_OFF 0x48 -#define LINUX_SC_CPSR_OFF 0x4C -#define LINUX_SC_FAULTADDR_OFF 0x50 +#define LINUX_SC_TRAPNO_OFF 0x00 +#define LINUX_SC_ERRORCODE_OFF 0x04 +#define LINUX_SC_OLDMASK_OFF 0x08 +#define LINUX_SC_R0_OFF 0x0C +#define LINUX_SC_R1_OFF 0x10 +#define LINUX_SC_R2_OFF 0x14 +#define LINUX_SC_R3_OFF 0x18 +#define LINUX_SC_R4_OFF 0x1C +#define LINUX_SC_R5_OFF 0x20 +#define LINUX_SC_R6_OFF 0x24 +#define LINUX_SC_R7_OFF 0x28 +#define LINUX_SC_R8_OFF 0x2C +#define LINUX_SC_R9_OFF 0x30 +#define LINUX_SC_R10_OFF 0x34 +#define LINUX_SC_FP_OFF 0x38 +#define LINUX_SC_IP_OFF 0x3C +#define LINUX_SC_SP_OFF 0x40 +#define LINUX_SC_LR_OFF 0x44 +#define LINUX_SC_PC_OFF 0x48 +#define LINUX_SC_CPSR_OFF 0x4C +#define LINUX_SC_FAULTADDR_OFF 0x50 diff --git a/src/arm/unwind_i.h b/src/arm/unwind_i.h index 1ed333e3..4dabf217 100644 --- a/src/arm/unwind_i.h +++ b/src/arm/unwind_i.h @@ -32,18 +32,18 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" /* DWARF column numbers for ARM: */ -#define R7 7 -#define SP 13 -#define LR 14 -#define PC 15 +#define R7 7 +#define SP 13 +#define LR 14 +#define PC 15 -#define arm_lock UNW_OBJ(lock) -#define arm_local_resume UNW_OBJ(local_resume) -#define arm_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define arm_lock UNW_OBJ(lock) +#define arm_local_resume UNW_OBJ(local_resume) +#define arm_local_addr_space_init UNW_OBJ(local_addr_space_init) extern void arm_local_addr_space_init (void); extern int arm_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, - void *arg); + void *arg); /* By-pass calls to access_mem() when known to be safe. */ #ifdef UNW_LOCAL_ONLY # undef ACCESS_MEM_FAST diff --git a/src/coredump/_UCD_access_mem.c b/src/coredump/_UCD_access_mem.c index 62d41832..1fdbd128 100644 --- a/src/coredump/_UCD_access_mem.c +++ b/src/coredump/_UCD_access_mem.c @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ int _UCD_access_mem(unw_addr_space_t as, unw_word_t addr, unw_word_t *val, - int write, void *arg) + int write, void *arg) { if (write) { @@ -43,9 +43,9 @@ _UCD_access_mem(unw_addr_space_t as, unw_word_t addr, unw_word_t *val, { phdr = &ui->phdrs[i]; if (phdr->p_vaddr <= addr && addr_last < phdr->p_vaddr + phdr->p_memsz) - { - goto found; - } + { + goto found; + } } Debug(1, "addr 0x%llx is unmapped\n", (unsigned long long)addr); return -UNW_EINVAL; @@ -62,8 +62,8 @@ _UCD_access_mem(unw_addr_space_t as, unw_word_t addr, unw_word_t *val, if (phdr->backing_fd < 0) { Debug(1, "access to not-present data in phdr[%d]: addr:0x%llx\n", - i, (unsigned long long)addr - ); + i, (unsigned long long)addr + ); return -UNW_EINVAL; } filename = phdr->backing_filename; @@ -82,17 +82,17 @@ _UCD_access_mem(unw_addr_space_t as, unw_word_t addr, unw_word_t *val, goto read_error; Debug(1, "0x%llx <- [addr:0x%llx fileofs:0x%llx]\n", - (unsigned long long)(*val), - (unsigned long long)addr, - (unsigned long long)fileofs + (unsigned long long)(*val), + (unsigned long long)addr, + (unsigned long long)fileofs ); return 0; read_error: Debug(1, "access out of file: addr:0x%llx fileofs:%llx file:'%s'\n", - (unsigned long long)addr, - (unsigned long long)fileofs, - filename + (unsigned long long)addr, + (unsigned long long)fileofs, + filename ); return -UNW_EINVAL; } diff --git a/src/coredump/_UCD_access_reg_linux.c b/src/coredump/_UCD_access_reg_linux.c index 4c1daef4..4b5994fa 100644 --- a/src/coredump/_UCD_access_reg_linux.c +++ b/src/coredump/_UCD_access_reg_linux.c @@ -130,8 +130,8 @@ _UCD_access_reg (unw_addr_space_t as, * image. */ Debug(1, "pr_reg[%d]:%ld (0x%lx)\n", regnum, - (long)ui->prstatus->pr_reg[regnum], - (long)ui->prstatus->pr_reg[regnum] + (long)ui->prstatus->pr_reg[regnum], + (long)ui->prstatus->pr_reg[regnum] ); *valp = ui->prstatus->pr_reg[regnum]; diff --git a/src/coredump/_UCD_accessors.c b/src/coredump/_UCD_accessors.c index 9bbe34e1..f0811803 100644 --- a/src/coredump/_UCD_accessors.c +++ b/src/coredump/_UCD_accessors.c @@ -25,12 +25,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ PROTECTED unw_accessors_t _UCD_accessors = { - .find_proc_info = _UCD_find_proc_info, - .put_unwind_info = _UCD_put_unwind_info, - .get_dyn_info_list_addr = _UCD_get_dyn_info_list_addr, - .access_mem = _UCD_access_mem, - .access_reg = _UCD_access_reg, - .access_fpreg = _UCD_access_fpreg, - .resume = _UCD_resume, - .get_proc_name = _UCD_get_proc_name + .find_proc_info = _UCD_find_proc_info, + .put_unwind_info = _UCD_put_unwind_info, + .get_dyn_info_list_addr = _UCD_get_dyn_info_list_addr, + .access_mem = _UCD_access_mem, + .access_reg = _UCD_access_reg, + .access_fpreg = _UCD_access_fpreg, + .resume = _UCD_resume, + .get_proc_name = _UCD_get_proc_name }; diff --git a/src/coredump/_UCD_elf_map_image.c b/src/coredump/_UCD_elf_map_image.c index 63eb22a9..4b3db0bb 100644 --- a/src/coredump/_UCD_elf_map_image.c +++ b/src/coredump/_UCD_elf_map_image.c @@ -40,17 +40,17 @@ CD_elf_map_image(struct UCD_info *ui, coredump_phdr_t *phdr) /* addr, length, prot, flags, fd, fd_offset */ ei->image = mmap(NULL, phdr->p_memsz, PROT_READ, MAP_PRIVATE, ui->coredump_fd, phdr->p_offset); if (ei->image == MAP_FAILED) - { - ei->image = NULL; - return NULL; - } + { + ei->image = NULL; + return NULL; + } ei->size = phdr->p_filesz; size_t remainder_len = phdr->p_memsz - phdr->p_filesz; if (remainder_len > 0) - { - void *remainder_base = (char*) ei->image + phdr->p_filesz; - munmap(remainder_base, remainder_len); - } + { + void *remainder_base = (char*) ei->image + phdr->p_filesz; + munmap(remainder_base, remainder_len); + } } else { /* We have a backing file for this segment. * This file is always longer than phdr->p_memsz, @@ -62,10 +62,10 @@ CD_elf_map_image(struct UCD_info *ui, coredump_phdr_t *phdr) /* addr, length, prot, flags, fd, fd_offset */ ei->image = mmap(NULL, phdr->backing_filesize, PROT_READ, MAP_PRIVATE, phdr->backing_fd, 0); if (ei->image == MAP_FAILED) - { - ei->image = NULL; - return NULL; - } + { + ei->image = NULL; + return NULL; + } ei->size = phdr->backing_filesize; } @@ -89,10 +89,10 @@ _UCD_get_elf_image(struct UCD_info *ui, unw_word_t ip) { coredump_phdr_t *phdr = &ui->phdrs[i]; if (phdr->p_vaddr <= ip && ip < phdr->p_vaddr + phdr->p_memsz) - { - phdr = CD_elf_map_image(ui, phdr); - return phdr; - } + { + phdr = CD_elf_map_image(ui, phdr); + return phdr; + } } return NULL; } diff --git a/src/coredump/_UCD_find_proc_info.c b/src/coredump/_UCD_find_proc_info.c index febbdb80..33b66c8e 100644 --- a/src/coredump/_UCD_find_proc_info.c +++ b/src/coredump/_UCD_find_proc_info.c @@ -102,7 +102,7 @@ get_unwind_info(struct UCD_info *ui, unw_addr_space_t as, unw_word_t ip) int _UCD_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, - int need_unwind_info, void *arg) + int need_unwind_info, void *arg) { struct UCD_info *ui = arg; @@ -119,33 +119,33 @@ _UCD_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, if (ui->edi.ktab.format != -1) { /* The kernel unwind table resides in local memory, so we have - to use the local address space to search it. Since - _UCD_put_unwind_info() has no easy way of detecting this - case, we simply make a copy of the unwind-info, so - _UCD_put_unwind_info() can always free() the unwind-info - without ill effects. */ + to use the local address space to search it. Since + _UCD_put_unwind_info() has no easy way of detecting this + case, we simply make a copy of the unwind-info, so + _UCD_put_unwind_info() can always free() the unwind-info + without ill effects. */ ret = tdep_search_unwind_table (unw_local_addr_space, ip, &ui->edi.ktab, pi, - need_unwind_info, arg); + need_unwind_info, arg); if (ret >= 0) - { - if (!need_unwind_info) - pi->unwind_info = NULL; - else - { - void *mem = malloc (pi->unwind_info_size); + { + if (!need_unwind_info) + pi->unwind_info = NULL; + else + { + void *mem = malloc (pi->unwind_info_size); - if (!mem) - return -UNW_ENOMEM; - memcpy (mem, pi->unwind_info, pi->unwind_info_size); - pi->unwind_info = mem; - } - } + if (!mem) + return -UNW_ENOMEM; + memcpy (mem, pi->unwind_info, pi->unwind_info_size); + pi->unwind_info = mem; + } + } } #endif if (ret == -UNW_ENOINFO && ui->edi.di_cache.format != -1) ret = tdep_search_unwind_table (as, ip, &ui->edi.di_cache, - pi, need_unwind_info, arg); + pi, need_unwind_info, arg); #if UNW_TARGET_ARM if (ret == -UNW_ENOINFO && ui->edi.di_arm.format != -1) @@ -155,7 +155,7 @@ _UCD_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, if (ret == -UNW_ENOINFO && ui->edi.di_debug.format != -1) ret = tdep_search_unwind_table (as, ip, &ui->edi.di_debug, pi, - need_unwind_info, arg); + need_unwind_info, arg); Debug(1, "returns %d\n", ret); diff --git a/src/coredump/_UCD_get_proc_name.c b/src/coredump/_UCD_get_proc_name.c index eae88c1a..00096c48 100644 --- a/src/coredump/_UCD_get_proc_name.c +++ b/src/coredump/_UCD_get_proc_name.c @@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ sensitive to the performance of this routine, why bother... */ static int elf_w (CD_get_proc_name) (struct UCD_info *ui, unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp) + char *buf, size_t buf_len, unw_word_t *offp) { unsigned long segbase, mapoff; int ret; @@ -56,7 +56,7 @@ elf_w (CD_get_proc_name) (struct UCD_info *ui, unw_addr_space_t as, unw_word_t i int _UCD_get_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, void *arg) + char *buf, size_t buf_len, unw_word_t *offp, void *arg) { struct UCD_info *ui = arg; diff --git a/src/coredump/_UPT_access_fpreg.c b/src/coredump/_UPT_access_fpreg.c index a578af17..0b8b86ac 100644 --- a/src/coredump/_UPT_access_fpreg.c +++ b/src/coredump/_UPT_access_fpreg.c @@ -26,7 +26,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ int _UCD_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { print_error (__func__); print_error (" not implemented\n"); diff --git a/src/coredump/_UPT_elf.c b/src/coredump/_UPT_elf.c index 8f30c695..fb7b19a7 100644 --- a/src/coredump/_UPT_elf.c +++ b/src/coredump/_UPT_elf.c @@ -1,5 +1,5 @@ /* We need to get a separate copy of the ELF-code into libunwind-coredump since it cannot (and must not) have any ELF dependencies on libunwind. */ -#include "libunwind_i.h" /* get ELFCLASS defined */ +#include "libunwind_i.h" /* get ELFCLASS defined */ #include "../elfxx.c" diff --git a/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/coredump/_UPT_get_dyn_info_list_addr.c index c245ac17..0d119055 100644 --- a/src/coredump/_UPT_get_dyn_info_list_addr.c +++ b/src/coredump/_UPT_get_dyn_info_list_addr.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -32,7 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ static inline int get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, - int *countp) + int *countp) { unsigned long lo, hi, off; struct UPT_info *ui = arg; @@ -46,26 +46,26 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, while (maps_next (&mi, &lo, &hi, &off)) { if (off) - continue; + continue; invalidate_edi (&ui->edi); if (elf_map_image (&ui->ei, path) < 0) - /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */ - continue; + /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */ + continue; Debug (16, "checking object %s\n", path); di = tdep_find_unwind_table (&ui->edi, as, path, lo, off); if (di) - { - res = _Uia64_find_dyn_list (as, di, arg); - if (res && count++ == 0) - { - Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res); - *dil_addr = res; - } - } + { + res = _Uia64_find_dyn_list (as, di, arg); + if (res && count++ == 0) + { + Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res); + *dil_addr = res; + } + } } maps_close (&mi); *countp = count; @@ -76,7 +76,7 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, static inline int get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, - int *countp) + int *countp) { # warning Implement get_list_addr(), please. *countp = 0; @@ -87,7 +87,7 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, int _UCD_get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, - void *arg) + void *arg) { int count, ret; diff --git a/src/coredump/_UPT_put_unwind_info.c b/src/coredump/_UPT_put_unwind_info.c index 2f5a6476..462e1d04 100644 --- a/src/coredump/_UPT_put_unwind_info.c +++ b/src/coredump/_UPT_put_unwind_info.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/coredump/_UPT_resume.c b/src/coredump/_UPT_resume.c index 368aae11..a729c908 100644 --- a/src/coredump/_UPT_resume.c +++ b/src/coredump/_UPT_resume.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/dwarf/Gexpr.c b/src/dwarf/Gexpr.c index 4b048461..b56bb317 100644 --- a/src/dwarf/Gexpr.c +++ b/src/dwarf/Gexpr.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -30,81 +30,81 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ that the stack could at least have a depth of up to 256 elements, but the GCC unwinder restricts the depth to 64, which seems reasonable so we use the same value here. */ -#define MAX_EXPR_STACK_SIZE 64 +#define MAX_EXPR_STACK_SIZE 64 -#define NUM_OPERANDS(signature) (((signature) >> 6) & 0x3) -#define OPND1_TYPE(signature) (((signature) >> 3) & 0x7) -#define OPND2_TYPE(signature) (((signature) >> 0) & 0x7) +#define NUM_OPERANDS(signature) (((signature) >> 6) & 0x3) +#define OPND1_TYPE(signature) (((signature) >> 3) & 0x7) +#define OPND2_TYPE(signature) (((signature) >> 0) & 0x7) #define OPND_SIGNATURE(n, t1, t2) (((n) << 6) | ((t1) << 3) | ((t2) << 0)) -#define OPND1(t1) OPND_SIGNATURE(1, t1, 0) -#define OPND2(t1, t2) OPND_SIGNATURE(2, t1, t2) +#define OPND1(t1) OPND_SIGNATURE(1, t1, 0) +#define OPND2(t1, t2) OPND_SIGNATURE(2, t1, t2) -#define VAL8 0x0 -#define VAL16 0x1 -#define VAL32 0x2 -#define VAL64 0x3 -#define ULEB128 0x4 -#define SLEB128 0x5 -#define OFFSET 0x6 /* 32-bit offset for 32-bit DWARF, 64-bit otherwise */ -#define ADDR 0x7 /* Machine address. */ +#define VAL8 0x0 +#define VAL16 0x1 +#define VAL32 0x2 +#define VAL64 0x3 +#define ULEB128 0x4 +#define SLEB128 0x5 +#define OFFSET 0x6 /* 32-bit offset for 32-bit DWARF, 64-bit otherwise */ +#define ADDR 0x7 /* Machine address. */ static const uint8_t operands[256] = { - [DW_OP_addr] = OPND1 (ADDR), - [DW_OP_const1u] = OPND1 (VAL8), - [DW_OP_const1s] = OPND1 (VAL8), - [DW_OP_const2u] = OPND1 (VAL16), - [DW_OP_const2s] = OPND1 (VAL16), - [DW_OP_const4u] = OPND1 (VAL32), - [DW_OP_const4s] = OPND1 (VAL32), - [DW_OP_const8u] = OPND1 (VAL64), - [DW_OP_const8s] = OPND1 (VAL64), - [DW_OP_pick] = OPND1 (VAL8), - [DW_OP_plus_uconst] = OPND1 (ULEB128), - [DW_OP_skip] = OPND1 (VAL16), - [DW_OP_bra] = OPND1 (VAL16), - [DW_OP_breg0 + 0] = OPND1 (SLEB128), - [DW_OP_breg0 + 1] = OPND1 (SLEB128), - [DW_OP_breg0 + 2] = OPND1 (SLEB128), - [DW_OP_breg0 + 3] = OPND1 (SLEB128), - [DW_OP_breg0 + 4] = OPND1 (SLEB128), - [DW_OP_breg0 + 5] = OPND1 (SLEB128), - [DW_OP_breg0 + 6] = OPND1 (SLEB128), - [DW_OP_breg0 + 7] = OPND1 (SLEB128), - [DW_OP_breg0 + 8] = OPND1 (SLEB128), - [DW_OP_breg0 + 9] = OPND1 (SLEB128), - [DW_OP_breg0 + 10] = OPND1 (SLEB128), - [DW_OP_breg0 + 11] = OPND1 (SLEB128), - [DW_OP_breg0 + 12] = OPND1 (SLEB128), - [DW_OP_breg0 + 13] = OPND1 (SLEB128), - [DW_OP_breg0 + 14] = OPND1 (SLEB128), - [DW_OP_breg0 + 15] = OPND1 (SLEB128), - [DW_OP_breg0 + 16] = OPND1 (SLEB128), - [DW_OP_breg0 + 17] = OPND1 (SLEB128), - [DW_OP_breg0 + 18] = OPND1 (SLEB128), - [DW_OP_breg0 + 19] = OPND1 (SLEB128), - [DW_OP_breg0 + 20] = OPND1 (SLEB128), - [DW_OP_breg0 + 21] = OPND1 (SLEB128), - [DW_OP_breg0 + 22] = OPND1 (SLEB128), - [DW_OP_breg0 + 23] = OPND1 (SLEB128), - [DW_OP_breg0 + 24] = OPND1 (SLEB128), - [DW_OP_breg0 + 25] = OPND1 (SLEB128), - [DW_OP_breg0 + 26] = OPND1 (SLEB128), - [DW_OP_breg0 + 27] = OPND1 (SLEB128), - [DW_OP_breg0 + 28] = OPND1 (SLEB128), - [DW_OP_breg0 + 29] = OPND1 (SLEB128), - [DW_OP_breg0 + 30] = OPND1 (SLEB128), - [DW_OP_breg0 + 31] = OPND1 (SLEB128), - [DW_OP_regx] = OPND1 (ULEB128), - [DW_OP_fbreg] = OPND1 (SLEB128), - [DW_OP_bregx] = OPND2 (ULEB128, SLEB128), - [DW_OP_piece] = OPND1 (ULEB128), - [DW_OP_deref_size] = OPND1 (VAL8), - [DW_OP_xderef_size] = OPND1 (VAL8), - [DW_OP_call2] = OPND1 (VAL16), - [DW_OP_call4] = OPND1 (VAL32), - [DW_OP_call_ref] = OPND1 (OFFSET) + [DW_OP_addr] = OPND1 (ADDR), + [DW_OP_const1u] = OPND1 (VAL8), + [DW_OP_const1s] = OPND1 (VAL8), + [DW_OP_const2u] = OPND1 (VAL16), + [DW_OP_const2s] = OPND1 (VAL16), + [DW_OP_const4u] = OPND1 (VAL32), + [DW_OP_const4s] = OPND1 (VAL32), + [DW_OP_const8u] = OPND1 (VAL64), + [DW_OP_const8s] = OPND1 (VAL64), + [DW_OP_pick] = OPND1 (VAL8), + [DW_OP_plus_uconst] = OPND1 (ULEB128), + [DW_OP_skip] = OPND1 (VAL16), + [DW_OP_bra] = OPND1 (VAL16), + [DW_OP_breg0 + 0] = OPND1 (SLEB128), + [DW_OP_breg0 + 1] = OPND1 (SLEB128), + [DW_OP_breg0 + 2] = OPND1 (SLEB128), + [DW_OP_breg0 + 3] = OPND1 (SLEB128), + [DW_OP_breg0 + 4] = OPND1 (SLEB128), + [DW_OP_breg0 + 5] = OPND1 (SLEB128), + [DW_OP_breg0 + 6] = OPND1 (SLEB128), + [DW_OP_breg0 + 7] = OPND1 (SLEB128), + [DW_OP_breg0 + 8] = OPND1 (SLEB128), + [DW_OP_breg0 + 9] = OPND1 (SLEB128), + [DW_OP_breg0 + 10] = OPND1 (SLEB128), + [DW_OP_breg0 + 11] = OPND1 (SLEB128), + [DW_OP_breg0 + 12] = OPND1 (SLEB128), + [DW_OP_breg0 + 13] = OPND1 (SLEB128), + [DW_OP_breg0 + 14] = OPND1 (SLEB128), + [DW_OP_breg0 + 15] = OPND1 (SLEB128), + [DW_OP_breg0 + 16] = OPND1 (SLEB128), + [DW_OP_breg0 + 17] = OPND1 (SLEB128), + [DW_OP_breg0 + 18] = OPND1 (SLEB128), + [DW_OP_breg0 + 19] = OPND1 (SLEB128), + [DW_OP_breg0 + 20] = OPND1 (SLEB128), + [DW_OP_breg0 + 21] = OPND1 (SLEB128), + [DW_OP_breg0 + 22] = OPND1 (SLEB128), + [DW_OP_breg0 + 23] = OPND1 (SLEB128), + [DW_OP_breg0 + 24] = OPND1 (SLEB128), + [DW_OP_breg0 + 25] = OPND1 (SLEB128), + [DW_OP_breg0 + 26] = OPND1 (SLEB128), + [DW_OP_breg0 + 27] = OPND1 (SLEB128), + [DW_OP_breg0 + 28] = OPND1 (SLEB128), + [DW_OP_breg0 + 29] = OPND1 (SLEB128), + [DW_OP_breg0 + 30] = OPND1 (SLEB128), + [DW_OP_breg0 + 31] = OPND1 (SLEB128), + [DW_OP_regx] = OPND1 (ULEB128), + [DW_OP_fbreg] = OPND1 (SLEB128), + [DW_OP_bregx] = OPND2 (ULEB128, SLEB128), + [DW_OP_piece] = OPND1 (ULEB128), + [DW_OP_deref_size] = OPND1 (VAL8), + [DW_OP_xderef_size] = OPND1 (VAL8), + [DW_OP_call2] = OPND1 (VAL16), + [DW_OP_call4] = OPND1 (VAL32), + [DW_OP_call_ref] = OPND1 (OFFSET) }; static inline unw_sword_t @@ -122,7 +122,7 @@ sword (unw_addr_space_t as, unw_word_t val) static inline unw_word_t read_operand (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, int operand_type, unw_word_t *val, void *arg) + unw_word_t *addr, int operand_type, unw_word_t *val, void *arg) { uint8_t u8; uint16_t u16; @@ -145,28 +145,28 @@ read_operand (unw_addr_space_t as, unw_accessors_t *a, case VAL8: ret = dwarf_readu8 (as, a, addr, &u8, arg); if (ret < 0) - return ret; + return ret; *val = u8; break; case VAL16: ret = dwarf_readu16 (as, a, addr, &u16, arg); if (ret < 0) - return ret; + return ret; *val = u16; break; case VAL32: ret = dwarf_readu32 (as, a, addr, &u32, arg); if (ret < 0) - return ret; + return ret; *val = u32; break; case VAL64: ret = dwarf_readu64 (as, a, addr, &u64, arg); if (ret < 0) - return ret; + return ret; *val = u64; break; @@ -188,7 +188,7 @@ read_operand (unw_addr_space_t as, unw_accessors_t *a, HIDDEN int dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t *addr, unw_word_t len, - unw_word_t *valp, int *is_register) + unw_word_t *valp, int *is_register) { unw_word_t operand1 = 0, operand2 = 0, tmp1, tmp2, tmp3, end_addr; uint8_t opcode, operands_signature, u8; @@ -201,34 +201,34 @@ dwarf_eval_expr (struct dwarf_cursor *c, unw_word_t *addr, unw_word_t len, uint32_t u32; uint64_t u64; int ret; -# define pop() \ -({ \ - if ((tos - 1) >= MAX_EXPR_STACK_SIZE) \ - { \ - Debug (1, "Stack underflow\n"); \ - return -UNW_EINVAL; \ - } \ - stack[--tos]; \ +# define pop() \ +({ \ + if ((tos - 1) >= MAX_EXPR_STACK_SIZE) \ + { \ + Debug (1, "Stack underflow\n"); \ + return -UNW_EINVAL; \ + } \ + stack[--tos]; \ }) -# define push(x) \ -do { \ - unw_word_t _x = (x); \ - if (tos >= MAX_EXPR_STACK_SIZE) \ - { \ - Debug (1, "Stack overflow\n"); \ - return -UNW_EINVAL; \ - } \ - stack[tos++] = _x; \ +# define push(x) \ +do { \ + unw_word_t _x = (x); \ + if (tos >= MAX_EXPR_STACK_SIZE) \ + { \ + Debug (1, "Stack overflow\n"); \ + return -UNW_EINVAL; \ + } \ + stack[tos++] = _x; \ } while (0) -# define pick(n) \ -({ \ - unsigned int _index = tos - 1 - (n); \ - if (_index >= MAX_EXPR_STACK_SIZE) \ - { \ - Debug (1, "Out-of-stack pick\n"); \ - return -UNW_EINVAL; \ - } \ - stack[_index]; \ +# define pick(n) \ +({ \ + unsigned int _index = tos - 1 - (n); \ + if (_index >= MAX_EXPR_STACK_SIZE) \ + { \ + Debug (1, "Out-of-stack pick\n"); \ + return -UNW_EINVAL; \ + } \ + stack[_index]; \ }) as = c->as; @@ -238,409 +238,409 @@ do { \ *is_register = 0; Debug (14, "len=%lu, pushing cfa=0x%lx\n", - (unsigned long) len, (unsigned long) c->cfa); + (unsigned long) len, (unsigned long) c->cfa); - push (c->cfa); /* push current CFA as required by DWARF spec */ + push (c->cfa); /* push current CFA as required by DWARF spec */ while (*addr < end_addr) { if ((ret = dwarf_readu8 (as, a, addr, &opcode, arg)) < 0) - return ret; + return ret; operands_signature = operands[opcode]; if (unlikely (NUM_OPERANDS (operands_signature) > 0)) - { - if ((ret = read_operand (as, a, addr, - OPND1_TYPE (operands_signature), - &operand1, arg)) < 0) - return ret; - if (NUM_OPERANDS (operands_signature) > 1) - if ((ret = read_operand (as, a, addr, - OPND2_TYPE (operands_signature), - &operand2, arg)) < 0) - return ret; - } + { + if ((ret = read_operand (as, a, addr, + OPND1_TYPE (operands_signature), + &operand1, arg)) < 0) + return ret; + if (NUM_OPERANDS (operands_signature) > 1) + if ((ret = read_operand (as, a, addr, + OPND2_TYPE (operands_signature), + &operand2, arg)) < 0) + return ret; + } switch ((dwarf_expr_op_t) opcode) - { - case DW_OP_lit0: case DW_OP_lit1: case DW_OP_lit2: - case DW_OP_lit3: case DW_OP_lit4: case DW_OP_lit5: - case DW_OP_lit6: case DW_OP_lit7: case DW_OP_lit8: - case DW_OP_lit9: case DW_OP_lit10: case DW_OP_lit11: - case DW_OP_lit12: case DW_OP_lit13: case DW_OP_lit14: - case DW_OP_lit15: case DW_OP_lit16: case DW_OP_lit17: - case DW_OP_lit18: case DW_OP_lit19: case DW_OP_lit20: - case DW_OP_lit21: case DW_OP_lit22: case DW_OP_lit23: - case DW_OP_lit24: case DW_OP_lit25: case DW_OP_lit26: - case DW_OP_lit27: case DW_OP_lit28: case DW_OP_lit29: - case DW_OP_lit30: case DW_OP_lit31: - Debug (15, "OP_lit(%d)\n", (int) opcode - DW_OP_lit0); - push (opcode - DW_OP_lit0); - break; + { + case DW_OP_lit0: case DW_OP_lit1: case DW_OP_lit2: + case DW_OP_lit3: case DW_OP_lit4: case DW_OP_lit5: + case DW_OP_lit6: case DW_OP_lit7: case DW_OP_lit8: + case DW_OP_lit9: case DW_OP_lit10: case DW_OP_lit11: + case DW_OP_lit12: case DW_OP_lit13: case DW_OP_lit14: + case DW_OP_lit15: case DW_OP_lit16: case DW_OP_lit17: + case DW_OP_lit18: case DW_OP_lit19: case DW_OP_lit20: + case DW_OP_lit21: case DW_OP_lit22: case DW_OP_lit23: + case DW_OP_lit24: case DW_OP_lit25: case DW_OP_lit26: + case DW_OP_lit27: case DW_OP_lit28: case DW_OP_lit29: + case DW_OP_lit30: case DW_OP_lit31: + Debug (15, "OP_lit(%d)\n", (int) opcode - DW_OP_lit0); + push (opcode - DW_OP_lit0); + break; - case DW_OP_breg0: case DW_OP_breg1: case DW_OP_breg2: - case DW_OP_breg3: case DW_OP_breg4: case DW_OP_breg5: - case DW_OP_breg6: case DW_OP_breg7: case DW_OP_breg8: - case DW_OP_breg9: case DW_OP_breg10: case DW_OP_breg11: - case DW_OP_breg12: case DW_OP_breg13: case DW_OP_breg14: - case DW_OP_breg15: case DW_OP_breg16: case DW_OP_breg17: - case DW_OP_breg18: case DW_OP_breg19: case DW_OP_breg20: - case DW_OP_breg21: case DW_OP_breg22: case DW_OP_breg23: - case DW_OP_breg24: case DW_OP_breg25: case DW_OP_breg26: - case DW_OP_breg27: case DW_OP_breg28: case DW_OP_breg29: - case DW_OP_breg30: case DW_OP_breg31: - Debug (15, "OP_breg(r%d,0x%lx)\n", - (int) opcode - DW_OP_breg0, (unsigned long) operand1); - if ((ret = unw_get_reg (dwarf_to_cursor (c), - dwarf_to_unw_regnum (opcode - DW_OP_breg0), - &tmp1)) < 0) - return ret; - push (tmp1 + operand1); - break; + case DW_OP_breg0: case DW_OP_breg1: case DW_OP_breg2: + case DW_OP_breg3: case DW_OP_breg4: case DW_OP_breg5: + case DW_OP_breg6: case DW_OP_breg7: case DW_OP_breg8: + case DW_OP_breg9: case DW_OP_breg10: case DW_OP_breg11: + case DW_OP_breg12: case DW_OP_breg13: case DW_OP_breg14: + case DW_OP_breg15: case DW_OP_breg16: case DW_OP_breg17: + case DW_OP_breg18: case DW_OP_breg19: case DW_OP_breg20: + case DW_OP_breg21: case DW_OP_breg22: case DW_OP_breg23: + case DW_OP_breg24: case DW_OP_breg25: case DW_OP_breg26: + case DW_OP_breg27: case DW_OP_breg28: case DW_OP_breg29: + case DW_OP_breg30: case DW_OP_breg31: + Debug (15, "OP_breg(r%d,0x%lx)\n", + (int) opcode - DW_OP_breg0, (unsigned long) operand1); + if ((ret = unw_get_reg (dwarf_to_cursor (c), + dwarf_to_unw_regnum (opcode - DW_OP_breg0), + &tmp1)) < 0) + return ret; + push (tmp1 + operand1); + break; - case DW_OP_bregx: - Debug (15, "OP_bregx(r%d,0x%lx)\n", - (int) operand1, (unsigned long) operand2); - if ((ret = unw_get_reg (dwarf_to_cursor (c), - dwarf_to_unw_regnum (operand1), &tmp1)) < 0) - return ret; - push (tmp1 + operand2); - break; + case DW_OP_bregx: + Debug (15, "OP_bregx(r%d,0x%lx)\n", + (int) operand1, (unsigned long) operand2); + if ((ret = unw_get_reg (dwarf_to_cursor (c), + dwarf_to_unw_regnum (operand1), &tmp1)) < 0) + return ret; + push (tmp1 + operand2); + break; - case DW_OP_reg0: case DW_OP_reg1: case DW_OP_reg2: - case DW_OP_reg3: case DW_OP_reg4: case DW_OP_reg5: - case DW_OP_reg6: case DW_OP_reg7: case DW_OP_reg8: - case DW_OP_reg9: case DW_OP_reg10: case DW_OP_reg11: - case DW_OP_reg12: case DW_OP_reg13: case DW_OP_reg14: - case DW_OP_reg15: case DW_OP_reg16: case DW_OP_reg17: - case DW_OP_reg18: case DW_OP_reg19: case DW_OP_reg20: - case DW_OP_reg21: case DW_OP_reg22: case DW_OP_reg23: - case DW_OP_reg24: case DW_OP_reg25: case DW_OP_reg26: - case DW_OP_reg27: case DW_OP_reg28: case DW_OP_reg29: - case DW_OP_reg30: case DW_OP_reg31: - Debug (15, "OP_reg(r%d)\n", (int) opcode - DW_OP_reg0); - *valp = dwarf_to_unw_regnum (opcode - DW_OP_reg0); - *is_register = 1; - return 0; + case DW_OP_reg0: case DW_OP_reg1: case DW_OP_reg2: + case DW_OP_reg3: case DW_OP_reg4: case DW_OP_reg5: + case DW_OP_reg6: case DW_OP_reg7: case DW_OP_reg8: + case DW_OP_reg9: case DW_OP_reg10: case DW_OP_reg11: + case DW_OP_reg12: case DW_OP_reg13: case DW_OP_reg14: + case DW_OP_reg15: case DW_OP_reg16: case DW_OP_reg17: + case DW_OP_reg18: case DW_OP_reg19: case DW_OP_reg20: + case DW_OP_reg21: case DW_OP_reg22: case DW_OP_reg23: + case DW_OP_reg24: case DW_OP_reg25: case DW_OP_reg26: + case DW_OP_reg27: case DW_OP_reg28: case DW_OP_reg29: + case DW_OP_reg30: case DW_OP_reg31: + Debug (15, "OP_reg(r%d)\n", (int) opcode - DW_OP_reg0); + *valp = dwarf_to_unw_regnum (opcode - DW_OP_reg0); + *is_register = 1; + return 0; - case DW_OP_regx: - Debug (15, "OP_regx(r%d)\n", (int) operand1); - *valp = dwarf_to_unw_regnum (operand1); - *is_register = 1; - return 0; + case DW_OP_regx: + Debug (15, "OP_regx(r%d)\n", (int) operand1); + *valp = dwarf_to_unw_regnum (operand1); + *is_register = 1; + return 0; - case DW_OP_addr: - case DW_OP_const1u: - case DW_OP_const2u: - case DW_OP_const4u: - case DW_OP_const8u: - case DW_OP_constu: - case DW_OP_const8s: - case DW_OP_consts: - Debug (15, "OP_const(0x%lx)\n", (unsigned long) operand1); - push (operand1); - break; + case DW_OP_addr: + case DW_OP_const1u: + case DW_OP_const2u: + case DW_OP_const4u: + case DW_OP_const8u: + case DW_OP_constu: + case DW_OP_const8s: + case DW_OP_consts: + Debug (15, "OP_const(0x%lx)\n", (unsigned long) operand1); + push (operand1); + break; - case DW_OP_const1s: - if (operand1 & 0x80) - operand1 |= ((unw_word_t) -1) << 8; - Debug (15, "OP_const1s(%ld)\n", (long) operand1); - push (operand1); - break; + case DW_OP_const1s: + if (operand1 & 0x80) + operand1 |= ((unw_word_t) -1) << 8; + Debug (15, "OP_const1s(%ld)\n", (long) operand1); + push (operand1); + break; - case DW_OP_const2s: - if (operand1 & 0x8000) - operand1 |= ((unw_word_t) -1) << 16; - Debug (15, "OP_const2s(%ld)\n", (long) operand1); - push (operand1); - break; + case DW_OP_const2s: + if (operand1 & 0x8000) + operand1 |= ((unw_word_t) -1) << 16; + Debug (15, "OP_const2s(%ld)\n", (long) operand1); + push (operand1); + break; - case DW_OP_const4s: - if (operand1 & 0x80000000) - operand1 |= (((unw_word_t) -1) << 16) << 16; - Debug (15, "OP_const4s(%ld)\n", (long) operand1); - push (operand1); - break; + case DW_OP_const4s: + if (operand1 & 0x80000000) + operand1 |= (((unw_word_t) -1) << 16) << 16; + Debug (15, "OP_const4s(%ld)\n", (long) operand1); + push (operand1); + break; - case DW_OP_deref: - Debug (15, "OP_deref\n"); - tmp1 = pop (); - if ((ret = dwarf_readw (as, a, &tmp1, &tmp2, arg)) < 0) - return ret; - push (tmp2); - break; + case DW_OP_deref: + Debug (15, "OP_deref\n"); + tmp1 = pop (); + if ((ret = dwarf_readw (as, a, &tmp1, &tmp2, arg)) < 0) + return ret; + push (tmp2); + break; - case DW_OP_deref_size: - Debug (15, "OP_deref_size(%d)\n", (int) operand1); - tmp1 = pop (); - switch (operand1) - { - default: - Debug (1, "Unexpected DW_OP_deref_size size %d\n", - (int) operand1); - return -UNW_EINVAL; + case DW_OP_deref_size: + Debug (15, "OP_deref_size(%d)\n", (int) operand1); + tmp1 = pop (); + switch (operand1) + { + default: + Debug (1, "Unexpected DW_OP_deref_size size %d\n", + (int) operand1); + return -UNW_EINVAL; - case 1: - if ((ret = dwarf_readu8 (as, a, &tmp1, &u8, arg)) < 0) - return ret; - tmp2 = u8; - break; + case 1: + if ((ret = dwarf_readu8 (as, a, &tmp1, &u8, arg)) < 0) + return ret; + tmp2 = u8; + break; - case 2: - if ((ret = dwarf_readu16 (as, a, &tmp1, &u16, arg)) < 0) - return ret; - tmp2 = u16; - break; + case 2: + if ((ret = dwarf_readu16 (as, a, &tmp1, &u16, arg)) < 0) + return ret; + tmp2 = u16; + break; - case 3: - case 4: - if ((ret = dwarf_readu32 (as, a, &tmp1, &u32, arg)) < 0) - return ret; - tmp2 = u32; - if (operand1 == 3) - { - if (dwarf_is_big_endian (as)) - tmp2 >>= 8; - else - tmp2 &= 0xffffff; - } - break; - case 5: - case 6: - case 7: - case 8: - if ((ret = dwarf_readu64 (as, a, &tmp1, &u64, arg)) < 0) - return ret; - tmp2 = u64; - if (operand1 != 8) - { - if (dwarf_is_big_endian (as)) - tmp2 >>= 64 - 8 * operand1; - else - tmp2 &= (~ (unw_word_t) 0) << (8 * operand1); - } - break; - } - push (tmp2); - break; + case 3: + case 4: + if ((ret = dwarf_readu32 (as, a, &tmp1, &u32, arg)) < 0) + return ret; + tmp2 = u32; + if (operand1 == 3) + { + if (dwarf_is_big_endian (as)) + tmp2 >>= 8; + else + tmp2 &= 0xffffff; + } + break; + case 5: + case 6: + case 7: + case 8: + if ((ret = dwarf_readu64 (as, a, &tmp1, &u64, arg)) < 0) + return ret; + tmp2 = u64; + if (operand1 != 8) + { + if (dwarf_is_big_endian (as)) + tmp2 >>= 64 - 8 * operand1; + else + tmp2 &= (~ (unw_word_t) 0) << (8 * operand1); + } + break; + } + push (tmp2); + break; - case DW_OP_dup: - Debug (15, "OP_dup\n"); - push (pick (0)); - break; + case DW_OP_dup: + Debug (15, "OP_dup\n"); + push (pick (0)); + break; - case DW_OP_drop: - Debug (15, "OP_drop\n"); - (void) pop (); - break; + case DW_OP_drop: + Debug (15, "OP_drop\n"); + (void) pop (); + break; - case DW_OP_pick: - Debug (15, "OP_pick(%d)\n", (int) operand1); - push (pick (operand1)); - break; + case DW_OP_pick: + Debug (15, "OP_pick(%d)\n", (int) operand1); + push (pick (operand1)); + break; - case DW_OP_over: - Debug (15, "OP_over\n"); - push (pick (1)); - break; + case DW_OP_over: + Debug (15, "OP_over\n"); + push (pick (1)); + break; - case DW_OP_swap: - Debug (15, "OP_swap\n"); - tmp1 = pop (); - tmp2 = pop (); - push (tmp1); - push (tmp2); - break; + case DW_OP_swap: + Debug (15, "OP_swap\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1); + push (tmp2); + break; - case DW_OP_rot: - Debug (15, "OP_rot\n"); - tmp1 = pop (); - tmp2 = pop (); - tmp3 = pop (); - push (tmp1); - push (tmp3); - push (tmp2); - break; + case DW_OP_rot: + Debug (15, "OP_rot\n"); + tmp1 = pop (); + tmp2 = pop (); + tmp3 = pop (); + push (tmp1); + push (tmp3); + push (tmp2); + break; - case DW_OP_abs: - Debug (15, "OP_abs\n"); - tmp1 = pop (); - if (tmp1 & ((unw_word_t) 1 << (8 * dwarf_addr_size (as) - 1))) - tmp1 = -tmp1; - push (tmp1); - break; + case DW_OP_abs: + Debug (15, "OP_abs\n"); + tmp1 = pop (); + if (tmp1 & ((unw_word_t) 1 << (8 * dwarf_addr_size (as) - 1))) + tmp1 = -tmp1; + push (tmp1); + break; - case DW_OP_and: - Debug (15, "OP_and\n"); - tmp1 = pop (); - tmp2 = pop (); - push (tmp1 & tmp2); - break; + case DW_OP_and: + Debug (15, "OP_and\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1 & tmp2); + break; - case DW_OP_div: - Debug (15, "OP_div\n"); - tmp1 = pop (); - tmp2 = pop (); - if (tmp1) - tmp1 = sword (as, tmp2) / sword (as, tmp1); - push (tmp1); - break; + case DW_OP_div: + Debug (15, "OP_div\n"); + tmp1 = pop (); + tmp2 = pop (); + if (tmp1) + tmp1 = sword (as, tmp2) / sword (as, tmp1); + push (tmp1); + break; - case DW_OP_minus: - Debug (15, "OP_minus\n"); - tmp1 = pop (); - tmp2 = pop (); - tmp1 = tmp2 - tmp1; - push (tmp1); - break; + case DW_OP_minus: + Debug (15, "OP_minus\n"); + tmp1 = pop (); + tmp2 = pop (); + tmp1 = tmp2 - tmp1; + push (tmp1); + break; - case DW_OP_mod: - Debug (15, "OP_mod\n"); - tmp1 = pop (); - tmp2 = pop (); - if (tmp1) - tmp1 = tmp2 % tmp1; - push (tmp1); - break; + case DW_OP_mod: + Debug (15, "OP_mod\n"); + tmp1 = pop (); + tmp2 = pop (); + if (tmp1) + tmp1 = tmp2 % tmp1; + push (tmp1); + break; - case DW_OP_mul: - Debug (15, "OP_mul\n"); - tmp1 = pop (); - tmp2 = pop (); - if (tmp1) - tmp1 = tmp2 * tmp1; - push (tmp1); - break; + case DW_OP_mul: + Debug (15, "OP_mul\n"); + tmp1 = pop (); + tmp2 = pop (); + if (tmp1) + tmp1 = tmp2 * tmp1; + push (tmp1); + break; - case DW_OP_neg: - Debug (15, "OP_neg\n"); - push (-pop ()); - break; + case DW_OP_neg: + Debug (15, "OP_neg\n"); + push (-pop ()); + break; - case DW_OP_not: - Debug (15, "OP_not\n"); - push (~pop ()); - break; + case DW_OP_not: + Debug (15, "OP_not\n"); + push (~pop ()); + break; - case DW_OP_or: - Debug (15, "OP_or\n"); - tmp1 = pop (); - tmp2 = pop (); - push (tmp1 | tmp2); - break; + case DW_OP_or: + Debug (15, "OP_or\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1 | tmp2); + break; - case DW_OP_plus: - Debug (15, "OP_plus\n"); - tmp1 = pop (); - tmp2 = pop (); - push (tmp1 + tmp2); - break; + case DW_OP_plus: + Debug (15, "OP_plus\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1 + tmp2); + break; - case DW_OP_plus_uconst: - Debug (15, "OP_plus_uconst(%lu)\n", (unsigned long) operand1); - tmp1 = pop (); - push (tmp1 + operand1); - break; + case DW_OP_plus_uconst: + Debug (15, "OP_plus_uconst(%lu)\n", (unsigned long) operand1); + tmp1 = pop (); + push (tmp1 + operand1); + break; - case DW_OP_shl: - Debug (15, "OP_shl\n"); - tmp1 = pop (); - tmp2 = pop (); - push (tmp2 << tmp1); - break; + case DW_OP_shl: + Debug (15, "OP_shl\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp2 << tmp1); + break; - case DW_OP_shr: - Debug (15, "OP_shr\n"); - tmp1 = pop (); - tmp2 = pop (); - push (tmp2 >> tmp1); - break; + case DW_OP_shr: + Debug (15, "OP_shr\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp2 >> tmp1); + break; - case DW_OP_shra: - Debug (15, "OP_shra\n"); - tmp1 = pop (); - tmp2 = pop (); - push (sword (as, tmp2) >> tmp1); - break; + case DW_OP_shra: + Debug (15, "OP_shra\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp2) >> tmp1); + break; - case DW_OP_xor: - Debug (15, "OP_xor\n"); - tmp1 = pop (); - tmp2 = pop (); - push (tmp1 ^ tmp2); - break; + case DW_OP_xor: + Debug (15, "OP_xor\n"); + tmp1 = pop (); + tmp2 = pop (); + push (tmp1 ^ tmp2); + break; - case DW_OP_le: - Debug (15, "OP_le\n"); - tmp1 = pop (); - tmp2 = pop (); - push (sword (as, tmp2) <= sword (as, tmp1)); - break; + case DW_OP_le: + Debug (15, "OP_le\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp2) <= sword (as, tmp1)); + break; - case DW_OP_ge: - Debug (15, "OP_ge\n"); - tmp1 = pop (); - tmp2 = pop (); - push (sword (as, tmp2) >= sword (as, tmp1)); - break; + case DW_OP_ge: + Debug (15, "OP_ge\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp2) >= sword (as, tmp1)); + break; - case DW_OP_eq: - Debug (15, "OP_eq\n"); - tmp1 = pop (); - tmp2 = pop (); - push (sword (as, tmp2) == sword (as, tmp1)); - break; + case DW_OP_eq: + Debug (15, "OP_eq\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp2) == sword (as, tmp1)); + break; - case DW_OP_lt: - Debug (15, "OP_lt\n"); - tmp1 = pop (); - tmp2 = pop (); - push (sword (as, tmp2) < sword (as, tmp1)); - break; + case DW_OP_lt: + Debug (15, "OP_lt\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp2) < sword (as, tmp1)); + break; - case DW_OP_gt: - Debug (15, "OP_gt\n"); - tmp1 = pop (); - tmp2 = pop (); - push (sword (as, tmp2) > sword (as, tmp1)); - break; + case DW_OP_gt: + Debug (15, "OP_gt\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp2) > sword (as, tmp1)); + break; - case DW_OP_ne: - Debug (15, "OP_ne\n"); - tmp1 = pop (); - tmp2 = pop (); - push (sword (as, tmp2) != sword (as, tmp1)); - break; + case DW_OP_ne: + Debug (15, "OP_ne\n"); + tmp1 = pop (); + tmp2 = pop (); + push (sword (as, tmp2) != sword (as, tmp1)); + break; - case DW_OP_skip: - Debug (15, "OP_skip(%d)\n", (int16_t) operand1); - *addr += (int16_t) operand1; - break; + case DW_OP_skip: + Debug (15, "OP_skip(%d)\n", (int16_t) operand1); + *addr += (int16_t) operand1; + break; - case DW_OP_bra: - Debug (15, "OP_skip(%d)\n", (int16_t) operand1); - tmp1 = pop (); - if (tmp1) - *addr += (int16_t) operand1; - break; + case DW_OP_bra: + Debug (15, "OP_skip(%d)\n", (int16_t) operand1); + tmp1 = pop (); + if (tmp1) + *addr += (int16_t) operand1; + break; - case DW_OP_nop: - Debug (15, "OP_nop\n"); - break; + case DW_OP_nop: + Debug (15, "OP_nop\n"); + break; - case DW_OP_call2: - case DW_OP_call4: - case DW_OP_call_ref: - case DW_OP_fbreg: - case DW_OP_piece: - case DW_OP_push_object_address: - case DW_OP_xderef: - case DW_OP_xderef_size: - default: - Debug (1, "Unexpected opcode 0x%x\n", opcode); - return -UNW_EINVAL; - } + case DW_OP_call2: + case DW_OP_call4: + case DW_OP_call_ref: + case DW_OP_fbreg: + case DW_OP_piece: + case DW_OP_push_object_address: + case DW_OP_xderef: + case DW_OP_xderef_size: + default: + Debug (1, "Unexpected opcode 0x%x\n", opcode); + return -UNW_EINVAL; + } } *valp = pop (); Debug (14, "final value = 0x%lx\n", (unsigned long) *valp); diff --git a/src/dwarf/Gfde.c b/src/dwarf/Gfde.c index 8659624b..dd00b62a 100644 --- a/src/dwarf/Gfde.c +++ b/src/dwarf/Gfde.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -44,8 +44,8 @@ is_cie_id (unw_word_t val, int is_debug_frame) repeated. */ static inline int parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, - const unw_proc_info_t *pi, struct dwarf_cie_info *dci, - unw_word_t base, void *arg) + const unw_proc_info_t *pi, struct dwarf_cie_info *dci, + unw_word_t base, void *arg) { uint8_t version, ch, augstr[5], fde_encoding, handler_encoding; unw_word_t len, cie_end_addr, aug_size; @@ -53,8 +53,8 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, uint64_t u64val; size_t i; int ret; -# define STR2(x) #x -# define STR(x) STR2(x) +# define STR2(x) #x +# define STR(x) STR2(x) /* Pick appropriate default for FDE-encoding. DWARF spec says start-IP (initial_location) and the code-size (address_range) are @@ -63,9 +63,9 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, for fde_encoding. */ switch (dwarf_addr_size (as)) { - case 4: fde_encoding = DW_EH_PE_udata4; break; - case 8: fde_encoding = DW_EH_PE_udata8; break; - default: fde_encoding = DW_EH_PE_omit; break; + case 4: fde_encoding = DW_EH_PE_udata4; break; + case 8: fde_encoding = DW_EH_PE_udata8; break; + default: fde_encoding = DW_EH_PE_omit; break; } dci->lsda_encoding = DW_EH_PE_omit; @@ -84,32 +84,32 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, len = u32val; cie_end_addr = addr + len; if ((ret = dwarf_readu32 (as, a, &addr, &cie_id, arg)) < 0) - return ret; + return ret; if (cie_id != expected_id) - { - Debug (1, "Unexpected CIE id %x\n", cie_id); - return -UNW_EINVAL; - } + { + Debug (1, "Unexpected CIE id %x\n", cie_id); + return -UNW_EINVAL; + } } else { /* the CIE is in the 64-bit DWARF format */ uint64_t cie_id; /* DWARF says CIE id should be 0xffffffffffffffff, but in - .eh_frame, it's 0 */ + .eh_frame, it's 0 */ const uint64_t expected_id = (base) ? 0xffffffffffffffffull : 0; if ((ret = dwarf_readu64 (as, a, &addr, &u64val, arg)) < 0) - return ret; + return ret; len = u64val; cie_end_addr = addr + len; if ((ret = dwarf_readu64 (as, a, &addr, &cie_id, arg)) < 0) - return ret; + return ret; if (cie_id != expected_id) - { - Debug (1, "Unexpected CIE id %llx\n", (long long) cie_id); - return -UNW_EINVAL; - } + { + Debug (1, "Unexpected CIE id %llx\n", (long long) cie_id); + return -UNW_EINVAL; + } } dci->cie_instr_end = cie_end_addr; @@ -119,7 +119,7 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, if (version != 1 && version != DWARF_CIE_VERSION) { Debug (1, "Got CIE version %u, expected version 1 or " - STR (DWARF_CIE_VERSION) "\n", version); + STR (DWARF_CIE_VERSION) "\n", version); return -UNW_EBADVERSION; } @@ -128,13 +128,13 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, for (i = 0;;) { if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0) - return ret; + return ret; if (!ch) - break; /* end of augmentation string */ + break; /* end of augmentation string */ if (i < sizeof (augstr) - 1) - augstr[i++] = ch; + augstr[i++] = ch; } if ((ret = dwarf_read_uleb128 (as, a, &addr, &dci->code_align, arg)) < 0 @@ -145,11 +145,11 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, if (version == 1) { if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0) - return ret; + return ret; dci->ret_addr_column = ch; } else if ((ret = dwarf_read_uleb128 (as, a, &addr, &dci->ret_addr_column, - arg)) < 0) + arg)) < 0) return ret; i = 0; @@ -157,7 +157,7 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, { dci->sized_augmentation = 1; if ((ret = dwarf_read_uleb128 (as, a, &addr, &aug_size, arg)) < 0) - return ret; + return ret; i++; } @@ -165,50 +165,50 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, switch (augstr[i]) { case 'L': - /* read the LSDA pointer-encoding format. */ - if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0) - return ret; - dci->lsda_encoding = ch; - break; + /* read the LSDA pointer-encoding format. */ + if ((ret = dwarf_readu8 (as, a, &addr, &ch, arg)) < 0) + return ret; + dci->lsda_encoding = ch; + break; case 'R': - /* read the FDE pointer-encoding format. */ - if ((ret = dwarf_readu8 (as, a, &addr, &fde_encoding, arg)) < 0) - return ret; - break; + /* read the FDE pointer-encoding format. */ + if ((ret = dwarf_readu8 (as, a, &addr, &fde_encoding, arg)) < 0) + return ret; + break; case 'P': - /* read the personality-routine pointer-encoding format. */ - if ((ret = dwarf_readu8 (as, a, &addr, &handler_encoding, arg)) < 0) - return ret; - if ((ret = dwarf_read_encoded_pointer (as, a, &addr, handler_encoding, - pi, &dci->handler, arg)) < 0) - return ret; - break; + /* read the personality-routine pointer-encoding format. */ + if ((ret = dwarf_readu8 (as, a, &addr, &handler_encoding, arg)) < 0) + return ret; + if ((ret = dwarf_read_encoded_pointer (as, a, &addr, handler_encoding, + pi, &dci->handler, arg)) < 0) + return ret; + break; case 'S': - /* This is a signal frame. */ - dci->signal_frame = 1; + /* This is a signal frame. */ + dci->signal_frame = 1; - /* Temporarily set it to one so dwarf_parse_fde() knows that - it should fetch the actual ABI/TAG pair from the FDE. */ - dci->have_abi_marker = 1; - break; + /* Temporarily set it to one so dwarf_parse_fde() knows that + it should fetch the actual ABI/TAG pair from the FDE. */ + dci->have_abi_marker = 1; + break; default: - Debug (1, "Unexpected augmentation string `%s'\n", augstr); - if (dci->sized_augmentation) - /* If we have the size of the augmentation body, we can skip - over the parts that we don't understand, so we're OK. */ - goto done; - else - return -UNW_EINVAL; + Debug (1, "Unexpected augmentation string `%s'\n", augstr); + if (dci->sized_augmentation) + /* If we have the size of the augmentation body, we can skip + over the parts that we don't understand, so we're OK. */ + goto done; + else + return -UNW_EINVAL; } done: dci->fde_encoding = fde_encoding; dci->cie_instr_start = addr; Debug (15, "CIE parsed OK, augmentation = \"%s\", handler=0x%lx\n", - augstr, (long) dci->handler); + augstr, (long) dci->handler); return 0; } @@ -219,9 +219,9 @@ parse_cie (unw_addr_space_t as, unw_accessors_t *a, unw_word_t addr, HIDDEN int dwarf_extract_proc_info_from_fde (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addrp, unw_proc_info_t *pi, - int need_unwind_info, unw_word_t base, - void *arg) + unw_word_t *addrp, unw_proc_info_t *pi, + int need_unwind_info, unw_word_t base, + void *arg) { unw_word_t fde_end_addr, cie_addr, cie_offset_addr, aug_end_addr = 0; unw_word_t start_ip, ip_range, aug_size, addr = *addrp; @@ -242,9 +242,9 @@ dwarf_extract_proc_info_from_fde (unw_addr_space_t as, unw_accessors_t *a, int32_t cie_offset; /* In some configurations, an FDE with a 0 length indicates the - end of the FDE-table. */ + end of the FDE-table. */ if (u32val == 0) - return -UNW_ENOINFO; + return -UNW_ENOINFO; /* the FDE is in the 32-bit DWARF format */ @@ -252,20 +252,20 @@ dwarf_extract_proc_info_from_fde (unw_addr_space_t as, unw_accessors_t *a, cie_offset_addr = addr; if ((ret = dwarf_reads32 (as, a, &addr, &cie_offset, arg)) < 0) - return ret; + return ret; if (is_cie_id (cie_offset, base != 0)) - /* ignore CIEs (happens during linear searches) */ - return 0; + /* ignore CIEs (happens during linear searches) */ + return 0; if (base != 0) cie_addr = base + cie_offset; else - /* DWARF says that the CIE_pointer in the FDE is a - .debug_frame-relative offset, but the GCC-generated .eh_frame - sections instead store a "pcrelative" offset, which is just - as fine as it's self-contained. */ - cie_addr = cie_offset_addr - cie_offset; + /* DWARF says that the CIE_pointer in the FDE is a + .debug_frame-relative offset, but the GCC-generated .eh_frame + sections instead store a "pcrelative" offset, which is just + as fine as it's self-contained. */ + cie_addr = cie_offset_addr - cie_offset; } else { @@ -274,26 +274,26 @@ dwarf_extract_proc_info_from_fde (unw_addr_space_t as, unw_accessors_t *a, /* the FDE is in the 64-bit DWARF format */ if ((ret = dwarf_readu64 (as, a, &addr, &u64val, arg)) < 0) - return ret; + return ret; *addrp = fde_end_addr = addr + u64val; cie_offset_addr = addr; if ((ret = dwarf_reads64 (as, a, &addr, &cie_offset, arg)) < 0) - return ret; + return ret; if (is_cie_id (cie_offset, base != 0)) - /* ignore CIEs (happens during linear searches) */ - return 0; + /* ignore CIEs (happens during linear searches) */ + return 0; if (base != 0) - cie_addr = base + cie_offset; + cie_addr = base + cie_offset; else - /* DWARF says that the CIE_pointer in the FDE is a - .debug_frame-relative offset, but the GCC-generated .eh_frame - sections instead store a "pcrelative" offset, which is just - as fine as it's self-contained. */ - cie_addr = (unw_word_t) ((uint64_t) cie_offset_addr - cie_offset); + /* DWARF says that the CIE_pointer in the FDE is a + .debug_frame-relative offset, but the GCC-generated .eh_frame + sections instead store a "pcrelative" offset, which is just + as fine as it's self-contained. */ + cie_addr = (unw_word_t) ((uint64_t) cie_offset_addr - cie_offset); } Debug (15, "looking for CIE at address %lx\n", (long) cie_addr); @@ -306,9 +306,9 @@ dwarf_extract_proc_info_from_fde (unw_addr_space_t as, unw_accessors_t *a, ip_range_encoding = dci.fde_encoding & DW_EH_PE_FORMAT_MASK; if ((ret = dwarf_read_encoded_pointer (as, a, &addr, dci.fde_encoding, - pi, &start_ip, arg)) < 0 + pi, &start_ip, arg)) < 0 || (ret = dwarf_read_encoded_pointer (as, a, &addr, ip_range_encoding, - pi, &ip_range, arg)) < 0) + pi, &ip_range, arg)) < 0) return ret; pi->start_ip = start_ip; pi->end_ip = start_ip + ip_range; @@ -317,16 +317,16 @@ dwarf_extract_proc_info_from_fde (unw_addr_space_t as, unw_accessors_t *a, if (dci.sized_augmentation) { if ((ret = dwarf_read_uleb128 (as, a, &addr, &aug_size, arg)) < 0) - return ret; + return ret; aug_end_addr = addr + aug_size; } if ((ret = dwarf_read_encoded_pointer (as, a, &addr, dci.lsda_encoding, - pi, &pi->lsda, arg)) < 0) + pi, &pi->lsda, arg)) < 0) return ret; Debug (15, "FDE covers IP 0x%lx-0x%lx, LSDA=0x%lx\n", - (long) pi->start_ip, (long) pi->end_ip, (long) pi->lsda); + (long) pi->start_ip, (long) pi->end_ip, (long) pi->lsda); if (need_unwind_info) { @@ -334,21 +334,21 @@ dwarf_extract_proc_info_from_fde (unw_addr_space_t as, unw_accessors_t *a, pi->unwind_info_size = sizeof (dci); pi->unwind_info = mempool_alloc (&dwarf_cie_info_pool); if (!pi->unwind_info) - return -UNW_ENOMEM; + return -UNW_ENOMEM; if (dci.have_abi_marker) - { - if ((ret = dwarf_readu16 (as, a, &addr, &dci.abi, arg)) < 0 - || (ret = dwarf_readu16 (as, a, &addr, &dci.tag, arg)) < 0) - return ret; - Debug (13, "Found ABI marker = (abi=%u, tag=%u)\n", - dci.abi, dci.tag); - } + { + if ((ret = dwarf_readu16 (as, a, &addr, &dci.abi, arg)) < 0 + || (ret = dwarf_readu16 (as, a, &addr, &dci.tag, arg)) < 0) + return ret; + Debug (13, "Found ABI marker = (abi=%u, tag=%u)\n", + dci.abi, dci.tag); + } if (dci.sized_augmentation) - dci.fde_instr_start = aug_end_addr; + dci.fde_instr_start = aug_end_addr; else - dci.fde_instr_start = addr; + dci.fde_instr_start = addr; dci.fde_instr_end = fde_end_addr; memcpy (pi->unwind_info, &dci, sizeof (dci)); diff --git a/src/dwarf/Gfind_proc_info-lsb.c b/src/dwarf/Gfind_proc_info-lsb.c index f75bda28..e1bfbe75 100644 --- a/src/dwarf/Gfind_proc_info-lsb.c +++ b/src/dwarf/Gfind_proc_info-lsb.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -48,9 +48,9 @@ struct table_entry static int linear_search (unw_addr_space_t as, unw_word_t ip, - unw_word_t eh_frame_start, unw_word_t eh_frame_end, - unw_word_t fde_count, - unw_proc_info_t *pi, int need_unwind_info, void *arg) + unw_word_t eh_frame_start, unw_word_t eh_frame_end, + unw_word_t fde_count, + unw_proc_info_t *pi, int need_unwind_info, void *arg) { unw_accessors_t *a = unw_get_accessors (unw_local_addr_space); unw_word_t i = 0, fde_addr, addr = eh_frame_start; @@ -60,21 +60,21 @@ linear_search (unw_addr_space_t as, unw_word_t ip, { fde_addr = addr; if ((ret = dwarf_extract_proc_info_from_fde (as, a, &addr, pi, 0, 0, arg)) - < 0) - return ret; + < 0) + return ret; if (ip >= pi->start_ip && ip < pi->end_ip) - { - if (!need_unwind_info) - return 1; - addr = fde_addr; - if ((ret = dwarf_extract_proc_info_from_fde (as, a, &addr, pi, - need_unwind_info, 0, - arg)) - < 0) - return ret; - return 1; - } + { + if (!need_unwind_info) + return 1; + addr = fde_addr; + if ((ret = dwarf_extract_proc_info_from_fde (as, a, &addr, pi, + need_unwind_info, 0, + arg)) + < 0) + return ret; + return 1; + } } return -UNW_ENOINFO; } @@ -124,7 +124,7 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local) goto file_error; Debug (4, "loading string table of size %zd\n", - sec_hdrs[shstrndx].sh_size); + sec_hdrs[shstrndx].sh_size); stringtab = malloc (sec_hdrs[shstrndx].sh_size); fseek (f, sec_hdrs[shstrndx].sh_offset, SEEK_SET); if (fread (stringtab, 1, sec_hdrs[shstrndx].sh_size, f) != sec_hdrs[shstrndx].sh_size) @@ -136,28 +136,28 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local) if (strcmp (secname, ".debug_frame") == 0) { - *bufsize = sec_hdrs[i].sh_size; - *buf = malloc (*bufsize); + *bufsize = sec_hdrs[i].sh_size; + *buf = malloc (*bufsize); - fseek (f, sec_hdrs[i].sh_offset, SEEK_SET); - if (fread (*buf, 1, *bufsize, f) != *bufsize) - goto file_error; + fseek (f, sec_hdrs[i].sh_offset, SEEK_SET); + if (fread (*buf, 1, *bufsize, f) != *bufsize) + goto file_error; - Debug (4, "read %zd bytes of .debug_frame from offset %zd\n", - *bufsize, sec_hdrs[i].sh_offset); - } + Debug (4, "read %zd bytes of .debug_frame from offset %zd\n", + *bufsize, sec_hdrs[i].sh_offset); + } else if (strcmp (secname, ".gnu_debuglink") == 0) - { - linksize = sec_hdrs[i].sh_size; - linkbuf = malloc (linksize); + { + linksize = sec_hdrs[i].sh_size; + linkbuf = malloc (linksize); - fseek (f, sec_hdrs[i].sh_offset, SEEK_SET); - if (fread (linkbuf, 1, linksize, f) != linksize) - goto file_error; + fseek (f, sec_hdrs[i].sh_offset, SEEK_SET); + if (fread (linkbuf, 1, linksize, f) != linksize) + goto file_error; - Debug (4, "read %zd bytes of .gnu_debuglink from offset %zd\n", - linksize, sec_hdrs[i].sh_offset); - } + Debug (4, "read %zd bytes of .gnu_debuglink from offset %zd\n", + linksize, sec_hdrs[i].sh_offset); + } } free (stringtab); @@ -181,16 +181,16 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local) /* XXX: Don't bother with the checksum; just search for the file. */ basedir = malloc (strlen (file) + 1); newname = malloc (strlen (linkbuf) + strlen (debugdir) - + strlen (file) + 9); + + strlen (file) + 9); p = strrchr (file, '/'); if (p != NULL) - { - memcpy (basedir, file, p - file); - basedir[p - file] = '\0'; - } + { + memcpy (basedir, file, p - file); + basedir[p - file] = '\0'; + } else - basedir[0] = 0; + basedir[0] = 0; strcpy (newname, basedir); strcat (newname, "/"); @@ -198,21 +198,21 @@ load_debug_frame (const char *file, char **buf, size_t *bufsize, int is_local) ret = load_debug_frame (newname, buf, bufsize, -1); if (ret == 1) - { - strcpy (newname, basedir); - strcat (newname, "/.debug/"); - strcat (newname, linkbuf); - ret = load_debug_frame (newname, buf, bufsize, -1); - } + { + strcpy (newname, basedir); + strcat (newname, "/.debug/"); + strcat (newname, linkbuf); + ret = load_debug_frame (newname, buf, bufsize, -1); + } if (ret == 1 && is_local == 1) - { - strcpy (newname, debugdir); - strcat (newname, basedir); - strcat (newname, "/"); - strcat (newname, linkbuf); - ret = load_debug_frame (newname, buf, bufsize, -1); - } + { + strcpy (newname, debugdir); + strcat (newname, basedir); + strcat (newname, "/"); + strcat (newname, linkbuf); + ret = load_debug_frame (newname, buf, bufsize, -1); + } free (basedir); free (newname); @@ -248,14 +248,14 @@ find_binary_for_address (unw_word_t ip, char *name, size_t name_size) while (maps_next (&mi, &segbase, &hi, &mapoff)) if (ip >= segbase && ip < hi) { - size_t len = strlen (mi.path); + size_t len = strlen (mi.path); - if (len + 1 <= name_size) - { - memcpy (name, mi.path, len + 1); - found = 1; - } - break; + if (len + 1 <= name_size) + { + memcpy (name, mi.path, len + 1); + found = 1; + } + break; } maps_close (&mi); return !found; @@ -269,7 +269,7 @@ find_binary_for_address (unw_word_t ip, char *name, size_t name_size) static struct unw_debug_frame_list * locate_debug_info (unw_addr_space_t as, unw_word_t addr, const char *dlname, - unw_word_t start, unw_word_t end) + unw_word_t start, unw_word_t end) { struct unw_debug_frame_list *w, *fdesc = 0; char path[PATH_MAX]; @@ -284,7 +284,7 @@ locate_debug_info (unw_addr_space_t as, unw_word_t addr, const char *dlname, { Debug (4, "checking %p: %lx-%lx\n", w, (long)w->start, (long)w->end); if (addr >= w->start && addr < w->end) - return w; + return w; } /* If the object name we receive is blank, there's still a chance of locating @@ -295,10 +295,10 @@ locate_debug_info (unw_addr_space_t as, unw_word_t addr, const char *dlname, err = find_binary_for_address (addr, name, sizeof(path)); if (err) { - Debug (15, "tried to locate binary for 0x%" PRIx64 ", but no luck\n", - (uint64_t) addr); + Debug (15, "tried to locate binary for 0x%" PRIx64 ", but no luck\n", + (uint64_t) addr); return 0; - } + } } else name = (char*) dlname; @@ -331,7 +331,7 @@ struct debug_frame_tab static void debug_frame_tab_append (struct debug_frame_tab *tab, - unw_word_t fde_offset, unw_word_t start_ip) + unw_word_t fde_offset, unw_word_t start_ip) { unsigned int length = tab->length; @@ -372,8 +372,8 @@ debug_frame_tab_compare (const void *a, const void *b) PROTECTED int dwarf_find_debug_frame (int found, unw_dyn_info_t *di_debug, unw_word_t ip, - unw_word_t segbase, const char* obj_name, - unw_word_t start, unw_word_t end) + unw_word_t segbase, const char* obj_name, + unw_word_t start, unw_word_t end) { unw_dyn_info_t *di; struct unw_debug_frame_list *fdesc = 0; @@ -546,11 +546,11 @@ dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr) /* Make sure struct dl_phdr_info is at least as big as we need. */ if (size < offsetof (struct dl_phdr_info, dlpi_phnum) - + sizeof (info->dlpi_phnum)) + + sizeof (info->dlpi_phnum)) return -1; Debug (15, "checking %s, base=0x%lx)\n", - info->dlpi_name, (long) info->dlpi_addr); + info->dlpi_name, (long) info->dlpi_addr); phdr = info->dlpi_phdr; load_base = info->dlpi_addr; @@ -563,19 +563,19 @@ dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr) for (n = info->dlpi_phnum; --n >= 0; phdr++) { if (phdr->p_type == PT_LOAD) - { - Elf_W(Addr) vaddr = phdr->p_vaddr + load_base; + { + Elf_W(Addr) vaddr = phdr->p_vaddr + load_base; - if (ip >= vaddr && ip < vaddr + phdr->p_memsz) - p_text = phdr; + if (ip >= vaddr && ip < vaddr + phdr->p_memsz) + p_text = phdr; - if (vaddr + phdr->p_filesz > max_load_addr) - max_load_addr = vaddr + phdr->p_filesz; - } + if (vaddr + phdr->p_filesz > max_load_addr) + max_load_addr = vaddr + phdr->p_filesz; + } else if (phdr->p_type == PT_GNU_EH_FRAME) - p_eh_hdr = phdr; + p_eh_hdr = phdr; else if (phdr->p_type == PT_DYNAMIC) - p_dynamic = phdr; + p_dynamic = phdr; } if (!p_text) @@ -584,97 +584,97 @@ dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr) if (p_eh_hdr) { if (p_dynamic) - { - /* For dynamicly linked executables and shared libraries, - DT_PLTGOT is the value that data-relative addresses are - relative to for that object. We call this the "gp". */ - Elf_W(Dyn) *dyn = (Elf_W(Dyn) *)(p_dynamic->p_vaddr + load_base); - for (; dyn->d_tag != DT_NULL; ++dyn) - if (dyn->d_tag == DT_PLTGOT) - { - /* Assume that _DYNAMIC is writable and GLIBC has - relocated it (true for x86 at least). */ - di->gp = dyn->d_un.d_ptr; - break; - } - } + { + /* For dynamicly linked executables and shared libraries, + DT_PLTGOT is the value that data-relative addresses are + relative to for that object. We call this the "gp". */ + Elf_W(Dyn) *dyn = (Elf_W(Dyn) *)(p_dynamic->p_vaddr + load_base); + for (; dyn->d_tag != DT_NULL; ++dyn) + if (dyn->d_tag == DT_PLTGOT) + { + /* Assume that _DYNAMIC is writable and GLIBC has + relocated it (true for x86 at least). */ + di->gp = dyn->d_un.d_ptr; + break; + } + } else - /* Otherwise this is a static executable with no _DYNAMIC. Assume - that data-relative addresses are relative to 0, i.e., - absolute. */ - di->gp = 0; + /* Otherwise this is a static executable with no _DYNAMIC. Assume + that data-relative addresses are relative to 0, i.e., + absolute. */ + di->gp = 0; pi->gp = di->gp; hdr = (struct dwarf_eh_frame_hdr *) (p_eh_hdr->p_vaddr + load_base); if (hdr->version != DW_EH_VERSION) - { - Debug (1, "table `%s' has unexpected version %d\n", - info->dlpi_name, hdr->version); - return 0; - } + { + Debug (1, "table `%s' has unexpected version %d\n", + info->dlpi_name, hdr->version); + return 0; + } a = unw_get_accessors (unw_local_addr_space); addr = (unw_word_t) (uintptr_t) (hdr + 1); /* (Optionally) read eh_frame_ptr: */ if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a, - &addr, hdr->eh_frame_ptr_enc, pi, - &eh_frame_start, NULL)) < 0) - return ret; + &addr, hdr->eh_frame_ptr_enc, pi, + &eh_frame_start, NULL)) < 0) + return ret; /* (Optionally) read fde_count: */ if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a, - &addr, hdr->fde_count_enc, pi, - &fde_count, NULL)) < 0) - return ret; + &addr, hdr->fde_count_enc, pi, + &fde_count, NULL)) < 0) + return ret; if (hdr->table_enc != (DW_EH_PE_datarel | DW_EH_PE_sdata4)) - { - /* If there is no search table or it has an unsupported - encoding, fall back on linear search. */ - if (hdr->table_enc == DW_EH_PE_omit) - Debug (4, "table `%s' lacks search table; doing linear search\n", - info->dlpi_name); - else - Debug (4, "table `%s' has encoding 0x%x; doing linear search\n", - info->dlpi_name, hdr->table_enc); + { + /* If there is no search table or it has an unsupported + encoding, fall back on linear search. */ + if (hdr->table_enc == DW_EH_PE_omit) + Debug (4, "table `%s' lacks search table; doing linear search\n", + info->dlpi_name); + else + Debug (4, "table `%s' has encoding 0x%x; doing linear search\n", + info->dlpi_name, hdr->table_enc); - eh_frame_end = max_load_addr; /* XXX can we do better? */ + eh_frame_end = max_load_addr; /* XXX can we do better? */ - if (hdr->fde_count_enc == DW_EH_PE_omit) - fde_count = ~0UL; - if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit) - abort (); + if (hdr->fde_count_enc == DW_EH_PE_omit) + fde_count = ~0UL; + if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit) + abort (); - /* XXX we know how to build a local binary search table for - .debug_frame, so we could do that here too. */ - cb_data->single_fde = 1; - found = linear_search (unw_local_addr_space, ip, - eh_frame_start, eh_frame_end, fde_count, - pi, need_unwind_info, NULL); - if (found != 1) - found = 0; - } + /* XXX we know how to build a local binary search table for + .debug_frame, so we could do that here too. */ + cb_data->single_fde = 1; + found = linear_search (unw_local_addr_space, ip, + eh_frame_start, eh_frame_end, fde_count, + pi, need_unwind_info, NULL); + if (found != 1) + found = 0; + } else - { - di->format = UNW_INFO_FORMAT_REMOTE_TABLE; - di->start_ip = p_text->p_vaddr + load_base; - di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz; - di->u.rti.name_ptr = (unw_word_t) (uintptr_t) info->dlpi_name; - di->u.rti.table_data = addr; - assert (sizeof (struct table_entry) % sizeof (unw_word_t) == 0); - di->u.rti.table_len = (fde_count * sizeof (struct table_entry) - / sizeof (unw_word_t)); - /* For the binary-search table in the eh_frame_hdr, data-relative - means relative to the start of that section... */ - di->u.rti.segbase = (unw_word_t) (uintptr_t) hdr; + { + di->format = UNW_INFO_FORMAT_REMOTE_TABLE; + di->start_ip = p_text->p_vaddr + load_base; + di->end_ip = p_text->p_vaddr + load_base + p_text->p_memsz; + di->u.rti.name_ptr = (unw_word_t) (uintptr_t) info->dlpi_name; + di->u.rti.table_data = addr; + assert (sizeof (struct table_entry) % sizeof (unw_word_t) == 0); + di->u.rti.table_len = (fde_count * sizeof (struct table_entry) + / sizeof (unw_word_t)); + /* For the binary-search table in the eh_frame_hdr, data-relative + means relative to the start of that section... */ + di->u.rti.segbase = (unw_word_t) (uintptr_t) hdr; - found = 1; - Debug (15, "found table `%s': segbase=0x%lx, len=%lu, gp=0x%lx, " - "table_data=0x%lx\n", (char *) (uintptr_t) di->u.rti.name_ptr, - (long) di->u.rti.segbase, (long) di->u.rti.table_len, - (long) di->gp, (long) di->u.rti.table_data); - } + found = 1; + Debug (15, "found table `%s': segbase=0x%lx, len=%lu, gp=0x%lx, " + "table_data=0x%lx\n", (char *) (uintptr_t) di->u.rti.name_ptr, + (long) di->u.rti.segbase, (long) di->u.rti.table_len, + (long) di->gp, (long) di->u.rti.table_data); + } } #ifdef CONFIG_DEBUG_FRAME @@ -687,20 +687,20 @@ dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr) { if (info->dlpi_phdr[n].p_type == PT_LOAD) { - unw_word_t seg_start = info->dlpi_addr + info->dlpi_phdr[n].p_vaddr; + unw_word_t seg_start = info->dlpi_addr + info->dlpi_phdr[n].p_vaddr; unw_word_t seg_end = seg_start + info->dlpi_phdr[n].p_memsz; - if (seg_start < start) - start = seg_start; + if (seg_start < start) + start = seg_start; - if (seg_end > end) - end = seg_end; - } + if (seg_end > end) + end = seg_end; + } } found = dwarf_find_debug_frame (found, &cb_data->di_debug, ip, - info->dlpi_addr, info->dlpi_name, start, - end); + info->dlpi_addr, info->dlpi_name, start, + end); #endif /* CONFIG_DEBUG_FRAME */ return found; @@ -708,7 +708,7 @@ dwarf_callback (struct dl_phdr_info *info, size_t size, void *ptr) HIDDEN int dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, int need_unwind_info, void *arg) + unw_proc_info_t *pi, int need_unwind_info, void *arg) { struct dwarf_callback_data cb_data; intrmask_t saved_mask; @@ -740,13 +740,13 @@ dwarf_find_proc_info (unw_addr_space_t as, unw_word_t ip, /* search the table: */ if (cb_data.di.format != -1) ret = dwarf_search_unwind_table (as, ip, &cb_data.di, - pi, need_unwind_info, arg); + pi, need_unwind_info, arg); else ret = -UNW_ENOINFO; if (ret == -UNW_ENOINFO && cb_data.di_debug.format != -1) ret = dwarf_search_unwind_table (as, ip, &cb_data.di_debug, pi, - need_unwind_info, arg); + need_unwind_info, arg); return ret; } @@ -764,12 +764,12 @@ lookup (const struct table_entry *table, size_t table_size, int32_t rel_ip) e = table + mid; Debug (15, "e->start_ip_offset = %lx\n", (long) e->start_ip_offset); if (rel_ip < e->start_ip_offset) - hi = mid; + hi = mid; else - lo = mid + 1; + lo = mid + 1; } if (hi <= 0) - return NULL; + return NULL; e = table + hi - 1; return e; } @@ -783,8 +783,8 @@ lookup (const struct table_entry *table, size_t table_size, int32_t rel_ip) occurred reading remote memory. */ static int remote_lookup (unw_addr_space_t as, - unw_word_t table, size_t table_size, int32_t rel_ip, - struct table_entry *e, void *arg) + unw_word_t table, size_t table_size, int32_t rel_ip, + struct table_entry *e, void *arg) { unsigned long table_len = table_size / sizeof (struct table_entry); unw_accessors_t *a = unw_get_accessors (as); @@ -799,12 +799,12 @@ remote_lookup (unw_addr_space_t as, mid = (lo + hi) / 2; e_addr = table + mid * sizeof (struct table_entry); if ((ret = dwarf_reads32 (as, a, &e_addr, &start, arg)) < 0) - return ret; + return ret; if (rel_ip < start) - hi = mid; + hi = mid; else - lo = mid + 1; + lo = mid + 1; } if (hi <= 0) return 0; @@ -819,8 +819,8 @@ remote_lookup (unw_addr_space_t as, PROTECTED int dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg) + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg) { const struct table_entry *e = NULL, *table; unw_word_t segbase = 0, fde_addr; @@ -836,7 +836,7 @@ dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip, assert (di->format == UNW_INFO_FORMAT_REMOTE_TABLE); #else assert (di->format == UNW_INFO_FORMAT_REMOTE_TABLE - || di->format == UNW_INFO_FORMAT_TABLE); + || di->format == UNW_INFO_FORMAT_TABLE); #endif assert (ip >= di->start_ip && ip < di->end_ip); @@ -876,34 +876,34 @@ dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip, #ifndef UNW_LOCAL_ONLY segbase = di->u.rti.segbase; if ((ret = remote_lookup (as, (uintptr_t) table, table_len, - ip - segbase, &ent, arg)) < 0) - return ret; + ip - segbase, &ent, arg)) < 0) + return ret; if (ret) - e = &ent; + e = &ent; else - e = NULL; /* no info found */ + e = NULL; /* no info found */ #endif } if (!e) { Debug (1, "IP %lx inside range %lx-%lx, but no explicit unwind info found\n", - (long) ip, (long) di->start_ip, (long) di->end_ip); + (long) ip, (long) di->start_ip, (long) di->end_ip); /* IP is inside this table's range, but there is no explicit - unwind info. */ + unwind info. */ return -UNW_ENOINFO; } Debug (15, "ip=0x%lx, start_ip=0x%lx\n", - (long) ip, (long) (e->start_ip_offset)); + (long) ip, (long) (e->start_ip_offset)); if (debug_frame_base) fde_addr = e->fde_offset + debug_frame_base; else fde_addr = e->fde_offset + segbase; Debug (1, "e->fde_offset = %lx, segbase = %lx, debug_frame_base = %lx, " - "fde_addr = %lx\n", (long) e->fde_offset, (long) segbase, - (long) debug_frame_base, (long) fde_addr); + "fde_addr = %lx\n", (long) e->fde_offset, (long) segbase, + (long) debug_frame_base, (long) fde_addr); if ((ret = dwarf_extract_proc_info_from_fde (as, a, &fde_addr, pi, - need_unwind_info, - debug_frame_base, arg)) < 0) + need_unwind_info, + debug_frame_base, arg)) < 0) return ret; /* .debug_frame uses an absolute encoding that does not know about any @@ -924,5 +924,5 @@ dwarf_search_unwind_table (unw_addr_space_t as, unw_word_t ip, HIDDEN void dwarf_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, void *arg) { - return; /* always a nop */ + return; /* always a nop */ } diff --git a/src/dwarf/Gfind_unwind_table.c b/src/dwarf/Gfind_unwind_table.c index eb01ae90..a51c611b 100644 --- a/src/dwarf/Gfind_unwind_table.c +++ b/src/dwarf/Gfind_unwind_table.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -35,8 +35,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ int dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, - char *path, unw_word_t segbase, unw_word_t mapoff, - unw_word_t ip) + char *path, unw_word_t segbase, unw_word_t mapoff, + unw_word_t ip) { Elf_W(Phdr) *phdr, *ptxt = NULL, *peh_hdr = NULL, *pdyn = NULL; unw_word_t addr, eh_frame_start, fde_count, load_base; @@ -63,37 +63,37 @@ dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, for (i = 0; i < ehdr->e_phnum; ++i) { switch (phdr[i].p_type) - { - case PT_LOAD: - if (phdr[i].p_vaddr < start_ip) - start_ip = phdr[i].p_vaddr; + { + case PT_LOAD: + if (phdr[i].p_vaddr < start_ip) + start_ip = phdr[i].p_vaddr; - if (phdr[i].p_vaddr + phdr[i].p_memsz > end_ip) - end_ip = phdr[i].p_vaddr + phdr[i].p_memsz; + if (phdr[i].p_vaddr + phdr[i].p_memsz > end_ip) + end_ip = phdr[i].p_vaddr + phdr[i].p_memsz; - if (phdr[i].p_offset == mapoff) - ptxt = phdr + i; - if ((uintptr_t) edi->ei.image + phdr->p_filesz > max_load_addr) - max_load_addr = (uintptr_t) edi->ei.image + phdr->p_filesz; - break; + if (phdr[i].p_offset == mapoff) + ptxt = phdr + i; + if ((uintptr_t) edi->ei.image + phdr->p_filesz > max_load_addr) + max_load_addr = (uintptr_t) edi->ei.image + phdr->p_filesz; + break; - case PT_GNU_EH_FRAME: - peh_hdr = phdr + i; - break; + case PT_GNU_EH_FRAME: + peh_hdr = phdr + i; + break; - case PT_DYNAMIC: - pdyn = phdr + i; - break; + case PT_DYNAMIC: + pdyn = phdr + i; + break; #if UNW_TARGET_ARM - case PT_ARM_EXIDX: - parm_exidx = phdr + i; - break; + case PT_ARM_EXIDX: + parm_exidx = phdr + i; + break; #endif - default: - break; - } + default: + break; + } } if (!ptxt) @@ -106,85 +106,85 @@ dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, if (peh_hdr) { if (pdyn) - { - /* For dynamicly linked executables and shared libraries, - DT_PLTGOT is the value that data-relative addresses are - relative to for that object. We call this the "gp". */ - Elf_W(Dyn) *dyn = (Elf_W(Dyn) *)(pdyn->p_offset - + (char *) edi->ei.image); - for (; dyn->d_tag != DT_NULL; ++dyn) - if (dyn->d_tag == DT_PLTGOT) - { - /* Assume that _DYNAMIC is writable and GLIBC has - relocated it (true for x86 at least). */ - edi->di_cache.gp = dyn->d_un.d_ptr; - break; - } - } + { + /* For dynamicly linked executables and shared libraries, + DT_PLTGOT is the value that data-relative addresses are + relative to for that object. We call this the "gp". */ + Elf_W(Dyn) *dyn = (Elf_W(Dyn) *)(pdyn->p_offset + + (char *) edi->ei.image); + for (; dyn->d_tag != DT_NULL; ++dyn) + if (dyn->d_tag == DT_PLTGOT) + { + /* Assume that _DYNAMIC is writable and GLIBC has + relocated it (true for x86 at least). */ + edi->di_cache.gp = dyn->d_un.d_ptr; + break; + } + } else - /* Otherwise this is a static executable with no _DYNAMIC. Assume - that data-relative addresses are relative to 0, i.e., - absolute. */ - edi->di_cache.gp = 0; + /* Otherwise this is a static executable with no _DYNAMIC. Assume + that data-relative addresses are relative to 0, i.e., + absolute. */ + edi->di_cache.gp = 0; hdr = (struct dwarf_eh_frame_hdr *) (peh_hdr->p_offset - + (char *) edi->ei.image); + + (char *) edi->ei.image); if (hdr->version != DW_EH_VERSION) - { - Debug (1, "table `%s' has unexpected version %d\n", - path, hdr->version); - return -UNW_ENOINFO; - } + { + Debug (1, "table `%s' has unexpected version %d\n", + path, hdr->version); + return -UNW_ENOINFO; + } a = unw_get_accessors (unw_local_addr_space); addr = (unw_word_t) (hdr + 1); /* Fill in a dummy proc_info structure. We just need to fill in - enough to ensure that dwarf_read_encoded_pointer() can do it's - job. Since we don't have a procedure-context at this point, all - we have to do is fill in the global-pointer. */ + enough to ensure that dwarf_read_encoded_pointer() can do it's + job. Since we don't have a procedure-context at this point, all + we have to do is fill in the global-pointer. */ memset (&pi, 0, sizeof (pi)); pi.gp = edi->di_cache.gp; /* (Optionally) read eh_frame_ptr: */ if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a, - &addr, hdr->eh_frame_ptr_enc, &pi, - &eh_frame_start, NULL)) < 0) - return -UNW_ENOINFO; + &addr, hdr->eh_frame_ptr_enc, &pi, + &eh_frame_start, NULL)) < 0) + return -UNW_ENOINFO; /* (Optionally) read fde_count: */ if ((ret = dwarf_read_encoded_pointer (unw_local_addr_space, a, - &addr, hdr->fde_count_enc, &pi, - &fde_count, NULL)) < 0) - return -UNW_ENOINFO; + &addr, hdr->fde_count_enc, &pi, + &fde_count, NULL)) < 0) + return -UNW_ENOINFO; if (hdr->table_enc != (DW_EH_PE_datarel | DW_EH_PE_sdata4)) - { + { #if 1 - abort (); + abort (); #else - unw_word_t eh_frame_end; + unw_word_t eh_frame_end; - /* If there is no search table or it has an unsupported - encoding, fall back on linear search. */ - if (hdr->table_enc == DW_EH_PE_omit) - Debug (4, "EH lacks search table; doing linear search\n"); - else - Debug (4, "EH table has encoding 0x%x; doing linear search\n", - hdr->table_enc); + /* If there is no search table or it has an unsupported + encoding, fall back on linear search. */ + if (hdr->table_enc == DW_EH_PE_omit) + Debug (4, "EH lacks search table; doing linear search\n"); + else + Debug (4, "EH table has encoding 0x%x; doing linear search\n", + hdr->table_enc); - eh_frame_end = max_load_addr; /* XXX can we do better? */ + eh_frame_end = max_load_addr; /* XXX can we do better? */ - if (hdr->fde_count_enc == DW_EH_PE_omit) - fde_count = ~0UL; - if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit) - abort (); + if (hdr->fde_count_enc == DW_EH_PE_omit) + fde_count = ~0UL; + if (hdr->eh_frame_ptr_enc == DW_EH_PE_omit) + abort (); - return linear_search (unw_local_addr_space, ip, - eh_frame_start, eh_frame_end, fde_count, - pi, need_unwind_info, NULL); + return linear_search (unw_local_addr_space, ip, + eh_frame_start, eh_frame_end, fde_count, + pi, need_unwind_info, NULL); #endif - } + } edi->di_cache.start_ip = start_ip; edi->di_cache.end_ip = end_ip; @@ -193,14 +193,14 @@ dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, /* two 32-bit values (ip_offset/fde_offset) per table-entry: */ edi->di_cache.u.rti.table_len = (fde_count * 8) / sizeof (unw_word_t); edi->di_cache.u.rti.table_data = ((load_base + peh_hdr->p_vaddr) - + (addr - (unw_word_t) edi->ei.image - - peh_hdr->p_offset)); + + (addr - (unw_word_t) edi->ei.image + - peh_hdr->p_offset)); /* For the binary-search table in the eh_frame_hdr, data-relative - means relative to the start of that section... */ + means relative to the start of that section... */ edi->di_cache.u.rti.segbase = ((load_base + peh_hdr->p_vaddr) - + ((unw_word_t) hdr - (unw_word_t) edi->ei.image - - peh_hdr->p_offset)); + + ((unw_word_t) hdr - (unw_word_t) edi->ei.image + - peh_hdr->p_offset)); found = 1; } @@ -220,7 +220,7 @@ dwarf_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, #ifdef CONFIG_DEBUG_FRAME /* Try .debug_frame. */ found = dwarf_find_debug_frame (found, &edi->di_debug, ip, load_base, path, - start_ip, end_ip); + start_ip, end_ip); #endif return found; diff --git a/src/dwarf/Gparser.c b/src/dwarf/Gparser.c index fefd8093..3a47255c 100644 --- a/src/dwarf/Gparser.c +++ b/src/dwarf/Gparser.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,12 +27,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "dwarf_i.h" #include "libunwind_i.h" -#define alloc_reg_state() (mempool_alloc (&dwarf_reg_state_pool)) -#define free_reg_state(rs) (mempool_free (&dwarf_reg_state_pool, rs)) +#define alloc_reg_state() (mempool_alloc (&dwarf_reg_state_pool)) +#define free_reg_state(rs) (mempool_free (&dwarf_reg_state_pool, rs)) static inline int read_regnum (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - unw_word_t *valp, void *arg) + unw_word_t *valp, void *arg) { int ret; @@ -49,7 +49,7 @@ read_regnum (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static inline void set_reg (dwarf_state_record_t *sr, unw_word_t regnum, dwarf_where_t where, - unw_word_t val) + unw_word_t val) { sr->rs_current.reg[regnum].where = where; sr->rs_current.reg[regnum].val = val; @@ -58,8 +58,8 @@ set_reg (dwarf_state_record_t *sr, unw_word_t regnum, dwarf_where_t where, /* Run a CFI program to update the register state. */ static int run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr, - unw_word_t ip, unw_word_t *addr, unw_word_t end_addr, - struct dwarf_cie_info *dci) + unw_word_t ip, unw_word_t *addr, unw_word_t end_addr, + struct dwarf_cie_info *dci) { unw_word_t curr_ip, operand = 0, regnum, val, len, fde_encoding; dwarf_reg_state_t *rs_stack = NULL, *new_rs, *old_rs; @@ -88,251 +88,251 @@ run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr, while (curr_ip <= ip && *addr < end_addr) { if ((ret = dwarf_readu8 (as, a, addr, &op, arg)) < 0) - return ret; + return ret; if (op & DWARF_CFA_OPCODE_MASK) - { - operand = op & DWARF_CFA_OPERAND_MASK; - op &= ~DWARF_CFA_OPERAND_MASK; - } + { + operand = op & DWARF_CFA_OPERAND_MASK; + op &= ~DWARF_CFA_OPERAND_MASK; + } switch ((dwarf_cfa_t) op) - { - case DW_CFA_advance_loc: - curr_ip += operand * dci->code_align; - Debug (15, "CFA_advance_loc to 0x%lx\n", (long) curr_ip); - break; + { + case DW_CFA_advance_loc: + curr_ip += operand * dci->code_align; + Debug (15, "CFA_advance_loc to 0x%lx\n", (long) curr_ip); + break; - case DW_CFA_advance_loc1: - if ((ret = dwarf_readu8 (as, a, addr, &u8, arg)) < 0) - goto fail; - curr_ip += u8 * dci->code_align; - Debug (15, "CFA_advance_loc1 to 0x%lx\n", (long) curr_ip); - break; + case DW_CFA_advance_loc1: + if ((ret = dwarf_readu8 (as, a, addr, &u8, arg)) < 0) + goto fail; + curr_ip += u8 * dci->code_align; + Debug (15, "CFA_advance_loc1 to 0x%lx\n", (long) curr_ip); + break; - case DW_CFA_advance_loc2: - if ((ret = dwarf_readu16 (as, a, addr, &u16, arg)) < 0) - goto fail; - curr_ip += u16 * dci->code_align; - Debug (15, "CFA_advance_loc2 to 0x%lx\n", (long) curr_ip); - break; + case DW_CFA_advance_loc2: + if ((ret = dwarf_readu16 (as, a, addr, &u16, arg)) < 0) + goto fail; + curr_ip += u16 * dci->code_align; + Debug (15, "CFA_advance_loc2 to 0x%lx\n", (long) curr_ip); + break; - case DW_CFA_advance_loc4: - if ((ret = dwarf_readu32 (as, a, addr, &u32, arg)) < 0) - goto fail; - curr_ip += u32 * dci->code_align; - Debug (15, "CFA_advance_loc4 to 0x%lx\n", (long) curr_ip); - break; + case DW_CFA_advance_loc4: + if ((ret = dwarf_readu32 (as, a, addr, &u32, arg)) < 0) + goto fail; + curr_ip += u32 * dci->code_align; + Debug (15, "CFA_advance_loc4 to 0x%lx\n", (long) curr_ip); + break; - case DW_CFA_MIPS_advance_loc8: + case DW_CFA_MIPS_advance_loc8: #ifdef UNW_TARGET_MIPS - { - uint64_t u64; + { + uint64_t u64; - if ((ret = dwarf_readu64 (as, a, addr, &u64, arg)) < 0) - goto fail; - curr_ip += u64 * dci->code_align; - Debug (15, "CFA_MIPS_advance_loc8\n"); - break; - } + if ((ret = dwarf_readu64 (as, a, addr, &u64, arg)) < 0) + goto fail; + curr_ip += u64 * dci->code_align; + Debug (15, "CFA_MIPS_advance_loc8\n"); + break; + } #else - Debug (1, "DW_CFA_MIPS_advance_loc8 on non-MIPS target\n"); - ret = -UNW_EINVAL; - goto fail; + Debug (1, "DW_CFA_MIPS_advance_loc8 on non-MIPS target\n"); + ret = -UNW_EINVAL; + goto fail; #endif - case DW_CFA_offset: - regnum = operand; - if (regnum >= DWARF_NUM_PRESERVED_REGS) - { - Debug (1, "Invalid register number %u in DW_cfa_OFFSET\n", - (unsigned int) regnum); - ret = -UNW_EBADREG; - goto fail; - } - if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) - goto fail; - set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align); - Debug (15, "CFA_offset r%lu at cfa+0x%lx\n", - (long) regnum, (long) (val * dci->data_align)); - break; + case DW_CFA_offset: + regnum = operand; + if (regnum >= DWARF_NUM_PRESERVED_REGS) + { + Debug (1, "Invalid register number %u in DW_cfa_OFFSET\n", + (unsigned int) regnum); + ret = -UNW_EBADREG; + goto fail; + } + if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align); + Debug (15, "CFA_offset r%lu at cfa+0x%lx\n", + (long) regnum, (long) (val * dci->data_align)); + break; - case DW_CFA_offset_extended: - if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) - goto fail; - set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align); - Debug (15, "CFA_offset_extended r%lu at cf+0x%lx\n", - (long) regnum, (long) (val * dci->data_align)); - break; + case DW_CFA_offset_extended: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align); + Debug (15, "CFA_offset_extended r%lu at cf+0x%lx\n", + (long) regnum, (long) (val * dci->data_align)); + break; - case DW_CFA_offset_extended_sf: - if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - || ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0)) - goto fail; - set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align); - Debug (15, "CFA_offset_extended_sf r%lu at cf+0x%lx\n", - (long) regnum, (long) (val * dci->data_align)); - break; + case DW_CFA_offset_extended_sf: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_CFAREL, val * dci->data_align); + Debug (15, "CFA_offset_extended_sf r%lu at cf+0x%lx\n", + (long) regnum, (long) (val * dci->data_align)); + break; - case DW_CFA_restore: - regnum = operand; - if (regnum >= DWARF_NUM_PRESERVED_REGS) - { - Debug (1, "Invalid register number %u in DW_CFA_restore\n", - (unsigned int) regnum); - ret = -UNW_EINVAL; - goto fail; - } - sr->rs_current.reg[regnum] = sr->rs_initial.reg[regnum]; - Debug (15, "CFA_restore r%lu\n", (long) regnum); - break; + case DW_CFA_restore: + regnum = operand; + if (regnum >= DWARF_NUM_PRESERVED_REGS) + { + Debug (1, "Invalid register number %u in DW_CFA_restore\n", + (unsigned int) regnum); + ret = -UNW_EINVAL; + goto fail; + } + sr->rs_current.reg[regnum] = sr->rs_initial.reg[regnum]; + Debug (15, "CFA_restore r%lu\n", (long) regnum); + break; - case DW_CFA_restore_extended: - if ((ret = dwarf_read_uleb128 (as, a, addr, ®num, arg)) < 0) - goto fail; - if (regnum >= DWARF_NUM_PRESERVED_REGS) - { - Debug (1, "Invalid register number %u in " - "DW_CFA_restore_extended\n", (unsigned int) regnum); - ret = -UNW_EINVAL; - goto fail; - } - sr->rs_current.reg[regnum] = sr->rs_initial.reg[regnum]; - Debug (15, "CFA_restore_extended r%lu\n", (long) regnum); - break; + case DW_CFA_restore_extended: + if ((ret = dwarf_read_uleb128 (as, a, addr, ®num, arg)) < 0) + goto fail; + if (regnum >= DWARF_NUM_PRESERVED_REGS) + { + Debug (1, "Invalid register number %u in " + "DW_CFA_restore_extended\n", (unsigned int) regnum); + ret = -UNW_EINVAL; + goto fail; + } + sr->rs_current.reg[regnum] = sr->rs_initial.reg[regnum]; + Debug (15, "CFA_restore_extended r%lu\n", (long) regnum); + break; - case DW_CFA_nop: - break; + case DW_CFA_nop: + break; - case DW_CFA_set_loc: - fde_encoding = dci->fde_encoding; - if ((ret = dwarf_read_encoded_pointer (as, a, addr, fde_encoding, - &c->pi, &curr_ip, - arg)) < 0) - goto fail; - Debug (15, "CFA_set_loc to 0x%lx\n", (long) curr_ip); - break; + case DW_CFA_set_loc: + fde_encoding = dci->fde_encoding; + if ((ret = dwarf_read_encoded_pointer (as, a, addr, fde_encoding, + &c->pi, &curr_ip, + arg)) < 0) + goto fail; + Debug (15, "CFA_set_loc to 0x%lx\n", (long) curr_ip); + break; - case DW_CFA_undefined: - if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - goto fail; - set_reg (sr, regnum, DWARF_WHERE_UNDEF, 0); - Debug (15, "CFA_undefined r%lu\n", (long) regnum); - break; + case DW_CFA_undefined: + if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_UNDEF, 0); + Debug (15, "CFA_undefined r%lu\n", (long) regnum); + break; - case DW_CFA_same_value: - if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - goto fail; - set_reg (sr, regnum, DWARF_WHERE_SAME, 0); - Debug (15, "CFA_same_value r%lu\n", (long) regnum); - break; + case DW_CFA_same_value: + if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_SAME, 0); + Debug (15, "CFA_same_value r%lu\n", (long) regnum); + break; - case DW_CFA_register: - if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) - goto fail; - set_reg (sr, regnum, DWARF_WHERE_REG, val); - Debug (15, "CFA_register r%lu to r%lu\n", (long) regnum, (long) val); - break; + case DW_CFA_register: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_REG, val); + Debug (15, "CFA_register r%lu to r%lu\n", (long) regnum, (long) val); + break; - case DW_CFA_remember_state: - new_rs = alloc_reg_state (); - if (!new_rs) - { - Debug (1, "Out of memory in DW_CFA_remember_state\n"); - ret = -UNW_ENOMEM; - goto fail; - } + case DW_CFA_remember_state: + new_rs = alloc_reg_state (); + if (!new_rs) + { + Debug (1, "Out of memory in DW_CFA_remember_state\n"); + ret = -UNW_ENOMEM; + goto fail; + } - memcpy (new_rs->reg, sr->rs_current.reg, sizeof (new_rs->reg)); - new_rs->next = rs_stack; - rs_stack = new_rs; - Debug (15, "CFA_remember_state\n"); - break; + memcpy (new_rs->reg, sr->rs_current.reg, sizeof (new_rs->reg)); + new_rs->next = rs_stack; + rs_stack = new_rs; + Debug (15, "CFA_remember_state\n"); + break; - case DW_CFA_restore_state: - if (!rs_stack) - { - Debug (1, "register-state stack underflow\n"); - ret = -UNW_EINVAL; - goto fail; - } - memcpy (&sr->rs_current.reg, &rs_stack->reg, sizeof (rs_stack->reg)); - old_rs = rs_stack; - rs_stack = rs_stack->next; - free_reg_state (old_rs); - Debug (15, "CFA_restore_state\n"); - break; + case DW_CFA_restore_state: + if (!rs_stack) + { + Debug (1, "register-state stack underflow\n"); + ret = -UNW_EINVAL; + goto fail; + } + memcpy (&sr->rs_current.reg, &rs_stack->reg, sizeof (rs_stack->reg)); + old_rs = rs_stack; + rs_stack = rs_stack->next; + free_reg_state (old_rs); + Debug (15, "CFA_restore_state\n"); + break; - case DW_CFA_def_cfa: - if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) - goto fail; - set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum); - set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */ - Debug (15, "CFA_def_cfa r%lu+0x%lx\n", (long) regnum, (long) val); - break; + case DW_CFA_def_cfa: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum); + set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */ + Debug (15, "CFA_def_cfa r%lu+0x%lx\n", (long) regnum, (long) val); + break; - case DW_CFA_def_cfa_sf: - if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - || ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0)) - goto fail; - set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum); - set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, - val * dci->data_align); /* factored! */ - Debug (15, "CFA_def_cfa_sf r%lu+0x%lx\n", - (long) regnum, (long) (val * dci->data_align)); - break; + case DW_CFA_def_cfa_sf: + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum); + set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, + val * dci->data_align); /* factored! */ + Debug (15, "CFA_def_cfa_sf r%lu+0x%lx\n", + (long) regnum, (long) (val * dci->data_align)); + break; - case DW_CFA_def_cfa_register: - if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - goto fail; - set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum); - Debug (15, "CFA_def_cfa_register r%lu\n", (long) regnum); - break; + case DW_CFA_def_cfa_register: + if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + goto fail; + set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_REG, regnum); + Debug (15, "CFA_def_cfa_register r%lu\n", (long) regnum); + break; - case DW_CFA_def_cfa_offset: - if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) - goto fail; - set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */ - Debug (15, "CFA_def_cfa_offset 0x%lx\n", (long) val); - break; + case DW_CFA_def_cfa_offset: + if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) + goto fail; + set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, val); /* NOT factored! */ + Debug (15, "CFA_def_cfa_offset 0x%lx\n", (long) val); + break; - case DW_CFA_def_cfa_offset_sf: - if ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0) - goto fail; - set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, - val * dci->data_align); /* factored! */ - Debug (15, "CFA_def_cfa_offset_sf 0x%lx\n", - (long) (val * dci->data_align)); - break; + case DW_CFA_def_cfa_offset_sf: + if ((ret = dwarf_read_sleb128 (as, a, addr, &val, arg)) < 0) + goto fail; + set_reg (sr, DWARF_CFA_OFF_COLUMN, 0, + val * dci->data_align); /* factored! */ + Debug (15, "CFA_def_cfa_offset_sf 0x%lx\n", + (long) (val * dci->data_align)); + break; - case DW_CFA_def_cfa_expression: - /* Save the address of the DW_FORM_block for later evaluation. */ - set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_EXPR, *addr); + case DW_CFA_def_cfa_expression: + /* Save the address of the DW_FORM_block for later evaluation. */ + set_reg (sr, DWARF_CFA_REG_COLUMN, DWARF_WHERE_EXPR, *addr); - if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0) - goto fail; + if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0) + goto fail; - Debug (15, "CFA_def_cfa_expr @ 0x%lx [%lu bytes]\n", - (long) *addr, (long) len); - *addr += len; - break; + Debug (15, "CFA_def_cfa_expr @ 0x%lx [%lu bytes]\n", + (long) *addr, (long) len); + *addr += len; + break; - case DW_CFA_expression: - if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - goto fail; + case DW_CFA_expression: + if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + goto fail; - /* Save the address of the DW_FORM_block for later evaluation. */ - set_reg (sr, regnum, DWARF_WHERE_EXPR, *addr); + /* Save the address of the DW_FORM_block for later evaluation. */ + set_reg (sr, regnum, DWARF_WHERE_EXPR, *addr); - if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0) - goto fail; + if ((ret = dwarf_read_uleb128 (as, a, addr, &len, arg)) < 0) + goto fail; - Debug (15, "CFA_expression r%lu @ 0x%lx [%lu bytes]\n", - (long) regnum, (long) addr, (long) len); - *addr += len; - break; + Debug (15, "CFA_expression r%lu @ 0x%lx [%lu bytes]\n", + (long) regnum, (long) addr, (long) len); + *addr += len; + break; case DW_CFA_val_expression: if ((ret = read_regnum (as, a, addr, ®num, arg)) < 0) @@ -350,42 +350,42 @@ run_cfi_program (struct dwarf_cursor *c, dwarf_state_record_t *sr, break; case DW_CFA_GNU_args_size: - if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) - goto fail; - sr->args_size = val; - Debug (15, "CFA_GNU_args_size %lu\n", (long) val); - break; + if ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0) + goto fail; + sr->args_size = val; + Debug (15, "CFA_GNU_args_size %lu\n", (long) val); + break; - case DW_CFA_GNU_negative_offset_extended: - /* A comment in GCC says that this is obsoleted by - DW_CFA_offset_extended_sf, but that it's used by older - PowerPC code. */ - if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) - || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) - goto fail; - set_reg (sr, regnum, DWARF_WHERE_CFAREL, -(val * dci->data_align)); - Debug (15, "CFA_GNU_negative_offset_extended cfa+0x%lx\n", - (long) -(val * dci->data_align)); - break; + case DW_CFA_GNU_negative_offset_extended: + /* A comment in GCC says that this is obsoleted by + DW_CFA_offset_extended_sf, but that it's used by older + PowerPC code. */ + if (((ret = read_regnum (as, a, addr, ®num, arg)) < 0) + || ((ret = dwarf_read_uleb128 (as, a, addr, &val, arg)) < 0)) + goto fail; + set_reg (sr, regnum, DWARF_WHERE_CFAREL, -(val * dci->data_align)); + Debug (15, "CFA_GNU_negative_offset_extended cfa+0x%lx\n", + (long) -(val * dci->data_align)); + break; - case DW_CFA_GNU_window_save: + case DW_CFA_GNU_window_save: #ifdef UNW_TARGET_SPARC - /* This is a special CFA to handle all 16 windowed registers - on SPARC. */ - for (regnum = 16; regnum < 32; ++regnum) - set_reg (sr, regnum, DWARF_WHERE_CFAREL, - (regnum - 16) * sizeof (unw_word_t)); - Debug (15, "CFA_GNU_window_save\n"); - break; + /* This is a special CFA to handle all 16 windowed registers + on SPARC. */ + for (regnum = 16; regnum < 32; ++regnum) + set_reg (sr, regnum, DWARF_WHERE_CFAREL, + (regnum - 16) * sizeof (unw_word_t)); + Debug (15, "CFA_GNU_window_save\n"); + break; #else - /* FALL THROUGH */ + /* FALL THROUGH */ #endif - case DW_CFA_lo_user: - case DW_CFA_hi_user: - Debug (1, "Unexpected CFA opcode 0x%x\n", op); - ret = -UNW_EINVAL; - goto fail; - } + case DW_CFA_lo_user: + case DW_CFA_hi_user: + Debug (1, "Unexpected CFA opcode 0x%x\n", op); + ret = -UNW_EINVAL; + goto fail; + } } ret = 0; @@ -430,12 +430,12 @@ fetch_proc_info (struct dwarf_cursor *c, unw_word_t ip, int need_unwind_info) /* check dynamic info first --- it overrides everything else */ ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, need_unwind_info, - c->as_arg); + c->as_arg); if (ret == -UNW_ENOINFO) { dynamic = 0; if ((ret = tdep_find_proc_info (c, ip, need_unwind_info)) < 0) - return ret; + return ret; } if (c->pi.format != UNW_INFO_FORMAT_DYNAMIC @@ -496,7 +496,7 @@ parse_fde (struct dwarf_cursor *c, unw_word_t ip, dwarf_state_record_t *sr) addr = dci->cie_instr_start; if ((ret = run_cfi_program (c, sr, ~(unw_word_t) 0, &addr, - dci->cie_instr_end, dci)) < 0) + dci->cie_instr_end, dci)) < 0) return ret; memcpy (&sr->rs_initial, &sr->rs_current, sizeof (sr->rs_initial)); @@ -519,7 +519,7 @@ flush_rs_cache (struct dwarf_rs_cache *cache) for (i = 0; i < DWARF_UNW_CACHE_SIZE; ++i) { if (i > 0) - cache->buckets[i].lru_chain = (i - 1); + cache->buckets[i].lru_chain = (i - 1); cache->buckets[i].coll_chain = -1; cache->buckets[i].ip = 0; cache->buckets[i].valid = 0; @@ -554,7 +554,7 @@ get_rs_cache (unw_addr_space_t as, intrmask_t *saved_maskp) static inline void put_rs_cache (unw_addr_space_t as, struct dwarf_rs_cache *cache, - intrmask_t *saved_maskp) + intrmask_t *saved_maskp) { assert (as->caching_policy != UNW_CACHE_NONE); @@ -567,7 +567,7 @@ static inline unw_hash_index_t CONST_ATTR hash (unw_word_t ip) { /* based on (sqrt(5)/2-1)*2^64 */ -# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL) +# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL) return ip * magic >> ((sizeof(unw_word_t) * 8) - DWARF_LOG_UNW_HASH_SIZE); } @@ -634,22 +634,22 @@ rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c) tmp = cache->buckets + cache->hash[index]; prev = NULL; while (1) - { - if (tmp == rs) - { - if (prev) - prev->coll_chain = tmp->coll_chain; - else - cache->hash[index] = tmp->coll_chain; - break; - } - else - prev = tmp; - if (tmp->coll_chain >= DWARF_UNW_CACHE_SIZE) - /* old rs wasn't in the hash-table */ - break; - tmp = cache->buckets + tmp->coll_chain; - } + { + if (tmp == rs) + { + if (prev) + prev->coll_chain = tmp->coll_chain; + else + cache->hash[index] = tmp->coll_chain; + break; + } + else + prev = tmp; + if (tmp->coll_chain >= DWARF_UNW_CACHE_SIZE) + /* old rs wasn't in the hash-table */ + break; + tmp = cache->buckets + tmp->coll_chain; + } } /* enter new rs in the hash table */ @@ -669,7 +669,7 @@ rs_new (struct dwarf_rs_cache *cache, struct dwarf_cursor * c) static int create_state_record_for (struct dwarf_cursor *c, dwarf_state_record_t *sr, - unw_word_t ip) + unw_word_t ip) { int i, ret; @@ -699,8 +699,8 @@ create_state_record_for (struct dwarf_cursor *c, dwarf_state_record_t *sr, static inline int eval_location_expr (struct dwarf_cursor *c, unw_addr_space_t as, - unw_accessors_t *a, unw_word_t addr, - dwarf_loc_t *locp, void *arg) + unw_accessors_t *a, unw_word_t addr, + dwarf_loc_t *locp, void *arg) { int ret, is_register; unw_word_t len, val; @@ -747,18 +747,18 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs) /* CFA is equal to [reg] + offset: */ /* As a special-case, if the stack-pointer is the CFA and the - stack-pointer wasn't saved, popping the CFA implicitly pops - the stack-pointer as well. */ + stack-pointer wasn't saved, popping the CFA implicitly pops + the stack-pointer as well. */ if ((rs->reg[DWARF_CFA_REG_COLUMN].val == UNW_TDEP_SP) && (UNW_TDEP_SP < ARRAY_SIZE(rs->reg)) - && (rs->reg[UNW_TDEP_SP].where == DWARF_WHERE_SAME)) - cfa = c->cfa; + && (rs->reg[UNW_TDEP_SP].where == DWARF_WHERE_SAME)) + cfa = c->cfa; else - { - regnum = dwarf_to_unw_regnum (rs->reg[DWARF_CFA_REG_COLUMN].val); - if ((ret = unw_get_reg ((unw_cursor_t *) c, regnum, &cfa)) < 0) - return ret; - } + { + regnum = dwarf_to_unw_regnum (rs->reg[DWARF_CFA_REG_COLUMN].val); + if ((ret = unw_get_reg ((unw_cursor_t *) c, regnum, &cfa)) < 0) + return ret; + } cfa += rs->reg[DWARF_CFA_OFF_COLUMN].val; } else @@ -769,37 +769,37 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs) addr = rs->reg[DWARF_CFA_REG_COLUMN].val; if ((ret = eval_location_expr (c, as, a, addr, &cfa_loc, arg)) < 0) - return ret; + return ret; /* the returned location better be a memory location... */ if (DWARF_IS_REG_LOC (cfa_loc)) - return -UNW_EBADFRAME; + return -UNW_EBADFRAME; cfa = DWARF_GET_LOC (cfa_loc); } for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) { switch ((dwarf_where_t) rs->reg[i].where) - { - case DWARF_WHERE_UNDEF: - c->loc[i] = DWARF_NULL_LOC; - break; + { + case DWARF_WHERE_UNDEF: + c->loc[i] = DWARF_NULL_LOC; + break; - case DWARF_WHERE_SAME: - break; + case DWARF_WHERE_SAME: + break; - case DWARF_WHERE_CFAREL: - c->loc[i] = DWARF_MEM_LOC (c, cfa + rs->reg[i].val); - break; + case DWARF_WHERE_CFAREL: + c->loc[i] = DWARF_MEM_LOC (c, cfa + rs->reg[i].val); + break; - case DWARF_WHERE_REG: - c->loc[i] = DWARF_REG_LOC (c, dwarf_to_unw_regnum (rs->reg[i].val)); - break; + case DWARF_WHERE_REG: + c->loc[i] = DWARF_REG_LOC (c, dwarf_to_unw_regnum (rs->reg[i].val)); + break; - case DWARF_WHERE_EXPR: - addr = rs->reg[i].val; - if ((ret = eval_location_expr (c, as, a, addr, c->loc + i, arg)) < 0) - return ret; - break; + case DWARF_WHERE_EXPR: + addr = rs->reg[i].val; + if ((ret = eval_location_expr (c, as, a, addr, c->loc + i, arg)) < 0) + return ret; + break; case DWARF_WHERE_VAL_EXPR: addr = rs->reg[i].val; @@ -807,7 +807,7 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs) return ret; c->loc[i] = DWARF_VAL_LOC (c, DWARF_GET_LOC (c->loc[i])); break; - } + } } c->cfa = cfa; @@ -826,7 +826,7 @@ apply_reg_state (struct dwarf_cursor *c, struct dwarf_reg_state *rs) if (c->ip == prev_ip && c->cfa == prev_cfa) { Dprintf ("%s: ip and cfa unchanged; stopping here (ip=0x%lx)\n", - __FUNCTION__, (long) c->ip); + __FUNCTION__, (long) c->ip); return -UNW_EBADFRAME; } @@ -883,12 +883,12 @@ dwarf_find_save_locs (struct dwarf_cursor *c) else { if ((ret = fetch_proc_info (c, c->ip, 1)) < 0 || - (ret = create_state_record_for (c, &sr, c->ip)) < 0) - { + (ret = create_state_record_for (c, &sr, c->ip)) < 0) + { put_rs_cache (c->as, cache, &saved_mask); put_unwind_info (c, &c->pi); - return ret; - } + return ret; + } rs = rs_new (cache, c); memcpy(rs, &sr.rs_current, offsetof(struct dwarf_reg_state, ip)); diff --git a/src/dwarf/Gpe.c b/src/dwarf/Gpe.c index c271d763..a0e37ba2 100644 --- a/src/dwarf/Gpe.c +++ b/src/dwarf/Gpe.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -30,10 +30,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int dwarf_read_encoded_pointer (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, unsigned char encoding, - const unw_proc_info_t *pi, - unw_word_t *valp, void *arg) + unw_word_t *addr, unsigned char encoding, + const unw_proc_info_t *pi, + unw_word_t *valp, void *arg) { return dwarf_read_encoded_pointer_inlined (as, a, addr, encoding, - pi, valp, arg); + pi, valp, arg); } diff --git a/src/dwarf/Gstep.c b/src/dwarf/Gstep.c index 7d899ded..d251af92 100644 --- a/src/dwarf/Gstep.c +++ b/src/dwarf/Gstep.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/dwarf/global.c b/src/dwarf/global.c index 4658ccfe..8d0957d3 100644 --- a/src/dwarf/global.c +++ b/src/dwarf/global.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/elf32.h b/src/elf32.h index 63fef836..2c7bca4c 100644 --- a/src/elf32.h +++ b/src/elf32.h @@ -2,7 +2,7 @@ #define elf32_h #ifndef ELF_CLASS -#define ELF_CLASS ELFCLASS32 +#define ELF_CLASS ELFCLASS32 #endif #include "elfxx.h" diff --git a/src/elf64.h b/src/elf64.h index fd10ed82..091fba8e 100644 --- a/src/elf64.h +++ b/src/elf64.h @@ -2,7 +2,7 @@ #define elf64_h #ifndef ELF_CLASS -#define ELF_CLASS ELFCLASS64 +#define ELF_CLASS ELFCLASS64 #endif #include "elfxx.h" diff --git a/src/elfxx.c b/src/elfxx.c index 7034e6d7..33fccba2 100644 --- a/src/elfxx.c +++ b/src/elfxx.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -43,8 +43,8 @@ elf_w (section_table) (struct elf_image *ei) if (soff + ehdr->e_shnum * ehdr->e_shentsize > ei->size) { Debug (1, "section table outside of image? (%lu > %lu)\n", - (unsigned long) (soff + ehdr->e_shnum * ehdr->e_shentsize), - (unsigned long) ei->size); + (unsigned long) (soff + ehdr->e_shnum * ehdr->e_shentsize), + (unsigned long) ei->size); return NULL; } @@ -65,8 +65,8 @@ elf_w (string_table) (struct elf_image *ei, int section) if (str_soff + ehdr->e_shentsize > ei->size) { Debug (1, "string shdr table outside of image? (%lu > %lu)\n", - (unsigned long) (str_soff + ehdr->e_shentsize), - (unsigned long) ei->size); + (unsigned long) (str_soff + ehdr->e_shentsize), + (unsigned long) ei->size); return NULL; } str_shdr = (Elf_W (Shdr) *) ((char *) ei->image + str_soff); @@ -74,8 +74,8 @@ elf_w (string_table) (struct elf_image *ei, int section) if (str_shdr->sh_offset + str_shdr->sh_size > ei->size) { Debug (1, "string table outside of image? (%lu > %lu)\n", - (unsigned long) (str_shdr->sh_offset + str_shdr->sh_size), - (unsigned long) ei->size); + (unsigned long) (str_shdr->sh_offset + str_shdr->sh_size), + (unsigned long) ei->size); return NULL; } @@ -85,9 +85,9 @@ elf_w (string_table) (struct elf_image *ei, int section) static int elf_w (lookup_symbol) (unw_addr_space_t as, - unw_word_t ip, struct elf_image *ei, - Elf_W (Addr) load_offset, - char *buf, size_t buf_len, Elf_W (Addr) *min_dist) + unw_word_t ip, struct elf_image *ei, + Elf_W (Addr) load_offset, + char *buf, size_t buf_len, Elf_W (Addr) *min_dist) { size_t syment_size; Elf_W (Ehdr) *ehdr = ei->image; @@ -107,50 +107,50 @@ elf_w (lookup_symbol) (unw_addr_space_t as, for (i = 0; i < ehdr->e_shnum; ++i) { switch (shdr->sh_type) - { - case SHT_SYMTAB: - case SHT_DYNSYM: - symtab = (Elf_W (Sym) *) ((char *) ei->image + shdr->sh_offset); - symtab_end = (Elf_W (Sym) *) ((char *) symtab + shdr->sh_size); - syment_size = shdr->sh_entsize; + { + case SHT_SYMTAB: + case SHT_DYNSYM: + symtab = (Elf_W (Sym) *) ((char *) ei->image + shdr->sh_offset); + symtab_end = (Elf_W (Sym) *) ((char *) symtab + shdr->sh_size); + syment_size = shdr->sh_entsize; - strtab = elf_w (string_table) (ei, shdr->sh_link); - if (!strtab) - break; + strtab = elf_w (string_table) (ei, shdr->sh_link); + if (!strtab) + break; - Debug (16, "symtab=0x%lx[%d]\n", - (long) shdr->sh_offset, shdr->sh_type); + Debug (16, "symtab=0x%lx[%d]\n", + (long) shdr->sh_offset, shdr->sh_type); - for (sym = symtab; - sym < symtab_end; - sym = (Elf_W (Sym) *) ((char *) sym + syment_size)) - { - if (ELF_W (ST_TYPE) (sym->st_info) == STT_FUNC - && sym->st_shndx != SHN_UNDEF) - { - val = sym->st_value; - if (sym->st_shndx != SHN_ABS) - val += load_offset; - if (tdep_get_func_addr (as, val, &val) < 0) - continue; - Debug (16, "0x%016lx info=0x%02x %s\n", - (long) val, sym->st_info, strtab + sym->st_name); + for (sym = symtab; + sym < symtab_end; + sym = (Elf_W (Sym) *) ((char *) sym + syment_size)) + { + if (ELF_W (ST_TYPE) (sym->st_info) == STT_FUNC + && sym->st_shndx != SHN_UNDEF) + { + val = sym->st_value; + if (sym->st_shndx != SHN_ABS) + val += load_offset; + if (tdep_get_func_addr (as, val, &val) < 0) + continue; + Debug (16, "0x%016lx info=0x%02x %s\n", + (long) val, sym->st_info, strtab + sym->st_name); - if ((Elf_W (Addr)) (ip - val) < *min_dist) - { - *min_dist = (Elf_W (Addr)) (ip - val); - strncpy (buf, strtab + sym->st_name, buf_len); - buf[buf_len - 1] = '\0'; - ret = (strlen (strtab + sym->st_name) >= buf_len - ? -UNW_ENOMEM : 0); - } - } - } - break; + if ((Elf_W (Addr)) (ip - val) < *min_dist) + { + *min_dist = (Elf_W (Addr)) (ip - val); + strncpy (buf, strtab + sym->st_name, buf_len); + buf[buf_len - 1] = '\0'; + ret = (strlen (strtab + sym->st_name) >= buf_len + ? -UNW_ENOMEM : 0); + } + } + } + break; - default: - break; - } + default: + break; + } shdr = (Elf_W (Shdr) *) (((char *) shdr) + ehdr->e_shentsize); } return ret; @@ -158,7 +158,7 @@ elf_w (lookup_symbol) (unw_addr_space_t as, static Elf_W (Addr) elf_w (get_load_offset) (struct elf_image *ei, unsigned long segbase, - unsigned long mapoff) + unsigned long mapoff) { Elf_W (Addr) offset = 0; Elf_W (Ehdr) *ehdr; @@ -171,8 +171,8 @@ elf_w (get_load_offset) (struct elf_image *ei, unsigned long segbase, for (i = 0; i < ehdr->e_phnum; ++i) if (phdr[i].p_type == PT_LOAD && phdr[i].p_offset == mapoff) { - offset = segbase - phdr[i].p_vaddr; - break; + offset = segbase - phdr[i].p_vaddr; + break; } return offset; @@ -199,7 +199,7 @@ xz_uncompressed_size (uint8_t *compressed, size_t length) uint8_t *indexdata = footer - options.backward_size; if (lzma_index_buffer_decode (&index, &memlimit, NULL, indexdata, - &pos, options.backward_size) != LZMA_OK) + &pos, options.backward_size) != LZMA_OK) return 0; if (lzma_index_size (index) == options.backward_size) @@ -236,21 +236,21 @@ elf_w (extract_minidebuginfo) (struct elf_image *ei, struct elf_image *mdi) for (i = 0; i < ehdr->e_shnum; ++i) { if (strcmp (strtab + shdr->sh_name, ".gnu_debugdata") == 0) - { - if (shdr->sh_offset + shdr->sh_size > ei->size) - { - Debug (1, ".gnu_debugdata outside image? (0x%lu > 0x%lu)\n", - (unsigned long) shdr->sh_offset + shdr->sh_size, - (unsigned long) ei->size); - return 0; - } + { + if (shdr->sh_offset + shdr->sh_size > ei->size) + { + Debug (1, ".gnu_debugdata outside image? (0x%lu > 0x%lu)\n", + (unsigned long) shdr->sh_offset + shdr->sh_size, + (unsigned long) ei->size); + return 0; + } - Debug (16, "found .gnu_debugdata at 0x%lx\n", - (unsigned long) shdr->sh_offset); - compressed = ((uint8_t *) ei->image) + shdr->sh_offset; - compressed_len = shdr->sh_size; - break; - } + Debug (16, "found .gnu_debugdata at 0x%lx\n", + (unsigned long) shdr->sh_offset); + compressed = ((uint8_t *) ei->image) + shdr->sh_offset; + compressed_len = shdr->sh_size; + break; + } shdr = (Elf_W (Shdr) *) (((char *) shdr) + ehdr->e_shentsize); } @@ -268,7 +268,7 @@ elf_w (extract_minidebuginfo) (struct elf_image *ei, struct elf_image *mdi) mdi->size = uncompressed_len; mdi->image = mmap (NULL, uncompressed_len, PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); if (mdi->image == MAP_FAILED) return 0; @@ -276,8 +276,8 @@ elf_w (extract_minidebuginfo) (struct elf_image *ei, struct elf_image *mdi) size_t in_pos = 0, out_pos = 0; lzma_ret lret; lret = lzma_stream_buffer_decode (&memlimit, 0, NULL, - compressed, &in_pos, compressed_len, - mdi->image, &out_pos, mdi->size); + compressed, &in_pos, compressed_len, + mdi->image, &out_pos, mdi->size); if (lret != LZMA_OK) { Debug (1, "LZMA decompression failed: %d\n", lret); @@ -302,10 +302,10 @@ elf_w (extract_minidebuginfo) (struct elf_image *ei, struct elf_image *mdi) HIDDEN int elf_w (get_proc_name_in_image) (unw_addr_space_t as, struct elf_image *ei, - unsigned long segbase, - unsigned long mapoff, - unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp) + unsigned long segbase, + unsigned long mapoff, + unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp) { Elf_W (Addr) load_offset; Elf_W (Addr) min_dist = ~(Elf_W (Addr))0; @@ -320,19 +320,19 @@ elf_w (get_proc_name_in_image) (unw_addr_space_t as, struct elf_image *ei, if (elf_w (extract_minidebuginfo) (ei, &mdi)) { int ret_mdi = elf_w (lookup_symbol) (as, ip, &mdi, load_offset, buf, - buf_len, &min_dist); + buf_len, &min_dist); /* Closer symbol was found (possibly truncated). */ if (ret_mdi == 0 || ret_mdi == -UNW_ENOMEM) - { - ret = ret_mdi; - } + { + ret = ret_mdi; + } munmap (mdi.image, mdi.size); } if (min_dist >= ei->size) - return -UNW_ENOINFO; /* not found */ + return -UNW_ENOINFO; /* not found */ if (offp) *offp = min_dist; return ret; @@ -340,7 +340,7 @@ elf_w (get_proc_name_in_image) (unw_addr_space_t as, struct elf_image *ei, HIDDEN int elf_w (get_proc_name) (unw_addr_space_t as, pid_t pid, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp) + char *buf, size_t buf_len, unw_word_t *offp) { unsigned long segbase, mapoff; struct elf_image ei; diff --git a/src/elfxx.h b/src/elfxx.h index dd1e346a..cef6647b 100644 --- a/src/elfxx.h +++ b/src/elfxx.h @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003, 2005 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -33,26 +33,26 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" #if ELF_CLASS == ELFCLASS32 -# define ELF_W(x) ELF32_##x -# define Elf_W(x) Elf32_##x -# define elf_w(x) _Uelf32_##x +# define ELF_W(x) ELF32_##x +# define Elf_W(x) Elf32_##x +# define elf_w(x) _Uelf32_##x #else -# define ELF_W(x) ELF64_##x -# define Elf_W(x) Elf64_##x -# define elf_w(x) _Uelf64_##x +# define ELF_W(x) ELF64_##x +# define Elf_W(x) Elf64_##x +# define elf_w(x) _Uelf64_##x #endif extern int elf_w (get_proc_name) (unw_addr_space_t as, - pid_t pid, unw_word_t ip, - char *buf, size_t len, - unw_word_t *offp); + pid_t pid, unw_word_t ip, + char *buf, size_t len, + unw_word_t *offp); extern int elf_w (get_proc_name_in_image) (unw_addr_space_t as, - struct elf_image *ei, - unsigned long segbase, - unsigned long mapoff, - unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp); + struct elf_image *ei, + unsigned long segbase, + unsigned long mapoff, + unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp); static inline int elf_w (valid_object) (struct elf_image *ei) @@ -61,9 +61,9 @@ elf_w (valid_object) (struct elf_image *ei) return 0; return (memcmp (ei->image, ELFMAG, SELFMAG) == 0 - && ((uint8_t *) ei->image)[EI_CLASS] == ELF_CLASS - && ((uint8_t *) ei->image)[EI_VERSION] != EV_NONE - && ((uint8_t *) ei->image)[EI_VERSION] <= EV_CURRENT); + && ((uint8_t *) ei->image)[EI_CLASS] == ELF_CLASS + && ((uint8_t *) ei->image)[EI_VERSION] != EV_NONE + && ((uint8_t *) ei->image)[EI_VERSION] <= EV_CURRENT); } static inline int diff --git a/src/hppa/Gcreate_addr_space.c b/src/hppa/Gcreate_addr_space.c index ecc805dc..71186e0e 100644 --- a/src/hppa/Gcreate_addr_space.c +++ b/src/hppa/Gcreate_addr_space.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/hppa/Gget_proc_info.c b/src/hppa/Gget_proc_info.c index 8d2c1fd9..ce7a950a 100644 --- a/src/hppa/Gget_proc_info.c +++ b/src/hppa/Gget_proc_info.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -33,9 +33,9 @@ unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) if (dwarf_make_proc_info (&c->dwarf) < 0) { /* On hppa, some key routines such as _start() and _dl_start() - are missing DWARF unwind info. We don't want to fail in that - case, because those frames are uninteresting and just mark - the end of the frame-chain anyhow. */ + are missing DWARF unwind info. We don't want to fail in that + case, because those frames are uninteresting and just mark + the end of the frame-chain anyhow. */ memset (pi, 0, sizeof (*pi)); pi->start_ip = c->dwarf.ip; pi->end_ip = c->dwarf.ip + 4; diff --git a/src/hppa/Gget_save_loc.c b/src/hppa/Gget_save_loc.c index 2b415b76..549366a8 100644 --- a/src/hppa/Gget_save_loc.c +++ b/src/hppa/Gget_save_loc.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -31,7 +31,7 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) /* struct cursor *c = (struct cursor *) cursor; */ dwarf_loc_t loc; - loc = DWARF_NULL_LOC; /* default to "not saved" */ + loc = DWARF_NULL_LOC; /* default to "not saved" */ #warning FIX ME! diff --git a/src/hppa/Gglobal.c b/src/hppa/Gglobal.c index 2f1b5931..351a5015 100644 --- a/src/hppa/Gglobal.c +++ b/src/hppa/Gglobal.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -48,7 +48,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY hppa_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&hppa_lock, saved_mask); diff --git a/src/hppa/Ginit.c b/src/hppa/Ginit.c index 5326b829..89ad51ca 100644 --- a/src/hppa/Ginit.c +++ b/src/hppa/Ginit.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002, 2004 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -79,7 +79,7 @@ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; return 0; @@ -87,7 +87,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (write) { @@ -104,7 +104,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, - void *arg) + void *arg) { unw_word_t *addr; ucontext_t *uc = arg; @@ -135,7 +135,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = arg; unw_fpreg_t *addr; @@ -150,14 +150,14 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, if (write) { Debug (12, "%s <- %08x.%08x\n", - unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); + unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); *(unw_fpreg_t *) addr = *val; } else { *val = *(unw_fpreg_t *) addr; Debug (12, "%s -> %08x.%08x\n", - unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); + unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); } return 0; @@ -169,8 +169,8 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); } diff --git a/src/hppa/Ginit_local.c b/src/hppa/Ginit_local.c index 40277f29..0ad2f884 100644 --- a/src/hppa/Ginit_local.c +++ b/src/hppa/Ginit_local.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by ... + Contributed by ... This file is part of libunwind. diff --git a/src/hppa/Ginit_remote.c b/src/hppa/Ginit_remote.c index 50ec62cf..a4160fd1 100644 --- a/src/hppa/Ginit_remote.c +++ b/src/hppa/Ginit_remote.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/hppa/Gis_signal_frame.c b/src/hppa/Gis_signal_frame.c index 202b5703..00e40c6a 100644 --- a/src/hppa/Gis_signal_frame.c +++ b/src/hppa/Gis_signal_frame.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -64,7 +64,7 @@ unw_is_signal_frame (unw_cursor_t *cursor) return ret; } ret = ((w0 == 0x34190000 || w0 == 0x34190002) - && w1 == 0x3414015a && w2 == 0xe4008200 && w3 == 0x08000240); + && w1 == 0x3414015a && w2 == 0xe4008200 && w3 == 0x08000240); Debug (1, "(cursor=%p, ip=0x%08lx) -> %d\n", c, (unsigned) ip, ret); return ret; #else diff --git a/src/hppa/Gregs.c b/src/hppa/Gregs.c index e6d84e32..da0542c8 100644 --- a/src/hppa/Gregs.c +++ b/src/hppa/Gregs.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { struct dwarf_loc loc; @@ -35,16 +35,16 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, { case UNW_HPPA_IP: if (write) - c->dwarf.ip = *valp; /* update the IP cache */ + c->dwarf.ip = *valp; /* update the IP cache */ if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip - || *valp >= c->dwarf.pi.end_ip)) - c->dwarf.pi_valid = 0; /* new IP outside of current proc */ + || *valp >= c->dwarf.pi.end_ip)) + c->dwarf.pi_valid = 0; /* new IP outside of current proc */ break; case UNW_HPPA_CFA: case UNW_HPPA_SP: if (write) - return -UNW_EREADONLYREG; + return -UNW_EREADONLYREG; *valp = c->dwarf.cfa; return 0; @@ -71,7 +71,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, - int write) + int write) { struct dwarf_loc loc; diff --git a/src/hppa/Gresume.c b/src/hppa/Gresume.c index 92d506dc..f6bc023f 100644 --- a/src/hppa/Gresume.c +++ b/src/hppa/Gresume.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -40,11 +40,11 @@ my_rt_sigreturn (void *new_sp, int in_syscall) register unsigned long r20 __asm__ ("r20") = SYS_rt_sigreturn; __asm__ __volatile__ ("copy %0, %%sp\n" - "be,l 0x100(%%sr2,%%r0),%%sr0,%%r31\n" - "nop" - : - : "r"(new_sp), "r"(r20), "r"(r25) - : "memory"); + "be,l 0x100(%%sr2,%%r0),%%sr0,%%r31\n" + "nop" + : + : "r"(new_sp), "r"(r20), "r"(r25) + : "memory"); abort (); } @@ -90,9 +90,9 @@ static inline int establish_machine_state (struct cursor *c) { int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, - int write, void *); + int write, void *); int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, - int write, void *); + int write, void *); unw_addr_space_t as = c->dwarf.as; void *arg = c->dwarf.as_arg; unw_fpreg_t fpval; @@ -108,15 +108,15 @@ establish_machine_state (struct cursor *c) { Debug (16, "copying %s %d\n", unw_regname (reg), reg); if (unw_is_fpreg (reg)) - { - if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) - (*access_fpreg) (as, reg, &fpval, 1, arg); - } + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + (*access_fpreg) (as, reg, &fpval, 1, arg); + } else - { - if (tdep_access_reg (c, reg, &val, 0) >= 0) - (*access_reg) (as, reg, &val, 1, arg); - } + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + (*access_reg) (as, reg, &val, 1, arg); + } } return 0; } @@ -141,5 +141,5 @@ unw_resume (unw_cursor_t *cursor) return ret; return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, - c->dwarf.as_arg); + c->dwarf.as_arg); } diff --git a/src/hppa/Gstep.c b/src/hppa/Gstep.c index 13620139..078ff430 100644 --- a/src/hppa/Gstep.c +++ b/src/hppa/Gstep.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger + Contributed by David Mosberger This file is part of libunwind. @@ -46,49 +46,49 @@ unw_step (unw_cursor_t *cursor) if (unlikely (ret < 0)) { /* DWARF failed, let's see if we can follow the frame-chain - or skip over the signal trampoline. */ + or skip over the signal trampoline. */ Debug (13, "dwarf_step() failed (ret=%d), trying fallback\n", ret); if (unw_is_signal_frame (cursor)) - { + { #ifdef __linux__ - /* Assume that the trampoline is at the beginning of the - sigframe. */ - unw_word_t ip, sc_addr = c->dwarf.ip + LINUX_RT_SIGFRAME_UC_OFF; - dwarf_loc_t iaoq_loc = DWARF_LOC (sc_addr + LINUX_SC_IAOQ_OFF, 0); + /* Assume that the trampoline is at the beginning of the + sigframe. */ + unw_word_t ip, sc_addr = c->dwarf.ip + LINUX_RT_SIGFRAME_UC_OFF; + dwarf_loc_t iaoq_loc = DWARF_LOC (sc_addr + LINUX_SC_IAOQ_OFF, 0); - c->sigcontext_format = HPPA_SCF_LINUX_RT_SIGFRAME; - c->sigcontext_addr = sc_addr; - c->dwarf.ret_addr_column = UNW_HPPA_RP; + c->sigcontext_format = HPPA_SCF_LINUX_RT_SIGFRAME; + c->sigcontext_addr = sc_addr; + c->dwarf.ret_addr_column = UNW_HPPA_RP; - if ((ret = dwarf_get (&c->dwarf, iaoq_loc, &ip)) < 0) - { - Debug (2, "failed to read IAOQ[1] (ret=%d)\n", ret); - return ret; - } - c->dwarf.ip = ip & ~0x3; /* mask out the privilege level */ + if ((ret = dwarf_get (&c->dwarf, iaoq_loc, &ip)) < 0) + { + Debug (2, "failed to read IAOQ[1] (ret=%d)\n", ret); + return ret; + } + c->dwarf.ip = ip & ~0x3; /* mask out the privilege level */ - for (i = 0; i < 32; ++i) - { - c->dwarf.loc[UNW_HPPA_GR + i] - = DWARF_LOC (sc_addr + LINUX_SC_GR_OFF + 4*i, 0); - c->dwarf.loc[UNW_HPPA_FR + i] - = DWARF_LOC (sc_addr + LINUX_SC_FR_OFF + 4*i, 0); - } + for (i = 0; i < 32; ++i) + { + c->dwarf.loc[UNW_HPPA_GR + i] + = DWARF_LOC (sc_addr + LINUX_SC_GR_OFF + 4*i, 0); + c->dwarf.loc[UNW_HPPA_FR + i] + = DWARF_LOC (sc_addr + LINUX_SC_FR_OFF + 4*i, 0); + } - if ((ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_HPPA_SP], - &c->dwarf.cfa)) < 0) - { - Debug (2, "failed to read SP (ret=%d)\n", ret); - return ret; - } + if ((ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_HPPA_SP], + &c->dwarf.cfa)) < 0) + { + Debug (2, "failed to read SP (ret=%d)\n", ret); + return ret; + } #else # error Implement me! #endif - } + } else - c->dwarf.ip = 0; + c->dwarf.ip = 0; } ret = (c->dwarf.ip == 0) ? 0 : 1; Debug (2, "returning %d\n", ret); diff --git a/src/hppa/get_accessors.c b/src/hppa/get_accessors.c index cac6cba1..873a38c8 100644 --- a/src/hppa/get_accessors.c +++ b/src/hppa/get_accessors.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by ... + Contributed by ... This file is part of libunwind. diff --git a/src/hppa/init.h b/src/hppa/init.h index f51e3b46..4e23b861 100644 --- a/src/hppa/init.h +++ b/src/hppa/init.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by ... + Contributed by ... This file is part of libunwind. diff --git a/src/hppa/offsets.h b/src/hppa/offsets.h index d824770b..24e6453a 100644 --- a/src/hppa/offsets.h +++ b/src/hppa/offsets.h @@ -1,17 +1,17 @@ -#define LINUX_UC_FLAGS_OFF 0x000 -#define LINUX_UC_LINK_OFF 0x004 -#define LINUX_UC_STACK_OFF 0x008 -#define LINUX_UC_MCONTEXT_OFF 0x018 -#define LINUX_UC_SIGMASK_OFF 0x1b8 +#define LINUX_UC_FLAGS_OFF 0x000 +#define LINUX_UC_LINK_OFF 0x004 +#define LINUX_UC_STACK_OFF 0x008 +#define LINUX_UC_MCONTEXT_OFF 0x018 +#define LINUX_UC_SIGMASK_OFF 0x1b8 -#define LINUX_SC_FLAGS_OFF 0x000 -#define LINUX_SC_GR_OFF 0x004 -#define LINUX_SC_FR_OFF 0x088 -#define LINUX_SC_IASQ_OFF 0x188 -#define LINUX_SC_IAOQ_OFF 0x190 -#define LINUX_SC_SAR_OFF 0x198 +#define LINUX_SC_FLAGS_OFF 0x000 +#define LINUX_SC_GR_OFF 0x004 +#define LINUX_SC_FR_OFF 0x088 +#define LINUX_SC_IASQ_OFF 0x188 +#define LINUX_SC_IAOQ_OFF 0x190 +#define LINUX_SC_SAR_OFF 0x198 /* The signal frame contains 4 words of space for the sigreturn trampoline, the siginfo structure, and then the sigcontext structure. See include/asm-parisc/compat_rt_sigframe.h. */ -#define LINUX_RT_SIGFRAME_UC_OFF 0xac +#define LINUX_RT_SIGFRAME_UC_OFF 0xac diff --git a/src/hppa/regname.c b/src/hppa/regname.c index 07cae8ed..06dfae75 100644 --- a/src/hppa/regname.c +++ b/src/hppa/regname.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/hppa/tables.c b/src/hppa/tables.c index 383b4495..5104d4d3 100644 --- a/src/hppa/tables.c +++ b/src/hppa/tables.c @@ -7,14 +7,14 @@ is_local_addr_space (unw_addr_space_t as) return (as == _Uhppa_local_addr_space #ifndef UNW_REMOTE_ONLY - || as == _ULhppa_local_addr_space + || as == _ULhppa_local_addr_space #endif - ); + ); } HIDDEN int tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, int need_unwind_info, void *arg) + unw_proc_info_t *pi, int need_unwind_info, void *arg) { printf ("%s: begging to get implemented...\n", __FUNCTION__); return 0; @@ -22,8 +22,8 @@ tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, HIDDEN int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, - unw_proc_info_t *pi, int need_unwind_info, void *arg) + unw_dyn_info_t *di, + unw_proc_info_t *pi, int need_unwind_info, void *arg) { printf ("%s: the biggest beggar of them all...\n", __FUNCTION__); return 0; diff --git a/src/hppa/unwind_i.h b/src/hppa/unwind_i.h index 0f566d06..cafeab57 100644 --- a/src/hppa/unwind_i.h +++ b/src/hppa/unwind_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -32,15 +32,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" -#define hppa_lock UNW_OBJ(lock) -#define hppa_local_resume UNW_OBJ(local_resume) -#define hppa_local_addr_space_init UNW_OBJ(local_addr_space_init) -#define hppa_scratch_loc UNW_OBJ(scratch_loc) -#define setcontext UNW_ARCH_OBJ (setcontext) +#define hppa_lock UNW_OBJ(lock) +#define hppa_local_resume UNW_OBJ(local_resume) +#define hppa_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define hppa_scratch_loc UNW_OBJ(scratch_loc) +#define setcontext UNW_ARCH_OBJ (setcontext) extern void hppa_local_addr_space_init (void); extern int hppa_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, - void *arg); + void *arg); extern dwarf_loc_t hppa_scratch_loc (struct cursor *c, unw_regnum_t reg); extern int setcontext (const ucontext_t *ucp); diff --git a/src/ia64/Gcreate_addr_space.c b/src/ia64/Gcreate_addr_space.c index a3524a0a..20cf5d8b 100644 --- a/src/ia64/Gcreate_addr_space.c +++ b/src/ia64/Gcreate_addr_space.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/ia64/Gfind_unwind_table.c b/src/ia64/Gfind_unwind_table.c index f7d31688..9fd2707a 100644 --- a/src/ia64/Gfind_unwind_table.c +++ b/src/ia64/Gfind_unwind_table.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -46,14 +46,14 @@ find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base) if (pdyn) { /* If we have a PT_DYNAMIC program header, fetch the gp-value - from the DT_PLTGOT entry. */ + from the DT_PLTGOT entry. */ Elf64_Dyn *dyn = (Elf64_Dyn *) (pdyn->p_offset + (char *) edi->ei.image); for (; dyn->d_tag != DT_NULL; ++dyn) - if (dyn->d_tag == DT_PLTGOT) - { - gp = (Elf64_Addr) dyn->d_un.d_ptr + load_base; - goto done; - } + if (dyn->d_tag == DT_PLTGOT) + { + gp = (Elf64_Addr) dyn->d_un.d_ptr + load_base; + goto done; + } } /* Without a PT_DYAMIC header, lets try to look for a non-empty .opd @@ -67,8 +67,8 @@ find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base) if (soff + ehdr->e_shnum * ehdr->e_shentsize > edi->ei.size) { Debug (1, "section table outside of image? (%lu > %lu)", - soff + ehdr->e_shnum * ehdr->e_shentsize, - edi->ei.size); + soff + ehdr->e_shnum * ehdr->e_shentsize, + edi->ei.size); goto done; } @@ -78,11 +78,11 @@ find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base) for (i = 0; i < ehdr->e_shnum; ++i) { if (strcmp (strtab + shdr->sh_name, ".opd") == 0 - && shdr->sh_size >= 16) - { - gp = ((Elf64_Addr *) ((char *) edi->ei.image + shdr->sh_offset))[1]; - goto done; - } + && shdr->sh_size >= 16) + { + gp = ((Elf64_Addr *) ((char *) edi->ei.image + shdr->sh_offset))[1]; + goto done; + } shdr = (Elf64_Shdr *) (((char *) shdr) + ehdr->e_shentsize); } @@ -93,8 +93,8 @@ find_gp (struct elf_dyn_info *edi, Elf64_Phdr *pdyn, Elf64_Addr load_base) int ia64_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, - char *path, unw_word_t segbase, unw_word_t mapoff, - unw_word_t ip) + char *path, unw_word_t segbase, unw_word_t mapoff, + unw_word_t ip) { Elf64_Phdr *phdr, *ptxt = NULL, *punw = NULL, *pdyn = NULL; Elf64_Ehdr *ehdr; @@ -109,23 +109,23 @@ ia64_find_unwind_table (struct elf_dyn_info *edi, unw_addr_space_t as, for (i = 0; i < ehdr->e_phnum; ++i) { switch (phdr[i].p_type) - { - case PT_LOAD: - if (phdr[i].p_offset == mapoff) - ptxt = phdr + i; - break; + { + case PT_LOAD: + if (phdr[i].p_offset == mapoff) + ptxt = phdr + i; + break; - case PT_IA_64_UNWIND: - punw = phdr + i; - break; + case PT_IA_64_UNWIND: + punw = phdr + i; + break; - case PT_DYNAMIC: - pdyn = phdr + i; - break; + case PT_DYNAMIC: + pdyn = phdr + i; + break; - default: - break; - } + default: + break; + } } if (!ptxt || !punw) return 0; diff --git a/src/ia64/Gget_proc_info.c b/src/ia64/Gget_proc_info.c index 21015d42..6b4722d5 100644 --- a/src/ia64/Gget_proc_info.c +++ b/src/ia64/Gget_proc_info.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/ia64/Gget_save_loc.c b/src/ia64/Gget_save_loc.c index 49bdaba1..fc37ad9d 100644 --- a/src/ia64/Gget_save_loc.c +++ b/src/ia64/Gget_save_loc.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2003, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -38,7 +38,7 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) uint8_t nat_bitnr; int ret; - loc = IA64_NULL_LOC; /* default to "not saved" */ + loc = IA64_NULL_LOC; /* default to "not saved" */ switch (reg) { @@ -62,8 +62,8 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) reg_loc = c->loc[IA64_REG_R4 + (reg - (UNW_IA64_NAT + 4))]; nat_bitnr = c->nat_bitnr[reg - (UNW_IA64_NAT + 4)]; if (IA64_IS_FP_LOC (reg_loc)) - /* NaT bit saved as a NaTVal. */ - loc = reg_loc; + /* NaT bit saved as a NaTVal. */ + loc = reg_loc; break; case UNW_IA64_FR + 2: loc = c->loc[IA64_REG_F2]; break; @@ -74,29 +74,29 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) loc = c->loc[IA64_REG_F16 + (reg - (UNW_IA64_FR + 16))]; break; - case UNW_IA64_AR_BSP: loc = c->loc[IA64_REG_BSP]; break; - case UNW_IA64_AR_BSPSTORE: loc = c->loc[IA64_REG_BSPSTORE]; break; - case UNW_IA64_AR_PFS: loc = c->loc[IA64_REG_PFS]; break; - case UNW_IA64_AR_RNAT: loc = c->loc[IA64_REG_RNAT]; break; - case UNW_IA64_AR_UNAT: loc = c->loc[IA64_REG_UNAT]; break; - case UNW_IA64_AR_LC: loc = c->loc[IA64_REG_LC]; break; - case UNW_IA64_AR_FPSR: loc = c->loc[IA64_REG_FPSR]; break; - case UNW_IA64_BR + 1: loc = c->loc[IA64_REG_B1]; break; - case UNW_IA64_BR + 2: loc = c->loc[IA64_REG_B2]; break; - case UNW_IA64_BR + 3: loc = c->loc[IA64_REG_B3]; break; - case UNW_IA64_BR + 4: loc = c->loc[IA64_REG_B4]; break; - case UNW_IA64_BR + 5: loc = c->loc[IA64_REG_B5]; break; - case UNW_IA64_CFM: loc = c->cfm_loc; break; - case UNW_IA64_PR: loc = c->loc[IA64_REG_PR]; break; + case UNW_IA64_AR_BSP: loc = c->loc[IA64_REG_BSP]; break; + case UNW_IA64_AR_BSPSTORE: loc = c->loc[IA64_REG_BSPSTORE]; break; + case UNW_IA64_AR_PFS: loc = c->loc[IA64_REG_PFS]; break; + case UNW_IA64_AR_RNAT: loc = c->loc[IA64_REG_RNAT]; break; + case UNW_IA64_AR_UNAT: loc = c->loc[IA64_REG_UNAT]; break; + case UNW_IA64_AR_LC: loc = c->loc[IA64_REG_LC]; break; + case UNW_IA64_AR_FPSR: loc = c->loc[IA64_REG_FPSR]; break; + case UNW_IA64_BR + 1: loc = c->loc[IA64_REG_B1]; break; + case UNW_IA64_BR + 2: loc = c->loc[IA64_REG_B2]; break; + case UNW_IA64_BR + 3: loc = c->loc[IA64_REG_B3]; break; + case UNW_IA64_BR + 4: loc = c->loc[IA64_REG_B4]; break; + case UNW_IA64_BR + 5: loc = c->loc[IA64_REG_B5]; break; + case UNW_IA64_CFM: loc = c->cfm_loc; break; + case UNW_IA64_PR: loc = c->loc[IA64_REG_PR]; break; - case UNW_IA64_GR + 32 ... UNW_IA64_GR + 127: /* stacked reg */ + case UNW_IA64_GR + 32 ... UNW_IA64_GR + 127: /* stacked reg */ reg = rotate_gr (c, reg - UNW_IA64_GR); ret = ia64_get_stacked (c, reg, &loc, NULL); if (ret < 0) - return ret; + return ret; break; - case UNW_IA64_NAT + 32 ... UNW_IA64_NAT + 127: /* stacked reg */ + case UNW_IA64_NAT + 32 ... UNW_IA64_NAT + 127: /* stacked reg */ reg = rotate_gr (c, reg - UNW_IA64_NAT); ret = ia64_get_stacked (c, reg, NULL, &loc); break; @@ -108,9 +108,9 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) /* scratch & special registers: */ case UNW_IA64_GR + 0: - case UNW_IA64_GR + 1: /* global pointer */ + case UNW_IA64_GR + 1: /* global pointer */ case UNW_IA64_NAT + 0: - case UNW_IA64_NAT + 1: /* global pointer */ + case UNW_IA64_NAT + 1: /* global pointer */ case UNW_IA64_FR + 0: case UNW_IA64_FR + 1: break; diff --git a/src/ia64/Gglobal.c b/src/ia64/Gglobal.c index bdd9d449..5c6156f0 100644 --- a/src/ia64/Gglobal.c +++ b/src/ia64/Gglobal.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -80,7 +80,7 @@ tdep_init (void) mempool_init (&unw.reg_state_pool, sizeof (struct ia64_reg_state), 0); mempool_init (&unw.labeled_state_pool, - sizeof (struct ia64_labeled_state), 0); + sizeof (struct ia64_labeled_state), 0); unw.read_only.r0 = 0; unw.read_only.f0.raw.bits[0] = 0; @@ -90,24 +90,24 @@ tdep_init (void) bep = (uint8_t *) &unw.read_only.f1_be; for (i = 0; i < 16; ++i) { - *--lep = f1_bytes[i]; - *bep++ = f1_bytes[i]; + *--lep = f1_bytes[i]; + *bep++ = f1_bytes[i]; } lep = (uint8_t *) &unw.nat_val_le + 16; bep = (uint8_t *) &unw.nat_val_be; for (i = 0; i < 16; ++i) { - *--lep = nat_val_bytes[i]; - *bep++ = nat_val_bytes[i]; + *--lep = nat_val_bytes[i]; + *bep++ = nat_val_bytes[i]; } lep = (uint8_t *) &unw.int_val_le + 16; bep = (uint8_t *) &unw.int_val_be; for (i = 0; i < 16; ++i) { - *--lep = int_val_bytes[i]; - *bep++ = int_val_bytes[i]; + *--lep = int_val_bytes[i]; + *bep++ = int_val_bytes[i]; } assert (8*sizeof(unw_hash_index_t) >= IA64_LOG_UNW_HASH_SIZE); @@ -115,7 +115,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY ia64_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&unw.lock, saved_mask); diff --git a/src/ia64/Ginit.c b/src/ia64/Ginit.c index 5afa9ab1..7b64f0c1 100644 --- a/src/ia64/Ginit.c +++ b/src/ia64/Ginit.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -61,7 +61,7 @@ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { #ifndef UNW_LOCAL_ONLY # pragma weak _U_dyn_info_list_addr @@ -74,7 +74,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (write) { @@ -91,12 +91,12 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, #ifdef HAVE_SYS_UC_ACCESS_H -#define SYSCALL_CFM_SAVE_REG 11 /* on a syscall, ar.pfs is saved in r11 */ -#define REASON_SYSCALL 0 +#define SYSCALL_CFM_SAVE_REG 11 /* on a syscall, ar.pfs is saved in r11 */ +#define REASON_SYSCALL 0 static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, - void *arg) + void *arg) { ucontext_t *uc = arg; unsigned int nat, mask; @@ -110,88 +110,88 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, { case UNW_IA64_GR ... UNW_IA64_GR + 31: if ((ret = __uc_get_grs (uc, (reg - UNW_IA64_GR), 1, &value, &nat))) - break; + break; if (write) - ret = __uc_set_grs (uc, (reg - UNW_IA64_GR), 1, val, nat); + ret = __uc_set_grs (uc, (reg - UNW_IA64_GR), 1, val, nat); else - *val = value; + *val = value; break; case UNW_IA64_NAT ... UNW_IA64_NAT + 31: if ((ret = __uc_get_grs (uc, (reg - UNW_IA64_GR), 1, &value, &nat))) - break; + break; mask = 1 << (reg - UNW_IA64_GR); if (write) - { - if (*val) - nat |= mask; - else - nat &= ~mask; - ret = __uc_set_grs (uc, (reg - UNW_IA64_GR), 1, &value, nat); - } + { + if (*val) + nat |= mask; + else + nat &= ~mask; + ret = __uc_set_grs (uc, (reg - UNW_IA64_GR), 1, &value, nat); + } else - *val = (nat & mask) != 0; + *val = (nat & mask) != 0; break; case UNW_IA64_AR ... UNW_IA64_AR + 127: if (reg == UNW_IA64_AR_BSP) - { - if (write) - ret = __uc_set_ar (uc, (reg - UNW_IA64_AR), *val); - else - ret = __uc_get_ar (uc, (reg - UNW_IA64_AR), val); - } + { + if (write) + ret = __uc_set_ar (uc, (reg - UNW_IA64_AR), *val); + else + ret = __uc_get_ar (uc, (reg - UNW_IA64_AR), val); + } else if (reg == UNW_IA64_AR_PFS && reason == REASON_SYSCALL) - { - /* As of HP-UX 11.22, getcontext() does not have unwind info - and because of that, we need to hack thins manually here. - Hopefully, this is OK because the HP-UX kernel also needs - to know where AR.PFS has been saved, so the use of - register r11 for this purpose is pretty much nailed - down. */ - if (write) - ret = __uc_set_grs (uc, SYSCALL_CFM_SAVE_REG, 1, val, 0); - else - ret = __uc_get_grs (uc, SYSCALL_CFM_SAVE_REG, 1, val, &nat); - } + { + /* As of HP-UX 11.22, getcontext() does not have unwind info + and because of that, we need to hack thins manually here. + Hopefully, this is OK because the HP-UX kernel also needs + to know where AR.PFS has been saved, so the use of + register r11 for this purpose is pretty much nailed + down. */ + if (write) + ret = __uc_set_grs (uc, SYSCALL_CFM_SAVE_REG, 1, val, 0); + else + ret = __uc_get_grs (uc, SYSCALL_CFM_SAVE_REG, 1, val, &nat); + } else - { - if (write) - ret = __uc_set_ar (uc, (reg - UNW_IA64_AR), *val); - else - ret = __uc_get_ar (uc, (reg - UNW_IA64_AR), val); - } + { + if (write) + ret = __uc_set_ar (uc, (reg - UNW_IA64_AR), *val); + else + ret = __uc_get_ar (uc, (reg - UNW_IA64_AR), val); + } break; case UNW_IA64_BR ... UNW_IA64_BR + 7: if (write) - ret = __uc_set_brs (uc, (reg - UNW_IA64_BR), 1, val); + ret = __uc_set_brs (uc, (reg - UNW_IA64_BR), 1, val); else - ret = __uc_get_brs (uc, (reg - UNW_IA64_BR), 1, val); + ret = __uc_get_brs (uc, (reg - UNW_IA64_BR), 1, val); break; case UNW_IA64_PR: if (write) - ret = __uc_set_prs (uc, *val); + ret = __uc_set_prs (uc, *val); else - ret = __uc_get_prs (uc, val); + ret = __uc_get_prs (uc, val); break; case UNW_IA64_IP: if (write) - ret = __uc_set_ip (uc, *val); + ret = __uc_set_ip (uc, *val); else - ret = __uc_get_ip (uc, val); + ret = __uc_get_ip (uc, val); break; case UNW_IA64_CFM: if (write) - ret = __uc_set_cfm (uc, *val); + ret = __uc_set_cfm (uc, *val); else - ret = __uc_get_cfm (uc, val); + ret = __uc_get_cfm (uc, val); break; case UNW_IA64_FR ... UNW_IA64_FR + 127: @@ -203,7 +203,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, if (ret != 0) { Debug (1, "failed to %s %s (ret = %d)\n", - write ? "write" : "read", unw_regname (reg), ret); + write ? "write" : "read", unw_regname (reg), ret); return -UNW_EBADREG; } @@ -216,7 +216,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = arg; fp_regval_t fp_regval; @@ -226,15 +226,15 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, { case UNW_IA64_FR ... UNW_IA64_FR + 127: if (write) - { - memcpy (&fp_regval, val, sizeof (fp_regval)); - ret = __uc_set_frs (uc, (reg - UNW_IA64_FR), 1, &fp_regval); - } + { + memcpy (&fp_regval, val, sizeof (fp_regval)); + ret = __uc_set_frs (uc, (reg - UNW_IA64_FR), 1, &fp_regval); + } else - { - ret = __uc_get_frs (uc, (reg - UNW_IA64_FR), 1, &fp_regval); - memcpy (val, &fp_regval, sizeof (*val)); - } + { + ret = __uc_get_frs (uc, (reg - UNW_IA64_FR), 1, &fp_regval); + memcpy (val, &fp_regval, sizeof (*val)); + } break; default: @@ -251,7 +251,7 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, - void *arg) + void *arg) { unw_word_t *addr, mask; ucontext_t *uc = arg; @@ -260,19 +260,19 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, { mask = ((unw_word_t) 1) << (reg - UNW_IA64_NAT); if (write) - { - if (*val) - uc->uc_mcontext.sc_nat |= mask; - else - uc->uc_mcontext.sc_nat &= ~mask; - } + { + if (*val) + uc->uc_mcontext.sc_nat |= mask; + else + uc->uc_mcontext.sc_nat &= ~mask; + } else - *val = (uc->uc_mcontext.sc_nat & mask) != 0; + *val = (uc->uc_mcontext.sc_nat & mask) != 0; if (write) - Debug (12, "%s <- %lx\n", unw_regname (reg), *val); + Debug (12, "%s <- %lx\n", unw_regname (reg), *val); else - Debug (12, "%s -> %lx\n", unw_regname (reg), *val); + Debug (12, "%s -> %lx\n", unw_regname (reg), *val); return 0; } @@ -283,10 +283,10 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, if (write) { if (ia64_read_only_reg (addr)) - { - Debug (16, "attempt to write read-only register\n"); - return -UNW_EREADONLYREG; - } + { + Debug (16, "attempt to write read-only register\n"); + return -UNW_EREADONLYREG; + } *addr = *val; Debug (12, "%s <- %lx\n", unw_regname (reg), *val); } @@ -304,7 +304,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = arg; unw_fpreg_t *addr; @@ -319,19 +319,19 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, if (write) { if (ia64_read_only_reg (addr)) - { - Debug (16, "attempt to write read-only register\n"); - return -UNW_EREADONLYREG; - } + { + Debug (16, "attempt to write read-only register\n"); + return -UNW_EREADONLYREG; + } *addr = *val; Debug (12, "%s <- %016lx.%016lx\n", - unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); + unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); } else { *val = *(unw_fpreg_t *) addr; Debug (12, "%s -> %016lx.%016lx\n", - unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); + unw_regname (reg), val->raw.bits[1], val->raw.bits[0]); } return 0; @@ -345,8 +345,8 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); } @@ -379,7 +379,7 @@ ia64_local_addr_space_init (void) HIDDEN int ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, unw_word_t *valp, - int write) + int write) { #ifdef HAVE_SYS_UC_ACCESS_H unw_word_t uc_addr = IA64_GET_AUX_ADDR (loc); @@ -387,7 +387,7 @@ ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, unw_word_t *valp, int ret; Debug (16, "%s location %s\n", - write ? "writing" : "reading", ia64_strloc (loc)); + write ? "writing" : "reading", ia64_strloc (loc)); if (c->as == unw_local_addr_space) ucp = (ucontext_t *) uc_addr; @@ -398,7 +398,7 @@ ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, unw_word_t *valp, /* Need to copy-in ucontext_t first. */ ucp = alloca (sizeof (ucontext_t)); if (!ucp) - return -UNW_ENOMEM; + return -UNW_ENOMEM; /* For now, there is no non-HP-UX implementation of the uc_access(3) interface. Because of that, we cannot, e.g., @@ -410,25 +410,25 @@ ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, unw_word_t *valp, dst = (unw_word_t *) ucp; for (src = uc_addr; src < uc_addr + sizeof (ucontext_t); src += 8) - if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg)) - < 0) - return ret; + if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg)) + < 0) + return ret; } if (IA64_IS_REG_LOC (loc)) ret = access_reg (unw_local_addr_space, IA64_GET_REG (loc), valp, write, - ucp); + ucp); else { /* Must be an access to the RSE backing store in ucontext_t. */ unw_word_t addr = IA64_GET_ADDR (loc); if (write) - ret = __uc_set_rsebs (ucp, (uint64_t *) addr, 1, valp); + ret = __uc_set_rsebs (ucp, (uint64_t *) addr, 1, valp); else - ret = __uc_get_rsebs (ucp, (uint64_t *) addr, 1, valp); + ret = __uc_get_rsebs (ucp, (uint64_t *) addr, 1, valp); if (ret != 0) - ret = -UNW_EBADREG; + ret = -UNW_EBADREG; } if (ret < 0) return ret; @@ -438,9 +438,9 @@ ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, unw_word_t *valp, /* need to copy-out ucontext_t: */ unw_word_t dst, *src = (unw_word_t *) ucp; for (dst = uc_addr; dst < uc_addr + sizeof (ucontext_t); dst += 8) - if ((ret = (*c->as->acc.access_mem) (c->as, dst, src++, 1, c->as_arg)) - < 0) - return ret; + if ((ret = (*c->as->acc.access_mem) (c->as, dst, src++, 1, c->as_arg)) + < 0) + return ret; } return 0; #else /* !HAVE_SYS_UC_ACCESS_H */ @@ -450,7 +450,7 @@ ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, unw_word_t *valp, HIDDEN int ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *valp, - int write) + int write) { #ifdef HAVE_SYS_UC_ACCESS_H unw_word_t uc_addr = IA64_GET_AUX_ADDR (loc); @@ -466,7 +466,7 @@ ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *valp, /* Need to copy-in ucontext_t first. */ ucp = alloca (sizeof (ucontext_t)); if (!ucp) - return -UNW_ENOMEM; + return -UNW_ENOMEM; /* For now, there is no non-HP-UX implementation of the uc_access(3) interface. Because of that, we cannot, e.g., @@ -478,13 +478,13 @@ ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *valp, dst = (unw_word_t *) ucp; for (src = uc_addr; src < uc_addr + sizeof (ucontext_t); src += 8) - if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg)) - < 0) - return ret; + if ((ret = (*c->as->acc.access_mem) (c->as, src, dst++, 0, c->as_arg)) + < 0) + return ret; } if ((ret = access_fpreg (unw_local_addr_space, IA64_GET_REG (loc), valp, - write, ucp)) < 0) + write, ucp)) < 0) return ret; if (write && c->as != unw_local_addr_space) @@ -492,9 +492,9 @@ ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *valp, /* need to copy-out ucontext_t: */ unw_word_t dst, *src = (unw_word_t *) ucp; for (dst = uc_addr; dst < uc_addr + sizeof (ucontext_t); dst += 8) - if ((ret = (*c->as->acc.access_mem) (c->as, dst, src++, 1, c->as_arg)) - < 0) - return ret; + if ((ret = (*c->as->acc.access_mem) (c->as, dst, src++, 1, c->as_arg)) + < 0) + return ret; } return 0; #else /* !HAVE_SYS_UC_ACCESS_H */ diff --git a/src/ia64/Ginit_local.c b/src/ia64/Ginit_local.c index 5f82c013..8c727e1d 100644 --- a/src/ia64/Ginit_local.c +++ b/src/ia64/Ginit_local.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2003, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -49,7 +49,7 @@ set_as_arg (struct cursor *c, unw_context_t *uc) static inline int get_initial_stack_pointers (struct cursor *c, unw_context_t *uc, - unw_word_t *sp, unw_word_t *bsp) + unw_word_t *sp, unw_word_t *bsp) { #if defined(__linux) unw_word_t sol, bspstore; diff --git a/src/ia64/Ginit_remote.c b/src/ia64/Ginit_remote.c index 334d236f..e26a4e4b 100644 --- a/src/ia64/Ginit_remote.c +++ b/src/ia64/Ginit_remote.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002, 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/ia64/Gis_signal_frame.c b/src/ia64/Gis_signal_frame.c index cc69bd63..0b7e19cb 100644 --- a/src/ia64/Gis_signal_frame.c +++ b/src/ia64/Gis_signal_frame.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/ia64/Gparser.c b/src/ia64/Gparser.c index ff36968a..b1f0f4a1 100644 --- a/src/ia64/Gparser.c +++ b/src/ia64/Gparser.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,15 +27,15 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* forward declaration: */ static int create_state_record_for (struct cursor *c, - struct ia64_state_record *sr, - unw_word_t ip); + struct ia64_state_record *sr, + unw_word_t ip); typedef unsigned long unw_word; -#define alloc_reg_state() (mempool_alloc (&unw.reg_state_pool)) -#define free_reg_state(rs) (mempool_free (&unw.reg_state_pool, rs)) -#define alloc_labeled_state() (mempool_alloc (&unw.labeled_state_pool)) -#define free_labeled_state(s) (mempool_free (&unw.labeled_state_pool, s)) +#define alloc_reg_state() (mempool_alloc (&unw.reg_state_pool)) +#define free_reg_state(rs) (mempool_free (&unw.reg_state_pool, rs)) +#define alloc_labeled_state() (mempool_alloc (&unw.labeled_state_pool)) +#define free_labeled_state(s) (mempool_free (&unw.labeled_state_pool, s)) /* Routines to manipulate the state stack. */ @@ -78,15 +78,15 @@ dup_state_stack (struct ia64_reg_state *rs) { copy = alloc_reg_state (); if (!copy) - { - print_error ("unwind.dup_state_stack: out of memory\n"); - return NULL; - } + { + print_error ("unwind.dup_state_stack: out of memory\n"); + return NULL; + } memcpy (copy, rs, sizeof (*copy)); if (first) - prev->next = copy; + prev->next = copy; else - first = copy; + first = copy; rs = rs->next; prev = copy; } @@ -153,7 +153,7 @@ decode_abreg (unsigned char abreg, int memory) static void set_reg (struct ia64_reg_info *reg, enum ia64_where where, int when, - unsigned long val) + unsigned long val) { reg->val = val; reg->where = where; @@ -163,35 +163,35 @@ set_reg (struct ia64_reg_info *reg, enum ia64_where where, int when, static void alloc_spill_area (unsigned long *offp, unsigned long regsize, - struct ia64_reg_info *lo, struct ia64_reg_info *hi) + struct ia64_reg_info *lo, struct ia64_reg_info *hi) { struct ia64_reg_info *reg; for (reg = hi; reg >= lo; --reg) { if (reg->where == IA64_WHERE_SPILL_HOME) - { - reg->where = IA64_WHERE_PSPREL; - *offp -= regsize; - reg->val = *offp; - } + { + reg->where = IA64_WHERE_PSPREL; + *offp -= regsize; + reg->val = *offp; + } } } static inline void spill_next_when (struct ia64_reg_info **regp, struct ia64_reg_info *lim, - unw_word t) + unw_word t) { struct ia64_reg_info *reg; for (reg = *regp; reg <= lim; ++reg) { if (reg->where == IA64_WHERE_SPILL_HOME) - { - reg->when = t; - *regp = reg + 1; - return; - } + { + reg->when = t; + *regp = reg + 1; + return; + } } Dprintf ("libunwind: excess spill!\n"); } @@ -209,10 +209,10 @@ finish_prologue (struct ia64_state_record *sr) { reg = sr->curr.reg + unw.save_order[i]; if (reg->where == IA64_WHERE_GR_SAVE) - { - reg->where = IA64_WHERE_GR; - reg->val = sr->gr_save_loc++; - } + { + reg->where = IA64_WHERE_GR; + reg->val = sr->gr_save_loc++; + } } /* Next, compute when the fp, general, and branch registers get @@ -225,8 +225,8 @@ finish_prologue (struct ia64_state_record *sr) unsigned long t; static const unsigned char limit[3] = { - IA64_REG_F31, IA64_REG_R7, IA64_REG_B5 - }; + IA64_REG_F31, IA64_REG_R7, IA64_REG_B5 + }; struct ia64_reg_info *(regs[3]); regs[0] = sr->curr.reg + IA64_REG_F2; @@ -234,14 +234,14 @@ finish_prologue (struct ia64_state_record *sr) regs[2] = sr->curr.reg + IA64_REG_B1; for (t = 0; (int) t < sr->region_len; ++t) - { - if ((t & 3) == 0) - mask = *cp++; - kind = (mask >> 2 * (3 - (t & 3))) & 3; - if (kind > 0) - spill_next_when (®s[kind - 1], sr->curr.reg + limit[kind - 1], - sr->region_start + t); - } + { + if ((t & 3) == 0) + mask = *cp++; + kind = (mask >> 2 * (3 - (t & 3))) & 3; + if (kind > 0) + spill_next_when (®s[kind - 1], sr->curr.reg + limit[kind - 1], + sr->region_start + t); + } } /* Next, lay out the memory stack spill area. */ @@ -250,11 +250,11 @@ finish_prologue (struct ia64_state_record *sr) { off = sr->spill_offset; alloc_spill_area (&off, 16, sr->curr.reg + IA64_REG_F2, - sr->curr.reg + IA64_REG_F31); + sr->curr.reg + IA64_REG_F31); alloc_spill_area (&off, 8, sr->curr.reg + IA64_REG_B1, - sr->curr.reg + IA64_REG_B5); + sr->curr.reg + IA64_REG_B5); alloc_spill_area (&off, 8, sr->curr.reg + IA64_REG_R4, - sr->curr.reg + IA64_REG_R7); + sr->curr.reg + IA64_REG_R7); } } @@ -262,7 +262,7 @@ finish_prologue (struct ia64_state_record *sr) static void desc_prologue (int body, unw_word rlen, unsigned char mask, - unsigned char grsave, struct ia64_state_record *sr) + unsigned char grsave, struct ia64_state_record *sr) { int i, region_start; @@ -293,17 +293,17 @@ desc_prologue (int body, unw_word rlen, unsigned char mask, push (sr); if (mask) - for (i = 0; i < 4; ++i) - { - if (mask & 0x8) - set_reg (sr->curr.reg + unw.save_order[i], IA64_WHERE_GR, - sr->region_start + sr->region_len - 1, grsave++); - mask <<= 1; - } + for (i = 0; i < 4; ++i) + { + if (mask & 0x8) + set_reg (sr->curr.reg + unw.save_order[i], IA64_WHERE_GR, + sr->region_start + sr->region_len - 1, grsave++); + mask <<= 1; + } sr->gr_save_loc = grsave; sr->any_spills = 0; sr->imask = 0; - sr->spill_offset = 0x10; /* default to psp+16 */ + sr->spill_offset = 0x10; /* default to psp+16 */ } } @@ -311,22 +311,22 @@ desc_prologue (int body, unw_word rlen, unsigned char mask, static inline void desc_abi (unsigned char abi, unsigned char context, - struct ia64_state_record *sr) + struct ia64_state_record *sr) { sr->abi_marker = (abi << 8) | context; } static inline void desc_br_gr (unsigned char brmask, unsigned char gr, - struct ia64_state_record *sr) + struct ia64_state_record *sr) { int i; for (i = 0; i < 5; ++i) { if (brmask & 1) - set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_GR, - sr->region_start + sr->region_len - 1, gr++); + set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_GR, + sr->region_start + sr->region_len - 1, gr++); brmask >>= 1; } } @@ -339,40 +339,40 @@ desc_br_mem (unsigned char brmask, struct ia64_state_record *sr) for (i = 0; i < 5; ++i) { if (brmask & 1) - { - set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_SPILL_HOME, - sr->region_start + sr->region_len - 1, 0); - sr->any_spills = 1; - } + { + set_reg (sr->curr.reg + IA64_REG_B1 + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } brmask >>= 1; } } static inline void desc_frgr_mem (unsigned char grmask, unw_word frmask, - struct ia64_state_record *sr) + struct ia64_state_record *sr) { int i; for (i = 0; i < 4; ++i) { if ((grmask & 1) != 0) - { - set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME, - sr->region_start + sr->region_len - 1, 0); - sr->any_spills = 1; - } + { + set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } grmask >>= 1; } for (i = 0; i < 20; ++i) { if ((frmask & 1) != 0) - { - int base = (i < 4) ? IA64_REG_F2 : IA64_REG_F16 - 4; - set_reg (sr->curr.reg + base + i, IA64_WHERE_SPILL_HOME, - sr->region_start + sr->region_len - 1, 0); - sr->any_spills = 1; - } + { + int base = (i < 4) ? IA64_REG_F2 : IA64_REG_F16 - 4; + set_reg (sr->curr.reg + base + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } frmask >>= 1; } } @@ -385,26 +385,26 @@ desc_fr_mem (unsigned char frmask, struct ia64_state_record *sr) for (i = 0; i < 4; ++i) { if ((frmask & 1) != 0) - { - set_reg (sr->curr.reg + IA64_REG_F2 + i, IA64_WHERE_SPILL_HOME, - sr->region_start + sr->region_len - 1, 0); - sr->any_spills = 1; - } + { + set_reg (sr->curr.reg + IA64_REG_F2 + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } frmask >>= 1; } } static inline void desc_gr_gr (unsigned char grmask, unsigned char gr, - struct ia64_state_record *sr) + struct ia64_state_record *sr) { int i; for (i = 0; i < 4; ++i) { if ((grmask & 1) != 0) - set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_GR, - sr->region_start + sr->region_len - 1, gr++); + set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_GR, + sr->region_start + sr->region_len - 1, gr++); grmask >>= 1; } } @@ -417,11 +417,11 @@ desc_gr_mem (unsigned char grmask, struct ia64_state_record *sr) for (i = 0; i < 4; ++i) { if ((grmask & 1) != 0) - { - set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME, - sr->region_start + sr->region_len - 1, 0); - sr->any_spills = 1; - } + { + set_reg (sr->curr.reg + IA64_REG_R4 + i, IA64_WHERE_SPILL_HOME, + sr->region_start + sr->region_len - 1, 0); + sr->any_spills = 1; + } grmask >>= 1; } } @@ -430,7 +430,7 @@ static inline void desc_mem_stack_f (unw_word t, unw_word size, struct ia64_state_record *sr) { set_reg (sr->curr.reg + IA64_REG_PSP, IA64_WHERE_NONE, - sr->region_start + MIN ((int) t, sr->region_len - 1), 16 * size); + sr->region_start + MIN ((int) t, sr->region_len - 1), 16 * size); } static inline void @@ -442,26 +442,26 @@ desc_mem_stack_v (unw_word t, struct ia64_state_record *sr) static inline void desc_reg_gr (unsigned char reg, unsigned char dst, - struct ia64_state_record *sr) + struct ia64_state_record *sr) { set_reg (sr->curr.reg + reg, IA64_WHERE_GR, - sr->region_start + sr->region_len - 1, dst); + sr->region_start + sr->region_len - 1, dst); } static inline void desc_reg_psprel (unsigned char reg, unw_word pspoff, - struct ia64_state_record *sr) + struct ia64_state_record *sr) { set_reg (sr->curr.reg + reg, IA64_WHERE_PSPREL, - sr->region_start + sr->region_len - 1, 0x10 - 4 * pspoff); + sr->region_start + sr->region_len - 1, 0x10 - 4 * pspoff); } static inline void desc_reg_sprel (unsigned char reg, unw_word spoff, - struct ia64_state_record *sr) + struct ia64_state_record *sr) { set_reg (sr->curr.reg + reg, IA64_WHERE_SPREL, - sr->region_start + sr->region_len - 1, 4 * spoff); + sr->region_start + sr->region_len - 1, 4 * spoff); } static inline void @@ -510,12 +510,12 @@ desc_copy_state (unw_word label, struct ia64_state_record *sr) for (ls = sr->labeled_states; ls; ls = ls->next) { if (ls->label == label) - { - free_state_stack (&sr->curr); - memcpy (&sr->curr, &ls->saved_state, sizeof (sr->curr)); - sr->curr.next = dup_state_stack (ls->saved_state.next); - return; - } + { + free_state_stack (&sr->curr); + memcpy (&sr->curr, &ls->saved_state, sizeof (sr->curr)); + sr->curr.next = dup_state_stack (ls->saved_state.next); + return; + } } print_error ("libunwind: failed to find labeled state\n"); } @@ -550,7 +550,7 @@ desc_is_active (unsigned char qp, unw_word t, struct ia64_state_record *sr) if (qp > 0) { if ((sr->pr_val & ((unw_word_t) 1 << qp)) == 0) - return 0; + return 0; sr->pr_mask |= ((unw_word_t) 1 << qp); } return 1; @@ -558,7 +558,7 @@ desc_is_active (unsigned char qp, unw_word t, struct ia64_state_record *sr) static inline void desc_restore_p (unsigned char qp, unw_word t, unsigned char abreg, - struct ia64_state_record *sr) + struct ia64_state_record *sr) { struct ia64_reg_info *r; @@ -573,8 +573,8 @@ desc_restore_p (unsigned char qp, unw_word t, unsigned char abreg, static inline void desc_spill_reg_p (unsigned char qp, unw_word t, unsigned char abreg, - unsigned char x, unsigned char ytreg, - struct ia64_state_record *sr) + unsigned char x, unsigned char ytreg, + struct ia64_state_record *sr) { enum ia64_where where = IA64_WHERE_GR; struct ia64_reg_info *r; @@ -595,7 +595,7 @@ desc_spill_reg_p (unsigned char qp, unw_word t, unsigned char abreg, static inline void desc_spill_psprel_p (unsigned char qp, unw_word t, unsigned char abreg, - unw_word pspoff, struct ia64_state_record *sr) + unw_word pspoff, struct ia64_state_record *sr) { struct ia64_reg_info *r; @@ -610,7 +610,7 @@ desc_spill_psprel_p (unsigned char qp, unw_word t, unsigned char abreg, static inline void desc_spill_sprel_p (unsigned char qp, unw_word t, unsigned char abreg, - unw_word spoff, struct ia64_state_record *sr) + unw_word spoff, struct ia64_state_record *sr) { struct ia64_reg_info *r; @@ -623,69 +623,69 @@ desc_spill_sprel_p (unsigned char qp, unw_word t, unsigned char abreg, r->val = 4 * spoff; } -#define UNW_DEC_BAD_CODE(code) \ - print_error ("libunwind: unknown code encountered\n") +#define UNW_DEC_BAD_CODE(code) \ + print_error ("libunwind: unknown code encountered\n") /* Register names. */ -#define UNW_REG_BSP IA64_REG_BSP -#define UNW_REG_BSPSTORE IA64_REG_BSPSTORE -#define UNW_REG_FPSR IA64_REG_FPSR -#define UNW_REG_LC IA64_REG_LC -#define UNW_REG_PFS IA64_REG_PFS -#define UNW_REG_PR IA64_REG_PR -#define UNW_REG_RNAT IA64_REG_RNAT -#define UNW_REG_PSP IA64_REG_PSP -#define UNW_REG_RP IA64_REG_IP -#define UNW_REG_UNAT IA64_REG_UNAT +#define UNW_REG_BSP IA64_REG_BSP +#define UNW_REG_BSPSTORE IA64_REG_BSPSTORE +#define UNW_REG_FPSR IA64_REG_FPSR +#define UNW_REG_LC IA64_REG_LC +#define UNW_REG_PFS IA64_REG_PFS +#define UNW_REG_PR IA64_REG_PR +#define UNW_REG_RNAT IA64_REG_RNAT +#define UNW_REG_PSP IA64_REG_PSP +#define UNW_REG_RP IA64_REG_IP +#define UNW_REG_UNAT IA64_REG_UNAT /* Region headers. */ -#define UNW_DEC_PROLOGUE_GR(fmt,r,m,gr,arg) desc_prologue(0,r,m,gr,arg) -#define UNW_DEC_PROLOGUE(fmt,b,r,arg) desc_prologue(b,r,0,32,arg) +#define UNW_DEC_PROLOGUE_GR(fmt,r,m,gr,arg) desc_prologue(0,r,m,gr,arg) +#define UNW_DEC_PROLOGUE(fmt,b,r,arg) desc_prologue(b,r,0,32,arg) /* Prologue descriptors. */ -#define UNW_DEC_ABI(fmt,a,c,arg) desc_abi(a,c,arg) -#define UNW_DEC_BR_GR(fmt,b,g,arg) desc_br_gr(b,g,arg) -#define UNW_DEC_BR_MEM(fmt,b,arg) desc_br_mem(b,arg) -#define UNW_DEC_FRGR_MEM(fmt,g,f,arg) desc_frgr_mem(g,f,arg) -#define UNW_DEC_FR_MEM(fmt,f,arg) desc_fr_mem(f,arg) -#define UNW_DEC_GR_GR(fmt,m,g,arg) desc_gr_gr(m,g,arg) -#define UNW_DEC_GR_MEM(fmt,m,arg) desc_gr_mem(m,arg) -#define UNW_DEC_MEM_STACK_F(fmt,t,s,arg) desc_mem_stack_f(t,s,arg) -#define UNW_DEC_MEM_STACK_V(fmt,t,arg) desc_mem_stack_v(t,arg) -#define UNW_DEC_REG_GR(fmt,r,d,arg) desc_reg_gr(r,d,arg) -#define UNW_DEC_REG_PSPREL(fmt,r,o,arg) desc_reg_psprel(r,o,arg) -#define UNW_DEC_REG_SPREL(fmt,r,o,arg) desc_reg_sprel(r,o,arg) -#define UNW_DEC_REG_WHEN(fmt,r,t,arg) desc_reg_when(r,t,arg) +#define UNW_DEC_ABI(fmt,a,c,arg) desc_abi(a,c,arg) +#define UNW_DEC_BR_GR(fmt,b,g,arg) desc_br_gr(b,g,arg) +#define UNW_DEC_BR_MEM(fmt,b,arg) desc_br_mem(b,arg) +#define UNW_DEC_FRGR_MEM(fmt,g,f,arg) desc_frgr_mem(g,f,arg) +#define UNW_DEC_FR_MEM(fmt,f,arg) desc_fr_mem(f,arg) +#define UNW_DEC_GR_GR(fmt,m,g,arg) desc_gr_gr(m,g,arg) +#define UNW_DEC_GR_MEM(fmt,m,arg) desc_gr_mem(m,arg) +#define UNW_DEC_MEM_STACK_F(fmt,t,s,arg) desc_mem_stack_f(t,s,arg) +#define UNW_DEC_MEM_STACK_V(fmt,t,arg) desc_mem_stack_v(t,arg) +#define UNW_DEC_REG_GR(fmt,r,d,arg) desc_reg_gr(r,d,arg) +#define UNW_DEC_REG_PSPREL(fmt,r,o,arg) desc_reg_psprel(r,o,arg) +#define UNW_DEC_REG_SPREL(fmt,r,o,arg) desc_reg_sprel(r,o,arg) +#define UNW_DEC_REG_WHEN(fmt,r,t,arg) desc_reg_when(r,t,arg) #define UNW_DEC_PRIUNAT_WHEN_GR(fmt,t,arg) \ - desc_reg_when(IA64_REG_PRI_UNAT_GR,t,arg) + desc_reg_when(IA64_REG_PRI_UNAT_GR,t,arg) #define UNW_DEC_PRIUNAT_WHEN_MEM(fmt,t,arg) \ - desc_reg_when(IA64_REG_PRI_UNAT_MEM,t,arg) + desc_reg_when(IA64_REG_PRI_UNAT_MEM,t,arg) #define UNW_DEC_PRIUNAT_GR(fmt,r,arg) \ - desc_reg_gr(IA64_REG_PRI_UNAT_GR,r,arg) + desc_reg_gr(IA64_REG_PRI_UNAT_GR,r,arg) #define UNW_DEC_PRIUNAT_PSPREL(fmt,o,arg) \ - desc_reg_psprel(IA64_REG_PRI_UNAT_MEM,o,arg) + desc_reg_psprel(IA64_REG_PRI_UNAT_MEM,o,arg) #define UNW_DEC_PRIUNAT_SPREL(fmt,o,arg) \ - desc_reg_sprel(IA64_REG_PRI_UNAT_MEM,o,arg) -#define UNW_DEC_RP_BR(fmt,d,arg) desc_rp_br(d,arg) -#define UNW_DEC_SPILL_BASE(fmt,o,arg) desc_spill_base(o,arg) -#define UNW_DEC_SPILL_MASK(fmt,m,arg) (m = desc_spill_mask(m,arg)) + desc_reg_sprel(IA64_REG_PRI_UNAT_MEM,o,arg) +#define UNW_DEC_RP_BR(fmt,d,arg) desc_rp_br(d,arg) +#define UNW_DEC_SPILL_BASE(fmt,o,arg) desc_spill_base(o,arg) +#define UNW_DEC_SPILL_MASK(fmt,m,arg) (m = desc_spill_mask(m,arg)) /* Body descriptors. */ -#define UNW_DEC_EPILOGUE(fmt,t,c,arg) desc_epilogue(t,c,arg) -#define UNW_DEC_COPY_STATE(fmt,l,arg) desc_copy_state(l,arg) -#define UNW_DEC_LABEL_STATE(fmt,l,arg) desc_label_state(l,arg) +#define UNW_DEC_EPILOGUE(fmt,t,c,arg) desc_epilogue(t,c,arg) +#define UNW_DEC_COPY_STATE(fmt,l,arg) desc_copy_state(l,arg) +#define UNW_DEC_LABEL_STATE(fmt,l,arg) desc_label_state(l,arg) /* General unwind descriptors. */ -#define UNW_DEC_SPILL_REG_P(f,p,t,a,x,y,arg) desc_spill_reg_p(p,t,a,x,y,arg) -#define UNW_DEC_SPILL_REG(f,t,a,x,y,arg) desc_spill_reg_p(0,t,a,x,y,arg) +#define UNW_DEC_SPILL_REG_P(f,p,t,a,x,y,arg) desc_spill_reg_p(p,t,a,x,y,arg) +#define UNW_DEC_SPILL_REG(f,t,a,x,y,arg) desc_spill_reg_p(0,t,a,x,y,arg) #define UNW_DEC_SPILL_PSPREL_P(f,p,t,a,o,arg) \ - desc_spill_psprel_p(p,t,a,o,arg) + desc_spill_psprel_p(p,t,a,o,arg) #define UNW_DEC_SPILL_PSPREL(f,t,a,o,arg) \ - desc_spill_psprel_p(0,t,a,o,arg) -#define UNW_DEC_SPILL_SPREL_P(f,p,t,a,o,arg) desc_spill_sprel_p(p,t,a,o,arg) -#define UNW_DEC_SPILL_SPREL(f,t,a,o,arg) desc_spill_sprel_p(0,t,a,o,arg) -#define UNW_DEC_RESTORE_P(f,p,t,a,arg) desc_restore_p(p,t,a,arg) -#define UNW_DEC_RESTORE(f,t,a,arg) desc_restore_p(0,t,a,arg) + desc_spill_psprel_p(0,t,a,o,arg) +#define UNW_DEC_SPILL_SPREL_P(f,p,t,a,o,arg) desc_spill_sprel_p(p,t,a,o,arg) +#define UNW_DEC_SPILL_SPREL(f,t,a,o,arg) desc_spill_sprel_p(0,t,a,o,arg) +#define UNW_DEC_RESTORE_P(f,p,t,a,arg) desc_restore_p(p,t,a,arg) +#define UNW_DEC_RESTORE(f,t,a,arg) desc_restore_p(0,t,a,arg) #include "unwind_decoder.h" @@ -700,22 +700,22 @@ lookup_preg (int regnum, int memory, struct ia64_state_record *sr) switch (regnum) { - case UNW_IA64_AR_BSP: preg = IA64_REG_BSP; break; - case UNW_IA64_AR_BSPSTORE: preg = IA64_REG_BSPSTORE; break; - case UNW_IA64_AR_FPSR: preg = IA64_REG_FPSR; break; - case UNW_IA64_AR_LC: preg = IA64_REG_LC; break; - case UNW_IA64_AR_PFS: preg = IA64_REG_PFS; break; - case UNW_IA64_AR_RNAT: preg = IA64_REG_RNAT; break; - case UNW_IA64_AR_UNAT: preg = IA64_REG_UNAT; break; - case UNW_IA64_BR + 0: preg = IA64_REG_IP; break; - case UNW_IA64_PR: preg = IA64_REG_PR; break; - case UNW_IA64_SP: preg = IA64_REG_PSP; break; + case UNW_IA64_AR_BSP: preg = IA64_REG_BSP; break; + case UNW_IA64_AR_BSPSTORE: preg = IA64_REG_BSPSTORE; break; + case UNW_IA64_AR_FPSR: preg = IA64_REG_FPSR; break; + case UNW_IA64_AR_LC: preg = IA64_REG_LC; break; + case UNW_IA64_AR_PFS: preg = IA64_REG_PFS; break; + case UNW_IA64_AR_RNAT: preg = IA64_REG_RNAT; break; + case UNW_IA64_AR_UNAT: preg = IA64_REG_UNAT; break; + case UNW_IA64_BR + 0: preg = IA64_REG_IP; break; + case UNW_IA64_PR: preg = IA64_REG_PR; break; + case UNW_IA64_SP: preg = IA64_REG_PSP; break; case UNW_IA64_NAT: if (memory) - preg = IA64_REG_PRI_UNAT_MEM; + preg = IA64_REG_PRI_UNAT_MEM; else - preg = IA64_REG_PRI_UNAT_GR; + preg = IA64_REG_PRI_UNAT_GR; break; case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7: @@ -802,119 +802,119 @@ parse_dynamic (struct cursor *c, struct ia64_state_record *sr) { len = r->insn_count; if (len < 0) - { - if (r->next) - { - Debug (1, "negative region length allowed in last region only!"); - return -UNW_EINVAL; - } - len = -len; - /* hack old region info to set the start where we need it: */ - sr->region_start = (di->end_ip - di->start_ip) / 0x10 * 3 - len; - sr->region_len = 0; - } + { + if (r->next) + { + Debug (1, "negative region length allowed in last region only!"); + return -UNW_EINVAL; + } + len = -len; + /* hack old region info to set the start where we need it: */ + sr->region_start = (di->end_ip - di->start_ip) / 0x10 * 3 - len; + sr->region_len = 0; + } /* all regions are treated as prologue regions: */ desc_prologue (0, len, 0, 0, sr); if (sr->done) - return 0; + return 0; for (op = r->op; op < r->op + r->op_count; ++op) - { - when = op->when; - val = op->val; - qp = op->qp; + { + when = op->when; + val = op->val; + qp = op->qp; - if (!desc_is_active (qp, when, sr)) - continue; + if (!desc_is_active (qp, when, sr)) + continue; - when = sr->region_start + MIN ((int) when, sr->region_len - 1); + when = sr->region_start + MIN ((int) when, sr->region_len - 1); - switch (op->tag) - { - case UNW_DYN_SAVE_REG: - memory = 0; - if ((unsigned) (val - UNW_IA64_GR) < 128) - where = IA64_WHERE_GR; - else if ((unsigned) (val - UNW_IA64_FR) < 128) - where = IA64_WHERE_FR; - else if ((unsigned) (val - UNW_IA64_BR) < 8) - where = IA64_WHERE_BR; - else - { - Dprintf ("%s: can't save to register number %d\n", - __FUNCTION__, (int) op->reg); - return -UNW_EBADREG; - } - /* fall through */ - update_reg_info: - ri = lookup_preg (op->reg, memory, sr); - if (!ri) - return -UNW_EBADREG; - ri->where = where; - ri->when = when; - ri->val = val; - break; + switch (op->tag) + { + case UNW_DYN_SAVE_REG: + memory = 0; + if ((unsigned) (val - UNW_IA64_GR) < 128) + where = IA64_WHERE_GR; + else if ((unsigned) (val - UNW_IA64_FR) < 128) + where = IA64_WHERE_FR; + else if ((unsigned) (val - UNW_IA64_BR) < 8) + where = IA64_WHERE_BR; + else + { + Dprintf ("%s: can't save to register number %d\n", + __FUNCTION__, (int) op->reg); + return -UNW_EBADREG; + } + /* fall through */ + update_reg_info: + ri = lookup_preg (op->reg, memory, sr); + if (!ri) + return -UNW_EBADREG; + ri->where = where; + ri->when = when; + ri->val = val; + break; - case UNW_DYN_SPILL_FP_REL: - memory = 1; - where = IA64_WHERE_PSPREL; - val = 0x10 - val; - goto update_reg_info; + case UNW_DYN_SPILL_FP_REL: + memory = 1; + where = IA64_WHERE_PSPREL; + val = 0x10 - val; + goto update_reg_info; - case UNW_DYN_SPILL_SP_REL: - memory = 1; - where = IA64_WHERE_SPREL; - goto update_reg_info; + case UNW_DYN_SPILL_SP_REL: + memory = 1; + where = IA64_WHERE_SPREL; + goto update_reg_info; - case UNW_DYN_ADD: - if (op->reg == UNW_IA64_SP) - { - if (val & 0xf) - { - Dprintf ("%s: frame-size %ld not an integer " - "multiple of 16\n", - __FUNCTION__, (long) op->val); - return -UNW_EINVAL; - } - desc_mem_stack_f (when, -((int64_t) val / 16), sr); - } - else - { - Dprintf ("%s: can only ADD to stack-pointer\n", - __FUNCTION__); - return -UNW_EBADREG; - } - break; + case UNW_DYN_ADD: + if (op->reg == UNW_IA64_SP) + { + if (val & 0xf) + { + Dprintf ("%s: frame-size %ld not an integer " + "multiple of 16\n", + __FUNCTION__, (long) op->val); + return -UNW_EINVAL; + } + desc_mem_stack_f (when, -((int64_t) val / 16), sr); + } + else + { + Dprintf ("%s: can only ADD to stack-pointer\n", + __FUNCTION__); + return -UNW_EBADREG; + } + break; - case UNW_DYN_POP_FRAMES: - sr->when_sp_restored = when; - sr->epilogue_count = op->val; - break; + case UNW_DYN_POP_FRAMES: + sr->when_sp_restored = when; + sr->epilogue_count = op->val; + break; - case UNW_DYN_LABEL_STATE: - desc_label_state (op->val, sr); - break; + case UNW_DYN_LABEL_STATE: + desc_label_state (op->val, sr); + break; - case UNW_DYN_COPY_STATE: - desc_copy_state (op->val, sr); - break; + case UNW_DYN_COPY_STATE: + desc_copy_state (op->val, sr); + break; - case UNW_DYN_ALIAS: - if ((ret = desc_alias (op, c, sr)) < 0) - return ret; + case UNW_DYN_ALIAS: + if ((ret = desc_alias (op, c, sr)) < 0) + return ret; - case UNW_DYN_STOP: - goto end_of_ops; - } - } + case UNW_DYN_STOP: + goto end_of_ops; + } + } end_of_ops: ; } return 0; } #else -# define parse_dynamic(c,sr) (-UNW_EINVAL) +# define parse_dynamic(c,sr) (-UNW_EINVAL) #endif /* _U_dyn_op */ @@ -928,7 +928,7 @@ ia64_fetch_proc_info (struct cursor *c, unw_word_t ip, int need_unwind_info) /* check dynamic info first --- it overrides everything else */ ret = unwi_find_dynamic_proc_info (c->as, ip, &c->pi, need_unwind_info, - c->as_arg); + c->as_arg); if (ret == -UNW_ENOINFO) { dynamic = 0; @@ -954,7 +954,7 @@ put_unwind_info (struct cursor *c, unw_proc_info_t *pi) static int create_state_record_for (struct cursor *c, struct ia64_state_record *sr, - unw_word_t ip) + unw_word_t ip) { unw_word_t predicates = c->pr; struct ia64_reg_info *r; @@ -975,7 +975,7 @@ create_state_record_for (struct cursor *c, struct ia64_state_record *sr, /* No info, return default unwinder (leaf proc, no mem stack, no saved regs), rp in b0, pfs in ar.pfs. */ Debug (1, "no unwind info for ip=0x%lx (gp=%lx)\n", - (long) ip, (long) c->pi.gp); + (long) ip, (long) c->pi.gp); sr->curr.reg[IA64_REG_IP].where = IA64_WHERE_BR; sr->curr.reg[IA64_REG_IP].when = -1; sr->curr.reg[IA64_REG_IP].val = 0; @@ -983,7 +983,7 @@ create_state_record_for (struct cursor *c, struct ia64_state_record *sr, } sr->when_target = (3 * ((ip & ~(unw_word_t) 0xf) - c->pi.start_ip) / 16 - + (ip & 0xf)); + + (ip & 0xf)); switch (c->pi.format) { @@ -992,7 +992,7 @@ create_state_record_for (struct cursor *c, struct ia64_state_record *sr, dp = c->pi.unwind_info; desc_end = dp + c->pi.unwind_info_size; while (!sr->done && dp < desc_end) - dp = unw_decode (dp, sr->in_body, sr); + dp = unw_decode (dp, sr->in_body, sr); ret = 0; break; @@ -1012,18 +1012,18 @@ create_state_record_for (struct cursor *c, struct ia64_state_record *sr, if (sr->when_target > sr->when_sp_restored) { /* sp has been restored and all values on the memory stack below - psp also have been restored. */ + psp also have been restored. */ sr->curr.reg[IA64_REG_PSP].val = 0; sr->curr.reg[IA64_REG_PSP].where = IA64_WHERE_NONE; sr->curr.reg[IA64_REG_PSP].when = IA64_WHEN_NEVER; for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r) - if ((r->where == IA64_WHERE_PSPREL && r->val <= 0x10) - || r->where == IA64_WHERE_SPREL) - { - r->val = 0; - r->where = IA64_WHERE_NONE; - r->when = IA64_WHEN_NEVER; - } + if ((r->where == IA64_WHERE_PSPREL && r->val <= 0x10) + || r->where == IA64_WHERE_SPREL) + { + r->val = 0; + r->where = IA64_WHERE_NONE; + r->when = IA64_WHEN_NEVER; + } } /* If RP did't get saved, generate entry for the return link @@ -1040,7 +1040,7 @@ create_state_record_for (struct cursor *c, struct ia64_state_record *sr, && sr->when_target > sr->curr.reg[IA64_REG_RNAT].when) { Debug (8, "func 0x%lx may switch the register-backing-store\n", - c->pi.start_ip); + c->pi.start_ip); c->pi.flags |= UNW_PI_FLAG_IA64_RBS_SWITCH; } out: @@ -1048,41 +1048,41 @@ create_state_record_for (struct cursor *c, struct ia64_state_record *sr, if (unwi_debug_level > 2) { Dprintf ("%s: state record for func 0x%lx, t=%u (flags=0x%lx):\n", - __FUNCTION__, - (long) c->pi.start_ip, sr->when_target, (long) c->pi.flags); + __FUNCTION__, + (long) c->pi.start_ip, sr->when_target, (long) c->pi.flags); for (r = sr->curr.reg; r < sr->curr.reg + IA64_NUM_PREGS; ++r) - { - if (r->where != IA64_WHERE_NONE || r->when != IA64_WHEN_NEVER) - { - Dprintf (" %s <- ", unw.preg_name[r - sr->curr.reg]); - switch (r->where) - { - case IA64_WHERE_GR: - Dprintf ("r%lu", (long) r->val); - break; - case IA64_WHERE_FR: - Dprintf ("f%lu", (long) r->val); - break; - case IA64_WHERE_BR: - Dprintf ("b%lu", (long) r->val); - break; - case IA64_WHERE_SPREL: - Dprintf ("[sp+0x%lx]", (long) r->val); - break; - case IA64_WHERE_PSPREL: - Dprintf ("[psp+0x%lx]", (long) r->val); - break; - case IA64_WHERE_NONE: - Dprintf ("%s+0x%lx", - unw.preg_name[r - sr->curr.reg], (long) r->val); - break; - default: - Dprintf ("BADWHERE(%d)", r->where); - break; - } - Dprintf ("\t\t%d\n", r->when); - } - } + { + if (r->where != IA64_WHERE_NONE || r->when != IA64_WHEN_NEVER) + { + Dprintf (" %s <- ", unw.preg_name[r - sr->curr.reg]); + switch (r->where) + { + case IA64_WHERE_GR: + Dprintf ("r%lu", (long) r->val); + break; + case IA64_WHERE_FR: + Dprintf ("f%lu", (long) r->val); + break; + case IA64_WHERE_BR: + Dprintf ("b%lu", (long) r->val); + break; + case IA64_WHERE_SPREL: + Dprintf ("[sp+0x%lx]", (long) r->val); + break; + case IA64_WHERE_PSPREL: + Dprintf ("[psp+0x%lx]", (long) r->val); + break; + case IA64_WHERE_NONE: + Dprintf ("%s+0x%lx", + unw.preg_name[r - sr->curr.reg], (long) r->val); + break; + default: + Dprintf ("BADWHERE(%d)", r->where); + break; + } + Dprintf ("\t\t%d\n", r->when); + } + } } #endif return 0; @@ -1123,9 +1123,9 @@ ia64_make_proc_info (struct cursor *c) { /* Lookup it up the slow way... */ if ((ret = ia64_fetch_proc_info (c, c->ip, 0)) < 0) - return ret; + return ret; if (caching) - ia64_cache_proc_info (c); + ia64_cache_proc_info (c); } return 0; } diff --git a/src/ia64/Grbs.c b/src/ia64/Grbs.c index 4230cf30..e7c01fe2 100644 --- a/src/ia64/Grbs.c +++ b/src/ia64/Grbs.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -62,7 +62,7 @@ ia64_strloc (ia64_loc_t loc) sprintf (buf + strlen (buf), "%s", unw_regname (IA64_GET_REG (loc))); else sprintf (buf + strlen (buf), "0x%llx", - (unsigned long long) IA64_GET_ADDR (loc)); + (unsigned long long) IA64_GET_ADDR (loc)); if (IA64_IS_FP_LOC (loc)) strcat (buf, ")"); @@ -78,8 +78,8 @@ ia64_strloc (ia64_loc_t loc) HIDDEN int rbs_switch (struct cursor *c, - unw_word_t saved_bsp, unw_word_t saved_bspstore, - ia64_loc_t saved_rnat_loc) + unw_word_t saved_bsp, unw_word_t saved_bspstore, + ia64_loc_t saved_rnat_loc) { struct rbs_area *rbs = &c->rbs_area[c->rbs_curr]; unw_word_t lo, ndirty, rbs_base; @@ -98,13 +98,13 @@ rbs_switch (struct cursor *c, if (rbs->size) { Debug (10, "inner=[0x%lx-0x%lx)\n", - (long) (rbs->end - rbs->size), (long) rbs->end); + (long) (rbs->end - rbs->size), (long) rbs->end); c->rbs_curr = (c->rbs_curr + 1) % ARRAY_SIZE (c->rbs_area); rbs = c->rbs_area + c->rbs_curr; if (c->rbs_curr == c->rbs_left_edge) - c->rbs_left_edge = (c->rbs_left_edge + 1) % ARRAY_SIZE (c->rbs_area); + c->rbs_left_edge = (c->rbs_left_edge + 1) % ARRAY_SIZE (c->rbs_area); } if ((ret = rbs_get_base (c, saved_bspstore, &rbs_base)) < 0) @@ -117,13 +117,13 @@ rbs_switch (struct cursor *c, c->bsp = saved_bsp; Debug (10, "outer=[0x%llx-0x%llx), rnat@%s\n", (long long) rbs_base, - (long long) rbs->end, ia64_strloc (rbs->rnat_loc)); + (long long) rbs->end, ia64_strloc (rbs->rnat_loc)); return 0; } HIDDEN int rbs_find_stacked (struct cursor *c, unw_word_t regs_to_skip, - ia64_loc_t *locp, ia64_loc_t *rnat_locp) + ia64_loc_t *locp, ia64_loc_t *rnat_locp) { unw_word_t nregs, bsp = c->bsp, curr = c->rbs_curr, n; unw_word_t left_edge = c->rbs_left_edge; @@ -134,10 +134,10 @@ rbs_find_stacked (struct cursor *c, unw_word_t regs_to_skip, while (!rbs_contains (&c->rbs_area[curr], bsp)) { if (curr == left_edge) - { - Debug (1, "could not find register r%d!\n", reg); - return -UNW_EBADREG; - } + { + Debug (1, "could not find register r%d!\n", reg); + return -UNW_EBADREG; + } n = rse_num_regs (c->rbs_area[curr].end, bsp); curr = (curr + ARRAY_SIZE (c->rbs_area) - 1) % ARRAY_SIZE (c->rbs_area); @@ -149,23 +149,23 @@ rbs_find_stacked (struct cursor *c, unw_word_t regs_to_skip, nregs = rse_num_regs (bsp, c->rbs_area[curr].end); if (regs_to_skip < nregs) - { - /* found it: */ - unw_word_t addr; + { + /* found it: */ + unw_word_t addr; - addr = rse_skip_regs (bsp, regs_to_skip); - if (locp) - *locp = rbs_loc (c->rbs_area + curr, addr); - if (rnat_locp) - *rnat_locp = rbs_get_rnat_loc (c->rbs_area + curr, addr); - return 0; - } + addr = rse_skip_regs (bsp, regs_to_skip); + if (locp) + *locp = rbs_loc (c->rbs_area + curr, addr); + if (rnat_locp) + *rnat_locp = rbs_get_rnat_loc (c->rbs_area + curr, addr); + return 0; + } if (curr == left_edge) - { - Debug (1, "could not find register r%d!\n", reg); - return -UNW_EBADREG; - } + { + Debug (1, "could not find register r%d!\n", reg); + return -UNW_EBADREG; + } regs_to_skip -= nregs; @@ -178,7 +178,7 @@ rbs_find_stacked (struct cursor *c, unw_word_t regs_to_skip, static inline int get_rnat (struct cursor *c, struct rbs_area *rbs, unw_word_t bsp, - unw_word_t *__restrict rnatp) + unw_word_t *__restrict rnatp) { ia64_loc_t rnat_locp = rbs_get_rnat_loc (rbs, bsp); @@ -197,8 +197,8 @@ get_rnat (struct cursor *c, struct rbs_area *rbs, unw_word_t bsp, Note: This does not modify the rbs_area[] structure in any way. */ HIDDEN int rbs_cover_and_flush (struct cursor *c, unw_word_t nregs, - unw_word_t *dirty_partition, unw_word_t *dirty_rnat, - unw_word_t *bspstore) + unw_word_t *dirty_partition, unw_word_t *dirty_rnat, + unw_word_t *bspstore) { unw_word_t n, src_mask, dst_mask, bsp, *dst, src_rnat, dst_rnat = 0; unw_word_t curr = c->rbs_curr, left_edge = c->rbs_left_edge; @@ -213,23 +213,23 @@ rbs_cover_and_flush (struct cursor *c, unw_word_t nregs, /* at least _some_ registers are on rbs... */ n = rse_num_regs (bsp, rbs->end); if (likely (n >= nregs)) - { - /* common case #1: all registers are on current rbs... */ - /* got lucky: _all_ registers are on rbs... */ - ia64_loc_t rnat_loc = rbs_get_rnat_loc (rbs, c->bsp); + { + /* common case #1: all registers are on current rbs... */ + /* got lucky: _all_ registers are on rbs... */ + ia64_loc_t rnat_loc = rbs_get_rnat_loc (rbs, c->bsp); - *bspstore = c->bsp; + *bspstore = c->bsp; - if (IA64_IS_REG_LOC (rnat_loc)) - { - unw_word_t rnat_addr = (unw_word_t) - tdep_uc_addr (c->as_arg, UNW_IA64_AR_RNAT, NULL); - rnat_loc = IA64_LOC_ADDR (rnat_addr, 0); - } - c->loc[IA64_REG_RNAT] = rnat_loc; - return 0; /* all done */ - } - nregs -= n; /* account for registers already on the rbs */ + if (IA64_IS_REG_LOC (rnat_loc)) + { + unw_word_t rnat_addr = (unw_word_t) + tdep_uc_addr (c->as_arg, UNW_IA64_AR_RNAT, NULL); + rnat_loc = IA64_LOC_ADDR (rnat_addr, 0); + } + c->loc[IA64_REG_RNAT] = rnat_loc; + return 0; /* all done */ + } + nregs -= n; /* account for registers already on the rbs */ assert (rse_skip_regs (c->bsp, -nregs) == rse_skip_regs (rbs->end, 0)); } @@ -249,54 +249,54 @@ rbs_cover_and_flush (struct cursor *c, unw_word_t nregs, while (nregs > 0) { if (unlikely (!rbs_contains (rbs, bsp))) - { - /* switch to next non-empty rbs-area: */ - do - { - if (curr == left_edge) - { - Debug (0, "rbs-underflow while flushing %lu regs, " - "bsp=0x%lx, dst=0x%p\n", (unsigned long) nregs, - (unsigned long) bsp, dst); - return -UNW_EBADREG; - } + { + /* switch to next non-empty rbs-area: */ + do + { + if (curr == left_edge) + { + Debug (0, "rbs-underflow while flushing %lu regs, " + "bsp=0x%lx, dst=0x%p\n", (unsigned long) nregs, + (unsigned long) bsp, dst); + return -UNW_EBADREG; + } - assert (rse_num_regs (rbs->end, bsp) == 0); + assert (rse_num_regs (rbs->end, bsp) == 0); - curr = (curr + ARRAY_SIZE (c->rbs_area) - 1) - % ARRAY_SIZE (c->rbs_area); - rbs = c->rbs_area + curr; - bsp = rbs->end - rbs->size; - } - while (rbs->size == 0); + curr = (curr + ARRAY_SIZE (c->rbs_area) - 1) + % ARRAY_SIZE (c->rbs_area); + rbs = c->rbs_area + curr; + bsp = rbs->end - rbs->size; + } + while (rbs->size == 0); - if ((ret = get_rnat (c, rbs, bsp, &src_rnat)) < 0) - return ret; - } + if ((ret = get_rnat (c, rbs, bsp, &src_rnat)) < 0) + return ret; + } if (unlikely (rse_is_rnat_slot (bsp))) - { - bsp += 8; - if ((ret = get_rnat (c, rbs, bsp, &src_rnat)) < 0) - return ret; - } + { + bsp += 8; + if ((ret = get_rnat (c, rbs, bsp, &src_rnat)) < 0) + return ret; + } if (unlikely (rse_is_rnat_slot ((unw_word_t) dst))) - { - *dst++ = dst_rnat; - dst_rnat = 0; - } + { + *dst++ = dst_rnat; + dst_rnat = 0; + } src_mask = ((unw_word_t) 1) << rse_slot_num (bsp); dst_mask = ((unw_word_t) 1) << rse_slot_num ((unw_word_t) dst); if (src_rnat & src_mask) - dst_rnat |= dst_mask; + dst_rnat |= dst_mask; else - dst_rnat &= ~dst_mask; + dst_rnat &= ~dst_mask; /* copy one slot: */ if ((ret = ia64_get (c, rbs_loc (rbs, bsp), dst)) < 0) - return ret; + return ret; /* advance to next slot: */ --nregs; @@ -306,9 +306,9 @@ rbs_cover_and_flush (struct cursor *c, unw_word_t nregs, if (unlikely (rse_is_rnat_slot ((unw_word_t) dst))) { /* The LOADRS instruction loads "the N bytes below the current - BSP" but BSP can never point to an RNaT slot so if the last - destination word happens to be an RNaT slot, we need to write - that slot now. */ + BSP" but BSP can never point to an RNaT slot so if the last + destination word happens to be an RNaT slot, we need to write + that slot now. */ *dst++ = dst_rnat; dst_rnat = 0; } diff --git a/src/ia64/Gregs.c b/src/ia64/Gregs.c index f3e40753..ac6f738a 100644 --- a/src/ia64/Gregs.c +++ b/src/ia64/Gregs.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -38,60 +38,60 @@ linux_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr) || ia64_get_abi_marker (c) == ABI_MARKER_OLD_LINUX_SIGTRAMP) { switch (reg) - { - case UNW_IA64_NAT + 2 ... UNW_IA64_NAT + 3: - case UNW_IA64_NAT + 8 ... UNW_IA64_NAT + 31: - /* Linux sigcontext contains the NaT bit of scratch register - N in bit position N of the sc_nat member. */ - *nat_bitnr = (reg - UNW_IA64_NAT); - addr += LINUX_SC_NAT_OFF; - break; + { + case UNW_IA64_NAT + 2 ... UNW_IA64_NAT + 3: + case UNW_IA64_NAT + 8 ... UNW_IA64_NAT + 31: + /* Linux sigcontext contains the NaT bit of scratch register + N in bit position N of the sc_nat member. */ + *nat_bitnr = (reg - UNW_IA64_NAT); + addr += LINUX_SC_NAT_OFF; + break; - case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3: - case UNW_IA64_GR + 8 ... UNW_IA64_GR + 31: - addr += LINUX_SC_GR_OFF + 8 * (reg - UNW_IA64_GR); - break; + case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3: + case UNW_IA64_GR + 8 ... UNW_IA64_GR + 31: + addr += LINUX_SC_GR_OFF + 8 * (reg - UNW_IA64_GR); + break; - case UNW_IA64_FR + 6 ... UNW_IA64_FR + 15: - addr += LINUX_SC_FR_OFF + 16 * (reg - UNW_IA64_FR); - return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); + case UNW_IA64_FR + 6 ... UNW_IA64_FR + 15: + addr += LINUX_SC_FR_OFF + 16 * (reg - UNW_IA64_FR); + return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); - case UNW_IA64_FR + 32 ... UNW_IA64_FR + 127: - if (ia64_get (c, IA64_LOC_ADDR (addr + LINUX_SC_FLAGS_OFF, 0), - &flags) < 0) - return IA64_NULL_LOC; + case UNW_IA64_FR + 32 ... UNW_IA64_FR + 127: + if (ia64_get (c, IA64_LOC_ADDR (addr + LINUX_SC_FLAGS_OFF, 0), + &flags) < 0) + return IA64_NULL_LOC; - if (!(flags & IA64_SC_FLAG_FPH_VALID)) - { - /* initialize fph partition: */ - tmp_addr = addr + LINUX_SC_FR_OFF + 32*16; - for (i = 32; i < 128; ++i, tmp_addr += 16) - if (ia64_putfp (c, IA64_LOC_ADDR (tmp_addr, 0), - unw.read_only.f0) < 0) - return IA64_NULL_LOC; - /* mark fph partition as valid: */ - if (ia64_put (c, IA64_LOC_ADDR (addr + LINUX_SC_FLAGS_OFF, 0), - flags | IA64_SC_FLAG_FPH_VALID) < 0) - return IA64_NULL_LOC; - } + if (!(flags & IA64_SC_FLAG_FPH_VALID)) + { + /* initialize fph partition: */ + tmp_addr = addr + LINUX_SC_FR_OFF + 32*16; + for (i = 32; i < 128; ++i, tmp_addr += 16) + if (ia64_putfp (c, IA64_LOC_ADDR (tmp_addr, 0), + unw.read_only.f0) < 0) + return IA64_NULL_LOC; + /* mark fph partition as valid: */ + if (ia64_put (c, IA64_LOC_ADDR (addr + LINUX_SC_FLAGS_OFF, 0), + flags | IA64_SC_FLAG_FPH_VALID) < 0) + return IA64_NULL_LOC; + } - addr += LINUX_SC_FR_OFF + 16 * (reg - UNW_IA64_FR); - return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); + addr += LINUX_SC_FR_OFF + 16 * (reg - UNW_IA64_FR); + return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); - case UNW_IA64_BR + 0: addr += LINUX_SC_BR_OFF + 0; break; - case UNW_IA64_BR + 6: addr += LINUX_SC_BR_OFF + 6*8; break; - case UNW_IA64_BR + 7: addr += LINUX_SC_BR_OFF + 7*8; break; - case UNW_IA64_AR_RSC: addr += LINUX_SC_AR_RSC_OFF; break; - case UNW_IA64_AR_CSD: addr += LINUX_SC_AR_CSD_OFF; break; - case UNW_IA64_AR_SSD: addr += LINUX_SC_AR_SSD_OFF; break; - case UNW_IA64_AR_CCV: addr += LINUX_SC_AR_CCV; break; + case UNW_IA64_BR + 0: addr += LINUX_SC_BR_OFF + 0; break; + case UNW_IA64_BR + 6: addr += LINUX_SC_BR_OFF + 6*8; break; + case UNW_IA64_BR + 7: addr += LINUX_SC_BR_OFF + 7*8; break; + case UNW_IA64_AR_RSC: addr += LINUX_SC_AR_RSC_OFF; break; + case UNW_IA64_AR_CSD: addr += LINUX_SC_AR_CSD_OFF; break; + case UNW_IA64_AR_SSD: addr += LINUX_SC_AR_SSD_OFF; break; + case UNW_IA64_AR_CCV: addr += LINUX_SC_AR_CCV; break; - default: - if (unw_is_fpreg (reg)) - return IA64_FPREG_LOC (c, reg); - else - return IA64_REG_LOC (c, reg); - } + default: + if (unw_is_fpreg (reg)) + return IA64_FPREG_LOC (c, reg); + else + return IA64_REG_LOC (c, reg); + } return IA64_LOC_ADDR (addr, 0); } else @@ -99,120 +99,120 @@ linux_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr) int is_nat = 0; if ((unsigned) (reg - UNW_IA64_NAT) < 128) - { - is_nat = 1; - reg -= (UNW_IA64_NAT - UNW_IA64_GR); - } + { + is_nat = 1; + reg -= (UNW_IA64_NAT - UNW_IA64_GR); + } if (ia64_get_abi_marker (c) == ABI_MARKER_LINUX_INTERRUPT) - { - switch (reg) - { - case UNW_IA64_BR + 6 ... UNW_IA64_BR + 7: - addr += LINUX_PT_B6_OFF + 8 * (reg - (UNW_IA64_BR + 6)); - break; + { + switch (reg) + { + case UNW_IA64_BR + 6 ... UNW_IA64_BR + 7: + addr += LINUX_PT_B6_OFF + 8 * (reg - (UNW_IA64_BR + 6)); + break; - case UNW_IA64_AR_CSD: addr += LINUX_PT_CSD_OFF; break; - case UNW_IA64_AR_SSD: addr += LINUX_PT_SSD_OFF; break; + case UNW_IA64_AR_CSD: addr += LINUX_PT_CSD_OFF; break; + case UNW_IA64_AR_SSD: addr += LINUX_PT_SSD_OFF; break; - case UNW_IA64_GR + 8 ... UNW_IA64_GR + 11: - addr += LINUX_PT_R8_OFF + 8 * (reg - (UNW_IA64_GR + 8)); - break; + case UNW_IA64_GR + 8 ... UNW_IA64_GR + 11: + addr += LINUX_PT_R8_OFF + 8 * (reg - (UNW_IA64_GR + 8)); + break; - case UNW_IA64_IP: addr += LINUX_PT_IIP_OFF; break; - case UNW_IA64_CFM: addr += LINUX_PT_IFS_OFF; break; - case UNW_IA64_AR_UNAT: addr += LINUX_PT_UNAT_OFF; break; - case UNW_IA64_AR_PFS: addr += LINUX_PT_PFS_OFF; break; - case UNW_IA64_AR_RSC: addr += LINUX_PT_RSC_OFF; break; - case UNW_IA64_AR_RNAT: addr += LINUX_PT_RNAT_OFF; break; - case UNW_IA64_AR_BSPSTORE: addr += LINUX_PT_BSPSTORE_OFF; break; - case UNW_IA64_PR: addr += LINUX_PT_PR_OFF; break; - case UNW_IA64_BR + 0: addr += LINUX_PT_B0_OFF; break; + case UNW_IA64_IP: addr += LINUX_PT_IIP_OFF; break; + case UNW_IA64_CFM: addr += LINUX_PT_IFS_OFF; break; + case UNW_IA64_AR_UNAT: addr += LINUX_PT_UNAT_OFF; break; + case UNW_IA64_AR_PFS: addr += LINUX_PT_PFS_OFF; break; + case UNW_IA64_AR_RSC: addr += LINUX_PT_RSC_OFF; break; + case UNW_IA64_AR_RNAT: addr += LINUX_PT_RNAT_OFF; break; + case UNW_IA64_AR_BSPSTORE: addr += LINUX_PT_BSPSTORE_OFF; break; + case UNW_IA64_PR: addr += LINUX_PT_PR_OFF; break; + case UNW_IA64_BR + 0: addr += LINUX_PT_B0_OFF; break; - case UNW_IA64_GR + 1: - /* The saved r1 value is valid only in the frame in which - it was saved; for everything else we need to look up - the appropriate gp value. */ - if (c->sigcontext_addr != c->sp + 0x10) - return IA64_NULL_LOC; - addr += LINUX_PT_R1_OFF; - break; + case UNW_IA64_GR + 1: + /* The saved r1 value is valid only in the frame in which + it was saved; for everything else we need to look up + the appropriate gp value. */ + if (c->sigcontext_addr != c->sp + 0x10) + return IA64_NULL_LOC; + addr += LINUX_PT_R1_OFF; + break; - case UNW_IA64_GR + 12: addr += LINUX_PT_R12_OFF; break; - case UNW_IA64_GR + 13: addr += LINUX_PT_R13_OFF; break; - case UNW_IA64_AR_FPSR: addr += LINUX_PT_FPSR_OFF; break; - case UNW_IA64_GR + 15: addr += LINUX_PT_R15_OFF; break; - case UNW_IA64_GR + 14: addr += LINUX_PT_R14_OFF; break; - case UNW_IA64_GR + 2: addr += LINUX_PT_R2_OFF; break; - case UNW_IA64_GR + 3: addr += LINUX_PT_R3_OFF; break; + case UNW_IA64_GR + 12: addr += LINUX_PT_R12_OFF; break; + case UNW_IA64_GR + 13: addr += LINUX_PT_R13_OFF; break; + case UNW_IA64_AR_FPSR: addr += LINUX_PT_FPSR_OFF; break; + case UNW_IA64_GR + 15: addr += LINUX_PT_R15_OFF; break; + case UNW_IA64_GR + 14: addr += LINUX_PT_R14_OFF; break; + case UNW_IA64_GR + 2: addr += LINUX_PT_R2_OFF; break; + case UNW_IA64_GR + 3: addr += LINUX_PT_R3_OFF; break; - case UNW_IA64_GR + 16 ... UNW_IA64_GR + 31: - addr += LINUX_PT_R16_OFF + 8 * (reg - (UNW_IA64_GR + 16)); - break; + case UNW_IA64_GR + 16 ... UNW_IA64_GR + 31: + addr += LINUX_PT_R16_OFF + 8 * (reg - (UNW_IA64_GR + 16)); + break; - case UNW_IA64_AR_CCV: addr += LINUX_PT_CCV_OFF; break; + case UNW_IA64_AR_CCV: addr += LINUX_PT_CCV_OFF; break; - case UNW_IA64_FR + 6 ... UNW_IA64_FR + 11: - addr += LINUX_PT_F6_OFF + 16 * (reg - (UNW_IA64_FR + 6)); - return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); + case UNW_IA64_FR + 6 ... UNW_IA64_FR + 11: + addr += LINUX_PT_F6_OFF + 16 * (reg - (UNW_IA64_FR + 6)); + return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); - default: - if (unw_is_fpreg (reg)) - return IA64_FPREG_LOC (c, reg); - else - return IA64_REG_LOC (c, reg); - } - } + default: + if (unw_is_fpreg (reg)) + return IA64_FPREG_LOC (c, reg); + else + return IA64_REG_LOC (c, reg); + } + } else if (ia64_get_abi_marker (c) == ABI_MARKER_OLD_LINUX_INTERRUPT) - { - switch (reg) - { - case UNW_IA64_GR + 1: - /* The saved r1 value is valid only in the frame in which - it was saved; for everything else we need to look up - the appropriate gp value. */ - if (c->sigcontext_addr != c->sp + 0x10) - return IA64_NULL_LOC; - addr += LINUX_OLD_PT_R1_OFF; - break; + { + switch (reg) + { + case UNW_IA64_GR + 1: + /* The saved r1 value is valid only in the frame in which + it was saved; for everything else we need to look up + the appropriate gp value. */ + if (c->sigcontext_addr != c->sp + 0x10) + return IA64_NULL_LOC; + addr += LINUX_OLD_PT_R1_OFF; + break; - case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3: - addr += LINUX_OLD_PT_R2_OFF + 8 * (reg - (UNW_IA64_GR + 2)); - break; + case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3: + addr += LINUX_OLD_PT_R2_OFF + 8 * (reg - (UNW_IA64_GR + 2)); + break; - case UNW_IA64_GR + 8 ... UNW_IA64_GR + 11: - addr += LINUX_OLD_PT_R8_OFF + 8 * (reg - (UNW_IA64_GR + 8)); - break; + case UNW_IA64_GR + 8 ... UNW_IA64_GR + 11: + addr += LINUX_OLD_PT_R8_OFF + 8 * (reg - (UNW_IA64_GR + 8)); + break; - case UNW_IA64_GR + 16 ... UNW_IA64_GR + 31: - addr += LINUX_OLD_PT_R16_OFF + 8 * (reg - (UNW_IA64_GR + 16)); - break; + case UNW_IA64_GR + 16 ... UNW_IA64_GR + 31: + addr += LINUX_OLD_PT_R16_OFF + 8 * (reg - (UNW_IA64_GR + 16)); + break; - case UNW_IA64_FR + 6 ... UNW_IA64_FR + 9: - addr += LINUX_OLD_PT_F6_OFF + 16 * (reg - (UNW_IA64_FR + 6)); - return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); + case UNW_IA64_FR + 6 ... UNW_IA64_FR + 9: + addr += LINUX_OLD_PT_F6_OFF + 16 * (reg - (UNW_IA64_FR + 6)); + return IA64_LOC_ADDR (addr, IA64_LOC_TYPE_FP); - case UNW_IA64_BR + 0: addr += LINUX_OLD_PT_B0_OFF; break; - case UNW_IA64_BR + 6: addr += LINUX_OLD_PT_B6_OFF; break; - case UNW_IA64_BR + 7: addr += LINUX_OLD_PT_B7_OFF; break; + case UNW_IA64_BR + 0: addr += LINUX_OLD_PT_B0_OFF; break; + case UNW_IA64_BR + 6: addr += LINUX_OLD_PT_B6_OFF; break; + case UNW_IA64_BR + 7: addr += LINUX_OLD_PT_B7_OFF; break; - case UNW_IA64_AR_RSC: addr += LINUX_OLD_PT_RSC_OFF; break; - case UNW_IA64_AR_CCV: addr += LINUX_OLD_PT_CCV_OFF; break; + case UNW_IA64_AR_RSC: addr += LINUX_OLD_PT_RSC_OFF; break; + case UNW_IA64_AR_CCV: addr += LINUX_OLD_PT_CCV_OFF; break; - default: - if (unw_is_fpreg (reg)) - return IA64_FPREG_LOC (c, reg); - else - return IA64_REG_LOC (c, reg); - } - } + default: + if (unw_is_fpreg (reg)) + return IA64_FPREG_LOC (c, reg); + else + return IA64_REG_LOC (c, reg); + } + } if (is_nat) - { - /* For Linux pt-regs structure, bit number is determined by - the UNaT slot number (as determined by st8.spill) and the - bits are saved wherever the (primary) UNaT was saved. */ - *nat_bitnr = ia64_unat_slot_num (addr); - return c->loc[IA64_REG_PRI_UNAT_MEM]; - } + { + /* For Linux pt-regs structure, bit number is determined by + the UNaT slot number (as determined by st8.spill) and the + bits are saved wherever the (primary) UNaT was saved. */ + *nat_bitnr = ia64_unat_slot_num (addr); + return c->loc[IA64_REG_PRI_UNAT_MEM]; + } return IA64_LOC_ADDR (addr, 0); } #endif @@ -235,11 +235,11 @@ ia64_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr) if (c->sigcontext_addr) { if (ia64_get_abi (c) == ABI_LINUX) - return linux_scratch_loc (c, reg, nat_bitnr); + return linux_scratch_loc (c, reg, nat_bitnr); else if (ia64_get_abi (c) == ABI_HPUX) - return hpux_scratch_loc (c, reg, nat_bitnr); + return hpux_scratch_loc (c, reg, nat_bitnr); else - return IA64_NULL_LOC; + return IA64_NULL_LOC; } else return IA64_REG_LOC (c, reg); @@ -247,7 +247,7 @@ ia64_scratch_loc (struct cursor *c, unw_regnum_t reg, uint8_t *nat_bitnr) static inline int update_nat (struct cursor *c, ia64_loc_t nat_loc, unw_word_t mask, - unw_word_t *valp, int write) + unw_word_t *valp, int write) { unw_word_t nat_word; int ret; @@ -259,9 +259,9 @@ update_nat (struct cursor *c, ia64_loc_t nat_loc, unw_word_t mask, if (write) { if (*valp) - nat_word |= mask; + nat_word |= mask; else - nat_word &= ~mask; + nat_word &= ~mask; ret = ia64_put (c, nat_loc, nat_word); } else @@ -271,8 +271,8 @@ update_nat (struct cursor *c, ia64_loc_t nat_loc, unw_word_t mask, static int access_nat (struct cursor *c, - ia64_loc_t nat_loc, ia64_loc_t reg_loc, uint8_t nat_bitnr, - unw_word_t *valp, int write) + ia64_loc_t nat_loc, ia64_loc_t reg_loc, uint8_t nat_bitnr, + unw_word_t *valp, int write) { unw_word_t mask = 0; unw_fpreg_t tmp; @@ -281,47 +281,47 @@ access_nat (struct cursor *c, if (IA64_IS_FP_LOC (reg_loc)) { /* NaT bit is saved as a NaTVal. This happens when a general - register is saved to a floating-point register. */ + register is saved to a floating-point register. */ if (write) - { - if (*valp) - { - if (ia64_is_big_endian (c)) - ret = ia64_putfp (c, reg_loc, unw.nat_val_be); - else - ret = ia64_putfp (c, reg_loc, unw.nat_val_le); - } - else - { - unw_word_t *src, *dst; - unw_fpreg_t tmp; + { + if (*valp) + { + if (ia64_is_big_endian (c)) + ret = ia64_putfp (c, reg_loc, unw.nat_val_be); + else + ret = ia64_putfp (c, reg_loc, unw.nat_val_le); + } + else + { + unw_word_t *src, *dst; + unw_fpreg_t tmp; - ret = ia64_getfp (c, reg_loc, &tmp); - if (ret < 0) - return ret; + ret = ia64_getfp (c, reg_loc, &tmp); + if (ret < 0) + return ret; - /* Reset the exponent to 0x1003e so that the significand - will be interpreted as an integer value. */ - src = (unw_word_t *) &unw.int_val_be; - dst = (unw_word_t *) &tmp; - if (!ia64_is_big_endian (c)) - ++src, ++dst; - *dst = *src; + /* Reset the exponent to 0x1003e so that the significand + will be interpreted as an integer value. */ + src = (unw_word_t *) &unw.int_val_be; + dst = (unw_word_t *) &tmp; + if (!ia64_is_big_endian (c)) + ++src, ++dst; + *dst = *src; - ret = ia64_putfp (c, reg_loc, tmp); - } - } + ret = ia64_putfp (c, reg_loc, tmp); + } + } else - { - ret = ia64_getfp (c, reg_loc, &tmp); - if (ret < 0) - return ret; + { + ret = ia64_getfp (c, reg_loc, &tmp); + if (ret < 0) + return ret; - if (ia64_is_big_endian (c)) - *valp = (memcmp (&tmp, &unw.nat_val_be, sizeof (tmp)) == 0); - else - *valp = (memcmp (&tmp, &unw.nat_val_le, sizeof (tmp)) == 0); - } + if (ia64_is_big_endian (c)) + *valp = (memcmp (&tmp, &unw.nat_val_be, sizeof (tmp)) == 0); + else + *valp = (memcmp (&tmp, &unw.nat_val_le, sizeof (tmp)) == 0); + } return ret; } @@ -330,25 +330,25 @@ access_nat (struct cursor *c, || IA64_IS_UC_LOC (reg_loc)) { if (write) - return ia64_put (c, nat_loc, *valp); + return ia64_put (c, nat_loc, *valp); else - return ia64_get (c, nat_loc, valp); + return ia64_get (c, nat_loc, valp); } if (IA64_IS_NULL_LOC (nat_loc)) { /* NaT bit is not saved. This happens if a general register is - saved to a branch register. Since the NaT bit gets lost, we - need to drop it here, too. Note that if the NaT bit had been - set when the save occurred, it would have caused a NaT - consumption fault. */ + saved to a branch register. Since the NaT bit gets lost, we + need to drop it here, too. Note that if the NaT bit had been + set when the save occurred, it would have caused a NaT + consumption fault. */ if (write) - { - if (*valp) - return -UNW_EBADREG; /* can't set NaT bit */ - } + { + if (*valp) + return -UNW_EBADREG; /* can't set NaT bit */ + } else - *valp = 0; + *valp = 0; return 0; } @@ -358,7 +358,7 @@ access_nat (struct cursor *c, HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { ia64_loc_t loc, reg_loc, nat_loc; unw_word_t mask, val; @@ -371,25 +371,25 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, case UNW_IA64_BSP: if (write) - c->bsp = *valp; + c->bsp = *valp; else - *valp = c->bsp; + *valp = c->bsp; return 0; case UNW_REG_SP: if (write) - c->sp = *valp; + c->sp = *valp; else - *valp = c->sp; + *valp = c->sp; return 0; case UNW_REG_IP: if (write) - { - c->ip = *valp; /* also update the IP cache */ - if (c->pi_valid && (*valp < c->pi.start_ip || *valp >= c->pi.end_ip)) - c->pi_valid = 0; /* new IP outside of current proc */ - } + { + c->ip = *valp; /* also update the IP cache */ + if (c->pi_valid && (*valp < c->pi.start_ip || *valp >= c->pi.end_ip)) + c->pi_valid = 0; /* new IP outside of current proc */ + } loc = c->loc[IA64_REG_IP]; break; @@ -405,22 +405,22 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, nat_bitnr = c->nat_bitnr[reg - (UNW_IA64_NAT + 4)]; return access_nat (c, loc, reg_loc, nat_bitnr, valp, write); - case UNW_IA64_AR_BSP: loc = c->loc[IA64_REG_BSP]; break; - case UNW_IA64_AR_BSPSTORE: loc = c->loc[IA64_REG_BSPSTORE]; break; - case UNW_IA64_AR_PFS: loc = c->loc[IA64_REG_PFS]; break; - case UNW_IA64_AR_RNAT: loc = c->loc[IA64_REG_RNAT]; break; - case UNW_IA64_AR_UNAT: loc = c->loc[IA64_REG_UNAT]; break; - case UNW_IA64_AR_LC: loc = c->loc[IA64_REG_LC]; break; - case UNW_IA64_AR_FPSR: loc = c->loc[IA64_REG_FPSR]; break; - case UNW_IA64_BR + 1: loc = c->loc[IA64_REG_B1]; break; - case UNW_IA64_BR + 2: loc = c->loc[IA64_REG_B2]; break; - case UNW_IA64_BR + 3: loc = c->loc[IA64_REG_B3]; break; - case UNW_IA64_BR + 4: loc = c->loc[IA64_REG_B4]; break; - case UNW_IA64_BR + 5: loc = c->loc[IA64_REG_B5]; break; + case UNW_IA64_AR_BSP: loc = c->loc[IA64_REG_BSP]; break; + case UNW_IA64_AR_BSPSTORE: loc = c->loc[IA64_REG_BSPSTORE]; break; + case UNW_IA64_AR_PFS: loc = c->loc[IA64_REG_PFS]; break; + case UNW_IA64_AR_RNAT: loc = c->loc[IA64_REG_RNAT]; break; + case UNW_IA64_AR_UNAT: loc = c->loc[IA64_REG_UNAT]; break; + case UNW_IA64_AR_LC: loc = c->loc[IA64_REG_LC]; break; + case UNW_IA64_AR_FPSR: loc = c->loc[IA64_REG_FPSR]; break; + case UNW_IA64_BR + 1: loc = c->loc[IA64_REG_B1]; break; + case UNW_IA64_BR + 2: loc = c->loc[IA64_REG_B2]; break; + case UNW_IA64_BR + 3: loc = c->loc[IA64_REG_B3]; break; + case UNW_IA64_BR + 4: loc = c->loc[IA64_REG_B4]; break; + case UNW_IA64_BR + 5: loc = c->loc[IA64_REG_B5]; break; case UNW_IA64_CFM: if (write) - c->cfm = *valp; /* also update the CFM cache */ + c->cfm = *valp; /* also update the CFM cache */ loc = c->cfm_loc; break; @@ -430,59 +430,59 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, * (i.e., it is done as if CFM.rrb.pr == 0. */ if (write) - { - c->pr = *valp; /* update the predicate cache */ - return ia64_put (c, c->loc[IA64_REG_PR], *valp); - } + { + c->pr = *valp; /* update the predicate cache */ + return ia64_put (c, c->loc[IA64_REG_PR], *valp); + } else - return ia64_get (c, c->loc[IA64_REG_PR], valp); + return ia64_get (c, c->loc[IA64_REG_PR], valp); - case UNW_IA64_GR + 32 ... UNW_IA64_GR + 127: /* stacked reg */ + case UNW_IA64_GR + 32 ... UNW_IA64_GR + 127: /* stacked reg */ reg = rotate_gr (c, reg - UNW_IA64_GR); if (reg < 0) - return -UNW_EBADREG; + return -UNW_EBADREG; ret = ia64_get_stacked (c, reg, &loc, NULL); if (ret < 0) - return ret; + return ret; break; - case UNW_IA64_NAT + 32 ... UNW_IA64_NAT + 127: /* stacked reg */ + case UNW_IA64_NAT + 32 ... UNW_IA64_NAT + 127: /* stacked reg */ reg = rotate_gr (c, reg - UNW_IA64_NAT); if (reg < 0) - return -UNW_EBADREG; + return -UNW_EBADREG; ret = ia64_get_stacked (c, reg, &loc, &nat_loc); if (ret < 0) - return ret; + return ret; assert (!IA64_IS_REG_LOC (loc)); mask = (unw_word_t) 1 << rse_slot_num (IA64_GET_ADDR (loc)); return update_nat (c, nat_loc, mask, valp, write); case UNW_IA64_AR_EC: if ((ret = ia64_get (c, c->ec_loc, &val)) < 0) - return ret; + return ret; if (write) - { - val = ((val & ~((unw_word_t) 0x3f << 52)) | ((*valp & 0x3f) << 52)); - return ia64_put (c, c->ec_loc, val); - } + { + val = ((val & ~((unw_word_t) 0x3f << 52)) | ((*valp & 0x3f) << 52)); + return ia64_put (c, c->ec_loc, val); + } else - { - *valp = (val >> 52) & 0x3f; - return 0; - } + { + *valp = (val >> 52) & 0x3f; + return 0; + } /* scratch & special registers: */ case UNW_IA64_GR + 0: if (write) - return -UNW_EREADONLYREG; + return -UNW_EREADONLYREG; *valp = 0; return 0; case UNW_IA64_NAT + 0: if (write) - return -UNW_EREADONLYREG; + return -UNW_EREADONLYREG; *valp = 0; return 0; @@ -491,37 +491,37 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, case UNW_IA64_NAT + 8 ... UNW_IA64_NAT + 31: loc = ia64_scratch_loc (c, reg, &nat_bitnr); if (IA64_IS_NULL_LOC (loc) && reg == UNW_IA64_NAT + 1) - { - /* access to GP */ - if (write) - return -UNW_EREADONLYREG; - *valp = 0; - return 0; - } + { + /* access to GP */ + if (write) + return -UNW_EREADONLYREG; + *valp = 0; + return 0; + } if (!(IA64_IS_REG_LOC (loc) || IA64_IS_UC_LOC (loc) - || IA64_IS_FP_LOC (loc))) - /* We're dealing with a NaT bit stored in memory. */ - return update_nat(c, loc, (unw_word_t) 1 << nat_bitnr, valp, write); + || IA64_IS_FP_LOC (loc))) + /* We're dealing with a NaT bit stored in memory. */ + return update_nat(c, loc, (unw_word_t) 1 << nat_bitnr, valp, write); break; case UNW_IA64_GR + 15 ... UNW_IA64_GR + 18: mask = 1 << (reg - (UNW_IA64_GR + 15)); if (write) - { - c->eh_args[reg - (UNW_IA64_GR + 15)] = *valp; - c->eh_valid_mask |= mask; - return 0; - } + { + c->eh_args[reg - (UNW_IA64_GR + 15)] = *valp; + c->eh_valid_mask |= mask; + return 0; + } else if ((c->eh_valid_mask & mask) != 0) - { - *valp = c->eh_args[reg - (UNW_IA64_GR + 15)]; - return 0; - } + { + *valp = c->eh_args[reg - (UNW_IA64_GR + 15)]; + return 0; + } else - loc = ia64_scratch_loc (c, reg, NULL); + loc = ia64_scratch_loc (c, reg, NULL); break; - case UNW_IA64_GR + 1: /* global pointer */ + case UNW_IA64_GR + 1: /* global pointer */ case UNW_IA64_GR + 2 ... UNW_IA64_GR + 3: case UNW_IA64_GR + 8 ... UNW_IA64_GR + 14: case UNW_IA64_GR + 19 ... UNW_IA64_GR + 31: @@ -534,17 +534,17 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, case UNW_IA64_AR_CCV: loc = ia64_scratch_loc (c, reg, NULL); if (IA64_IS_NULL_LOC (loc) && reg == UNW_IA64_GR + 1) - { - /* access to GP */ - if (write) - return -UNW_EREADONLYREG; + { + /* access to GP */ + if (write) + return -UNW_EREADONLYREG; - /* ensure c->pi is up-to-date: */ - if ((ret = ia64_make_proc_info (c)) < 0) - return ret; - *valp = c->pi.gp; - return 0; - } + /* ensure c->pi is up-to-date: */ + if ((ret = ia64_make_proc_info (c)) < 0) + return ret; + *valp = c->pi.gp; + return 0; + } break; default: @@ -560,7 +560,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, int reg, unw_fpreg_t *valp, - int write) + int write) { ia64_loc_t loc; @@ -568,18 +568,18 @@ tdep_access_fpreg (struct cursor *c, int reg, unw_fpreg_t *valp, { case UNW_IA64_FR + 0: if (write) - return -UNW_EREADONLYREG; + return -UNW_EREADONLYREG; *valp = unw.read_only.f0; return 0; case UNW_IA64_FR + 1: if (write) - return -UNW_EREADONLYREG; + return -UNW_EREADONLYREG; if (ia64_is_big_endian (c)) - *valp = unw.read_only.f1_be; + *valp = unw.read_only.f1_be; else - *valp = unw.read_only.f1_le; + *valp = unw.read_only.f1_le; return 0; case UNW_IA64_FR + 2: loc = c->loc[IA64_REG_F2]; break; diff --git a/src/ia64/Gresume.c b/src/ia64/Gresume.c index fe23f766..aa395b69 100644 --- a/src/ia64/Gresume.c +++ b/src/ia64/Gresume.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -51,15 +51,15 @@ local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) } extra; int ret, dirty_size; -# define GET_NAT(n) \ - do \ - { \ - ret = tdep_access_reg (c, UNW_IA64_NAT + (n), &val, 0); \ - if (ret < 0) \ - return ret; \ - if (val) \ - pri_unat |= (unw_word_t) 1 << n; \ - } \ +# define GET_NAT(n) \ + do \ + { \ + ret = tdep_access_reg (c, UNW_IA64_NAT + (n), &val, 0); \ + if (ret < 0) \ + return ret; \ + if (val) \ + pri_unat |= (unw_word_t) 1 << n; \ + } \ while (0) /* ensure c->pi is up-to-date: */ @@ -84,43 +84,43 @@ local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) if (unlikely (c->sigcontext_addr)) { struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; -# define PR_SCRATCH 0xffc0 /* p6-p15 are scratch */ -# define PR_PRESERVED (~(PR_SCRATCH | 1)) +# define PR_SCRATCH 0xffc0 /* p6-p15 are scratch */ +# define PR_PRESERVED (~(PR_SCRATCH | 1)) /* We're returning to a frame that was (either directly or - indirectly) interrupted by a signal. We have to restore - _both_ "preserved" and "scratch" registers. That doesn't - leave us any registers to work with, and the only way we can - achieve this is by doing a sigreturn(). + indirectly) interrupted by a signal. We have to restore + _both_ "preserved" and "scratch" registers. That doesn't + leave us any registers to work with, and the only way we can + achieve this is by doing a sigreturn(). - Note: it might be tempting to think that we don't have to - restore the scratch registers when returning to a frame that - was indirectly interrupted by a signal. However, that is not - safe because that frame and its descendants could have been - using a special convention that stores "preserved" state in - scratch registers. For example, the Linux fsyscall - convention does this with r11 (to save ar.pfs) and b6 (to - save "rp"). */ + Note: it might be tempting to think that we don't have to + restore the scratch registers when returning to a frame that + was indirectly interrupted by a signal. However, that is not + safe because that frame and its descendants could have been + using a special convention that stores "preserved" state in + scratch registers. For example, the Linux fsyscall + convention does this with r11 (to save ar.pfs) and b6 (to + save "rp"). */ sc->sc_gr[12] = c->psp; c->psp = c->sigcontext_addr - c->sigcontext_off; sof = (c->cfm & 0x7f); if ((dirty_size = rbs_cover_and_flush (c, sof, dirty_partition, - &dirty_rnat, &bspstore)) < 0) - return dirty_size; + &dirty_rnat, &bspstore)) < 0) + return dirty_size; /* Clear the "in-syscall" flag, because in general we won't be - returning to the interruption-point and we need all registers - restored. */ + returning to the interruption-point and we need all registers + restored. */ sc->sc_flags &= ~IA64_SC_FLAG_IN_SYSCALL; sc->sc_ip = c->ip; sc->sc_cfm = c->cfm & (((unw_word_t) 1 << 38) - 1); sc->sc_pr = (c->pr & ~PR_SCRATCH) | (sc->sc_pr & ~PR_PRESERVED); if ((ret = ia64_get (c, c->loc[IA64_REG_PFS], &sc->sc_ar_pfs)) < 0 - || (ret = ia64_get (c, c->loc[IA64_REG_FPSR], &sc->sc_ar_fpsr)) < 0 - || (ret = ia64_get (c, c->loc[IA64_REG_UNAT], &sc->sc_ar_unat)) < 0) - return ret; + || (ret = ia64_get (c, c->loc[IA64_REG_FPSR], &sc->sc_ar_fpsr)) < 0 + || (ret = ia64_get (c, c->loc[IA64_REG_UNAT], &sc->sc_ar_unat)) < 0) + return ret; sc->sc_gr[1] = c->pi.gp; if (c->eh_valid_mask & 0x1) sc->sc_gr[15] = c->eh_args[0]; @@ -128,19 +128,19 @@ local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) if (c->eh_valid_mask & 0x4) sc->sc_gr[17] = c->eh_args[2]; if (c->eh_valid_mask & 0x8) sc->sc_gr[18] = c->eh_args[3]; Debug (9, "sc: r15=%lx,r16=%lx,r17=%lx,r18=%lx\n", - (long) sc->sc_gr[15], (long) sc->sc_gr[16], - (long) sc->sc_gr[17], (long) sc->sc_gr[18]); + (long) sc->sc_gr[15], (long) sc->sc_gr[16], + (long) sc->sc_gr[17], (long) sc->sc_gr[18]); } else { /* Account for the fact that _Uia64_install_context() will - return via br.ret, which will decrement bsp by size-of-locals. */ + return via br.ret, which will decrement bsp by size-of-locals. */ if ((ret = ia64_get (c, c->loc[IA64_REG_PFS], &pfs)) < 0) - return ret; + return ret; sol = (pfs >> 7) & 0x7f; if ((dirty_size = rbs_cover_and_flush (c, sol, dirty_partition, - &dirty_rnat, &bspstore)) < 0) - return dirty_size; + &dirty_rnat, &bspstore)) < 0) + return dirty_size; extra.r1 = c->pi.gp; extra.r15 = c->eh_args[0]; @@ -148,17 +148,17 @@ local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) extra.r17 = c->eh_args[2]; extra.r18 = c->eh_args[3]; Debug (9, "extra: r15=%lx,r16=%lx,r17=%lx,r18=%lx\n", - (long) extra.r15, (long) extra.r16, - (long) extra.r17, (long) extra.r18); + (long) extra.r15, (long) extra.r16, + (long) extra.r17, (long) extra.r18); } Debug (8, "resuming at ip=%lx\n", (long) c->ip); ia64_install_cursor (c, pri_unat, (unw_word_t *) &extra, - bspstore, dirty_size, dirty_partition + dirty_size/8, - dirty_rnat); + bspstore, dirty_size, dirty_partition + dirty_size/8, + dirty_rnat); #elif defined(__hpux) struct cursor *c = (struct cursor *) cursor; - setcontext (c->as_arg); /* should not return */ + setcontext (c->as_arg); /* should not return */ #endif return -UNW_EINVAL; } @@ -177,9 +177,9 @@ static inline int remote_install_cursor (struct cursor *c) { int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, - int write, void *); + int write, void *); int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, - int write, void *); + int write, void *); unw_fpreg_t fpval; unw_word_t val; int reg; @@ -188,49 +188,49 @@ remote_install_cursor (struct cursor *c) if (c->as == unw_local_addr_space) { /* Take a short-cut: we directly resume out of the cursor and - all we need to do is make sure that all locations point to - memory, not registers. Furthermore, R4-R7 and NAT4-NAT7 are - taken care of by ia64_local_resume() so they don't need to be - handled here. */ -# define MEMIFY(preg, reg) \ - do { \ - if (IA64_IS_REG_LOC (c->loc[(preg)])) \ - c->loc[(preg)] = IA64_LOC_ADDR ((unw_word_t) \ - tdep_uc_addr(c->as_arg, (reg), \ - NULL), 0); \ + all we need to do is make sure that all locations point to + memory, not registers. Furthermore, R4-R7 and NAT4-NAT7 are + taken care of by ia64_local_resume() so they don't need to be + handled here. */ +# define MEMIFY(preg, reg) \ + do { \ + if (IA64_IS_REG_LOC (c->loc[(preg)])) \ + c->loc[(preg)] = IA64_LOC_ADDR ((unw_word_t) \ + tdep_uc_addr(c->as_arg, (reg), \ + NULL), 0); \ } while (0) - MEMIFY (IA64_REG_PR, UNW_IA64_PR); - MEMIFY (IA64_REG_PFS, UNW_IA64_AR_PFS); - MEMIFY (IA64_REG_RNAT, UNW_IA64_AR_RNAT); - MEMIFY (IA64_REG_UNAT, UNW_IA64_AR_UNAT); - MEMIFY (IA64_REG_LC, UNW_IA64_AR_LC); - MEMIFY (IA64_REG_FPSR, UNW_IA64_AR_FPSR); - MEMIFY (IA64_REG_IP, UNW_IA64_BR + 0); - MEMIFY (IA64_REG_B1, UNW_IA64_BR + 1); - MEMIFY (IA64_REG_B2, UNW_IA64_BR + 2); - MEMIFY (IA64_REG_B3, UNW_IA64_BR + 3); - MEMIFY (IA64_REG_B4, UNW_IA64_BR + 4); - MEMIFY (IA64_REG_B5, UNW_IA64_BR + 5); - MEMIFY (IA64_REG_F2, UNW_IA64_FR + 2); - MEMIFY (IA64_REG_F3, UNW_IA64_FR + 3); - MEMIFY (IA64_REG_F4, UNW_IA64_FR + 4); - MEMIFY (IA64_REG_F5, UNW_IA64_FR + 5); - MEMIFY (IA64_REG_F16, UNW_IA64_FR + 16); - MEMIFY (IA64_REG_F17, UNW_IA64_FR + 17); - MEMIFY (IA64_REG_F18, UNW_IA64_FR + 18); - MEMIFY (IA64_REG_F19, UNW_IA64_FR + 19); - MEMIFY (IA64_REG_F20, UNW_IA64_FR + 20); - MEMIFY (IA64_REG_F21, UNW_IA64_FR + 21); - MEMIFY (IA64_REG_F22, UNW_IA64_FR + 22); - MEMIFY (IA64_REG_F23, UNW_IA64_FR + 23); - MEMIFY (IA64_REG_F24, UNW_IA64_FR + 24); - MEMIFY (IA64_REG_F25, UNW_IA64_FR + 25); - MEMIFY (IA64_REG_F26, UNW_IA64_FR + 26); - MEMIFY (IA64_REG_F27, UNW_IA64_FR + 27); - MEMIFY (IA64_REG_F28, UNW_IA64_FR + 28); - MEMIFY (IA64_REG_F29, UNW_IA64_FR + 29); - MEMIFY (IA64_REG_F30, UNW_IA64_FR + 30); - MEMIFY (IA64_REG_F31, UNW_IA64_FR + 31); + MEMIFY (IA64_REG_PR, UNW_IA64_PR); + MEMIFY (IA64_REG_PFS, UNW_IA64_AR_PFS); + MEMIFY (IA64_REG_RNAT, UNW_IA64_AR_RNAT); + MEMIFY (IA64_REG_UNAT, UNW_IA64_AR_UNAT); + MEMIFY (IA64_REG_LC, UNW_IA64_AR_LC); + MEMIFY (IA64_REG_FPSR, UNW_IA64_AR_FPSR); + MEMIFY (IA64_REG_IP, UNW_IA64_BR + 0); + MEMIFY (IA64_REG_B1, UNW_IA64_BR + 1); + MEMIFY (IA64_REG_B2, UNW_IA64_BR + 2); + MEMIFY (IA64_REG_B3, UNW_IA64_BR + 3); + MEMIFY (IA64_REG_B4, UNW_IA64_BR + 4); + MEMIFY (IA64_REG_B5, UNW_IA64_BR + 5); + MEMIFY (IA64_REG_F2, UNW_IA64_FR + 2); + MEMIFY (IA64_REG_F3, UNW_IA64_FR + 3); + MEMIFY (IA64_REG_F4, UNW_IA64_FR + 4); + MEMIFY (IA64_REG_F5, UNW_IA64_FR + 5); + MEMIFY (IA64_REG_F16, UNW_IA64_FR + 16); + MEMIFY (IA64_REG_F17, UNW_IA64_FR + 17); + MEMIFY (IA64_REG_F18, UNW_IA64_FR + 18); + MEMIFY (IA64_REG_F19, UNW_IA64_FR + 19); + MEMIFY (IA64_REG_F20, UNW_IA64_FR + 20); + MEMIFY (IA64_REG_F21, UNW_IA64_FR + 21); + MEMIFY (IA64_REG_F22, UNW_IA64_FR + 22); + MEMIFY (IA64_REG_F23, UNW_IA64_FR + 23); + MEMIFY (IA64_REG_F24, UNW_IA64_FR + 24); + MEMIFY (IA64_REG_F25, UNW_IA64_FR + 25); + MEMIFY (IA64_REG_F26, UNW_IA64_FR + 26); + MEMIFY (IA64_REG_F27, UNW_IA64_FR + 27); + MEMIFY (IA64_REG_F28, UNW_IA64_FR + 28); + MEMIFY (IA64_REG_F29, UNW_IA64_FR + 29); + MEMIFY (IA64_REG_F30, UNW_IA64_FR + 30); + MEMIFY (IA64_REG_F31, UNW_IA64_FR + 31); } else #endif /* __linux && !UNW_REMOTE_ONLY */ @@ -241,18 +241,18 @@ remote_install_cursor (struct cursor *c) Debug (8, "copying out cursor state\n"); for (reg = 0; reg <= UNW_REG_LAST; ++reg) - { - if (unw_is_fpreg (reg)) - { - if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) - (*access_fpreg) (c->as, reg, &fpval, 1, c->as_arg); - } - else - { - if (tdep_access_reg (c, reg, &val, 0) >= 0) - (*access_reg) (c->as, reg, &val, 1, c->as_arg); - } - } + { + if (unw_is_fpreg (reg)) + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + (*access_fpreg) (c->as, reg, &fpval, 1, c->as_arg); + } + else + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + (*access_reg) (c->as, reg, &val, 1, c->as_arg); + } + } } return (*c->as->acc.resume) (c->as, (unw_cursor_t *) c, c->as_arg); } diff --git a/src/ia64/Gscript.c b/src/ia64/Gscript.c index 5d8f2e1e..e96e89e0 100644 --- a/src/ia64/Gscript.c +++ b/src/ia64/Gscript.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -29,19 +29,19 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ enum ia64_script_insn_opcode { - IA64_INSN_INC_PSP, /* psp += val */ - IA64_INSN_LOAD_PSP, /* psp = *psp_loc */ - IA64_INSN_ADD_PSP, /* s[dst] = (s.psp + val) */ - IA64_INSN_ADD_PSP_NAT, /* like above, but with NaT info */ - IA64_INSN_ADD_SP, /* s[dst] = (s.sp + val) */ - IA64_INSN_ADD_SP_NAT, /* like above, but with NaT info */ - IA64_INSN_MOVE, /* s[dst] = s[val] */ - IA64_INSN_MOVE_NAT, /* like above, but with NaT info */ - IA64_INSN_MOVE_NO_NAT, /* like above, but clear NaT info */ - IA64_INSN_MOVE_STACKED, /* s[dst] = rse_skip(*s.bsp_loc, val) */ - IA64_INSN_MOVE_STACKED_NAT, /* like above, but with NaT info */ - IA64_INSN_MOVE_SCRATCH, /* s[dst] = scratch reg "val" */ - IA64_INSN_MOVE_SCRATCH_NAT, /* like above, but with NaT info */ + IA64_INSN_INC_PSP, /* psp += val */ + IA64_INSN_LOAD_PSP, /* psp = *psp_loc */ + IA64_INSN_ADD_PSP, /* s[dst] = (s.psp + val) */ + IA64_INSN_ADD_PSP_NAT, /* like above, but with NaT info */ + IA64_INSN_ADD_SP, /* s[dst] = (s.sp + val) */ + IA64_INSN_ADD_SP_NAT, /* like above, but with NaT info */ + IA64_INSN_MOVE, /* s[dst] = s[val] */ + IA64_INSN_MOVE_NAT, /* like above, but with NaT info */ + IA64_INSN_MOVE_NO_NAT, /* like above, but clear NaT info */ + IA64_INSN_MOVE_STACKED, /* s[dst] = rse_skip(*s.bsp_loc, val) */ + IA64_INSN_MOVE_STACKED_NAT, /* like above, but with NaT info */ + IA64_INSN_MOVE_SCRATCH, /* s[dst] = scratch reg "val" */ + IA64_INSN_MOVE_SCRATCH_NAT, /* like above, but with NaT info */ IA64_INSN_MOVE_SCRATCH_NO_NAT /* like above, but clear NaT info */ }; @@ -60,7 +60,7 @@ static inline unw_hash_index_t CONST_ATTR hash (unw_word_t ip) { /* based on (sqrt(5)/2-1)*2^64 */ -# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL) +# define magic ((unw_word_t) 0x9e3779b97f4a7c16ULL) return (ip >> 4) * magic >> (64 - IA64_LOG_UNW_HASH_SIZE); } @@ -84,7 +84,7 @@ flush_script_cache (struct ia64_script_cache *cache) for (i = 0; i < IA64_UNW_CACHE_SIZE; ++i) { if (i > 0) - cache->buckets[i].lru_chain = (i - 1); + cache->buckets[i].lru_chain = (i - 1); cache->buckets[i].coll_chain = -1; cache->buckets[i].ip = 0; } @@ -131,7 +131,7 @@ get_script_cache (unw_addr_space_t as, intrmask_t *saved_maskp) static inline void put_script_cache (unw_addr_space_t as, struct ia64_script_cache *cache, - intrmask_t *saved_maskp) + intrmask_t *saved_maskp) { assert (as->caching_policy != UNW_CACHE_NONE); @@ -169,14 +169,14 @@ script_lookup (struct ia64_script_cache *cache, struct cursor *c) while (1) { if (cache_match (script, ip, pr)) - { - /* update hint; no locking needed: single-word writes are atomic */ - c->hint = cache->buckets[c->prev_script].hint = - (script - cache->buckets); - return script; - } + { + /* update hint; no locking needed: single-word writes are atomic */ + c->hint = cache->buckets[c->prev_script].hint = + (script - cache->buckets); + return script; + } if (script->coll_chain >= IA64_UNW_HASH_SIZE) - return 0; + return 0; script = cache->buckets + script->coll_chain; } } @@ -212,22 +212,22 @@ script_new (struct ia64_script_cache *cache, unw_word_t ip) tmp = cache->buckets + cache->hash[index]; prev = 0; while (1) - { - if (tmp == script) - { - if (prev) - prev->coll_chain = tmp->coll_chain; - else - cache->hash[index] = tmp->coll_chain; - break; - } - else - prev = tmp; - if (tmp->coll_chain >= IA64_UNW_CACHE_SIZE) - /* old script wasn't in the hash-table */ - break; - tmp = cache->buckets + tmp->coll_chain; - } + { + if (tmp == script) + { + if (prev) + prev->coll_chain = tmp->coll_chain; + else + cache->hash[index] = tmp->coll_chain; + break; + } + else + prev = tmp; + if (tmp->coll_chain >= IA64_UNW_CACHE_SIZE) + /* old script wasn't in the hash-table */ + break; + tmp = cache->buckets + tmp->coll_chain; + } } /* enter new script in the hash table */ @@ -241,7 +241,7 @@ script_new (struct ia64_script_cache *cache, unw_word_t ip) static inline void script_finalize (struct ia64_script *script, struct cursor *c, - struct ia64_state_record *sr) + struct ia64_state_record *sr) { script->pr_mask = sr->pr_mask; script->pr_val = sr->pr_val; @@ -254,7 +254,7 @@ script_emit (struct ia64_script *script, struct ia64_script_insn insn) if (script->count >= IA64_MAX_SCRIPT_LEN) { Dprintf ("%s: script exceeds maximum size of %u instructions!\n", - __FUNCTION__, IA64_MAX_SCRIPT_LEN); + __FUNCTION__, IA64_MAX_SCRIPT_LEN); return; } script->insn[script->count++] = insn; @@ -262,7 +262,7 @@ script_emit (struct ia64_script *script, struct ia64_script_insn insn) static void compile_reg (struct ia64_state_record *sr, int i, struct ia64_reg_info *r, - struct ia64_script *script) + struct ia64_script *script) { enum ia64_script_insn_opcode opc; unsigned long val, rval; @@ -280,94 +280,94 @@ compile_reg (struct ia64_state_record *sr, int i, struct ia64_reg_info *r, { /* Handle most common case first... */ if (rval >= 32) - { - /* register got spilled to a stacked register */ - if (is_preserved_gr) - opc = IA64_INSN_MOVE_STACKED_NAT; - else - opc = IA64_INSN_MOVE_STACKED; - val = rval; - } + { + /* register got spilled to a stacked register */ + if (is_preserved_gr) + opc = IA64_INSN_MOVE_STACKED_NAT; + else + opc = IA64_INSN_MOVE_STACKED; + val = rval; + } else if (rval >= 4 && rval <= 7) - { - /* register got spilled to a preserved register */ - val = IA64_REG_R4 + (rval - 4); - if (is_preserved_gr) - opc = IA64_INSN_MOVE_NAT; - } + { + /* register got spilled to a preserved register */ + val = IA64_REG_R4 + (rval - 4); + if (is_preserved_gr) + opc = IA64_INSN_MOVE_NAT; + } else - { - /* register got spilled to a scratch register */ - if (is_preserved_gr) - opc = IA64_INSN_MOVE_SCRATCH_NAT; - else - opc = IA64_INSN_MOVE_SCRATCH; - val = UNW_IA64_GR + rval; - } + { + /* register got spilled to a scratch register */ + if (is_preserved_gr) + opc = IA64_INSN_MOVE_SCRATCH_NAT; + else + opc = IA64_INSN_MOVE_SCRATCH; + val = UNW_IA64_GR + rval; + } } else { switch (r->where) - { - case IA64_WHERE_FR: - /* Note: There is no need to handle NaT-bit info here - (indepent of is_preserved_gr), because for floating-point - NaTs are represented as NaTVal, so the NaT-info never - needs to be consulated. */ - if (rval >= 2 && rval <= 5) - val = IA64_REG_F2 + (rval - 2); - else if (rval >= 16 && rval <= 31) - val = IA64_REG_F16 + (rval - 16); - else - { - opc = IA64_INSN_MOVE_SCRATCH; - val = UNW_IA64_FR + rval; - } - break; + { + case IA64_WHERE_FR: + /* Note: There is no need to handle NaT-bit info here + (indepent of is_preserved_gr), because for floating-point + NaTs are represented as NaTVal, so the NaT-info never + needs to be consulated. */ + if (rval >= 2 && rval <= 5) + val = IA64_REG_F2 + (rval - 2); + else if (rval >= 16 && rval <= 31) + val = IA64_REG_F16 + (rval - 16); + else + { + opc = IA64_INSN_MOVE_SCRATCH; + val = UNW_IA64_FR + rval; + } + break; - case IA64_WHERE_BR: - if (rval >= 1 && rval <= 5) - { - val = IA64_REG_B1 + (rval - 1); - if (is_preserved_gr) - opc = IA64_INSN_MOVE_NO_NAT; - } - else - { - opc = IA64_INSN_MOVE_SCRATCH; - if (is_preserved_gr) - opc = IA64_INSN_MOVE_SCRATCH_NO_NAT; - val = UNW_IA64_BR + rval; - } - break; + case IA64_WHERE_BR: + if (rval >= 1 && rval <= 5) + { + val = IA64_REG_B1 + (rval - 1); + if (is_preserved_gr) + opc = IA64_INSN_MOVE_NO_NAT; + } + else + { + opc = IA64_INSN_MOVE_SCRATCH; + if (is_preserved_gr) + opc = IA64_INSN_MOVE_SCRATCH_NO_NAT; + val = UNW_IA64_BR + rval; + } + break; - case IA64_WHERE_SPREL: - if (is_preserved_gr) - opc = IA64_INSN_ADD_SP_NAT; - else - { - opc = IA64_INSN_ADD_SP; - if (i >= IA64_REG_F2 && i <= IA64_REG_F31) - val |= IA64_LOC_TYPE_FP; - } - break; + case IA64_WHERE_SPREL: + if (is_preserved_gr) + opc = IA64_INSN_ADD_SP_NAT; + else + { + opc = IA64_INSN_ADD_SP; + if (i >= IA64_REG_F2 && i <= IA64_REG_F31) + val |= IA64_LOC_TYPE_FP; + } + break; - case IA64_WHERE_PSPREL: - if (is_preserved_gr) - opc = IA64_INSN_ADD_PSP_NAT; - else - { - opc = IA64_INSN_ADD_PSP; - if (i >= IA64_REG_F2 && i <= IA64_REG_F31) - val |= IA64_LOC_TYPE_FP; - } - break; + case IA64_WHERE_PSPREL: + if (is_preserved_gr) + opc = IA64_INSN_ADD_PSP_NAT; + else + { + opc = IA64_INSN_ADD_PSP; + if (i >= IA64_REG_F2 && i <= IA64_REG_F31) + val |= IA64_LOC_TYPE_FP; + } + break; - default: - Dprintf ("%s: register %u has unexpected `where' value of %u\n", - __FUNCTION__, i, r->where); - break; - } + default: + Dprintf ("%s: register %u has unexpected `where' value of %u\n", + __FUNCTION__, i, r->where); + break; + } } insn.opc = opc; insn.dst = i; @@ -377,8 +377,8 @@ compile_reg (struct ia64_state_record *sr, int i, struct ia64_reg_info *r, if (i == IA64_REG_PSP) { /* c->psp must contain the _value_ of the previous sp, not it's - save-location. We get this by dereferencing the value we - just stored in loc[IA64_REG_PSP]: */ + save-location. We get this by dereferencing the value we + just stored in loc[IA64_REG_PSP]: */ insn.opc = IA64_INSN_LOAD_PSP; script_emit (script, insn); } @@ -400,8 +400,8 @@ sort_regs (struct ia64_state_record *sr, int regorder[]) for (r = IA64_REG_BSP; r < IA64_NUM_PREGS; ++r) { if (sr->curr.reg[r].where == IA64_WHERE_NONE - || sr->curr.reg[r].when >= sr->when_target) - continue; + || sr->curr.reg[r].when >= sr->when_target) + continue; regorder[num_regs++] = r; } @@ -416,17 +416,17 @@ sort_regs (struct ia64_state_record *sr, int regorder[]) max_when = sr->curr.reg[max_reg].when; for (j = i + 1; j < num_regs; ++j) - if (sr->curr.reg[regorder[j]].when > max_when) - { - max = j; - max_reg = regorder[j]; - max_when = sr->curr.reg[max_reg].when; - } + if (sr->curr.reg[regorder[j]].when > max_when) + { + max = j; + max_reg = regorder[j]; + max_when = sr->curr.reg[max_reg].when; + } if (i != max) - { - regorder[max] = regorder[i]; - regorder[i] = max_reg; - } + { + regorder[max] = regorder[i]; + regorder[i] = max_reg; + } } return num_regs; } @@ -457,7 +457,7 @@ build_script (struct cursor *c, struct ia64_script *script) { /* new psp is psp plus frame size */ insn.opc = IA64_INSN_INC_PSP; - insn.val = sr.curr.reg[IA64_REG_PSP].val; /* frame size */ + insn.val = sr.curr.reg[IA64_REG_PSP].val; /* frame size */ script_emit (script, insn); } else @@ -469,18 +469,18 @@ build_script (struct cursor *c, struct ia64_script *script) || sr.when_target >= sr.curr.reg[IA64_REG_PRI_UNAT_MEM].when) { if (sr.when_target < sr.curr.reg[IA64_REG_PRI_UNAT_GR].when) - /* (primary) NaT bits were saved to memory only */ - pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_MEM; + /* (primary) NaT bits were saved to memory only */ + pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_MEM; else if (sr.when_target < sr.curr.reg[IA64_REG_PRI_UNAT_MEM].when) - /* (primary) NaT bits were saved to a register only */ - pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_GR; + /* (primary) NaT bits were saved to a register only */ + pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_GR; else if (sr.curr.reg[IA64_REG_PRI_UNAT_MEM].when > - sr.curr.reg[IA64_REG_PRI_UNAT_GR].when) - /* (primary) NaT bits were last saved to memory */ - pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_MEM; + sr.curr.reg[IA64_REG_PRI_UNAT_GR].when) + /* (primary) NaT bits were last saved to memory */ + pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_MEM; else - /* (primary) NaT bits were last saved to a register */ - pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_GR; + /* (primary) NaT bits were last saved to a register */ + pri_unat = sr.curr.reg + IA64_REG_PRI_UNAT_GR; /* Note: we always store the final primary-UNaT location in UNAT_MEM. */ compile_reg (&sr, IA64_REG_PRI_UNAT_MEM, pri_unat, script); @@ -501,7 +501,7 @@ build_script (struct cursor *c, struct ia64_script *script) static inline void set_nat_info (struct cursor *c, unsigned long dst, - ia64_loc_t nat_loc, uint8_t bitnr) + ia64_loc_t nat_loc, uint8_t bitnr) { assert (dst >= IA64_REG_R4 && dst <= IA64_REG_R7); @@ -538,79 +538,79 @@ run_script (struct ia64_script *script, struct cursor *c) /* This is by far the most common operation: */ if (likely (opc == IA64_INSN_MOVE_STACKED)) - { - if ((ret = ia64_get_stacked (c, val, &loc, NULL)) < 0) - return ret; - } + { + if ((ret = ia64_get_stacked (c, val, &loc, NULL)) < 0) + return ret; + } else - switch (opc) - { - case IA64_INSN_INC_PSP: - c->psp += val; - continue; + switch (opc) + { + case IA64_INSN_INC_PSP: + c->psp += val; + continue; - case IA64_INSN_LOAD_PSP: - if ((ret = ia64_get (c, c->loc[IA64_REG_PSP], &c->psp)) < 0) - return ret; - continue; + case IA64_INSN_LOAD_PSP: + if ((ret = ia64_get (c, c->loc[IA64_REG_PSP], &c->psp)) < 0) + return ret; + continue; - case IA64_INSN_ADD_PSP: - loc = IA64_LOC_ADDR (c->psp + val, (val & IA64_LOC_TYPE_FP)); - break; + case IA64_INSN_ADD_PSP: + loc = IA64_LOC_ADDR (c->psp + val, (val & IA64_LOC_TYPE_FP)); + break; - case IA64_INSN_ADD_SP: - loc = IA64_LOC_ADDR (c->sp + val, (val & IA64_LOC_TYPE_FP)); - break; + case IA64_INSN_ADD_SP: + loc = IA64_LOC_ADDR (c->sp + val, (val & IA64_LOC_TYPE_FP)); + break; - case IA64_INSN_MOVE_NO_NAT: - set_nat_info (c, dst, IA64_NULL_LOC, 0); - case IA64_INSN_MOVE: - loc = c->loc[val]; - break; + case IA64_INSN_MOVE_NO_NAT: + set_nat_info (c, dst, IA64_NULL_LOC, 0); + case IA64_INSN_MOVE: + loc = c->loc[val]; + break; - case IA64_INSN_MOVE_SCRATCH_NO_NAT: - set_nat_info (c, dst, IA64_NULL_LOC, 0); - case IA64_INSN_MOVE_SCRATCH: - loc = ia64_scratch_loc (c, val, NULL); - break; + case IA64_INSN_MOVE_SCRATCH_NO_NAT: + set_nat_info (c, dst, IA64_NULL_LOC, 0); + case IA64_INSN_MOVE_SCRATCH: + loc = ia64_scratch_loc (c, val, NULL); + break; - case IA64_INSN_ADD_PSP_NAT: - loc = IA64_LOC_ADDR (c->psp + val, 0); - assert (!IA64_IS_REG_LOC (loc)); - set_nat_info (c, dst, - c->loc[IA64_REG_PRI_UNAT_MEM], - ia64_unat_slot_num (IA64_GET_ADDR (loc))); - break; + case IA64_INSN_ADD_PSP_NAT: + loc = IA64_LOC_ADDR (c->psp + val, 0); + assert (!IA64_IS_REG_LOC (loc)); + set_nat_info (c, dst, + c->loc[IA64_REG_PRI_UNAT_MEM], + ia64_unat_slot_num (IA64_GET_ADDR (loc))); + break; - case IA64_INSN_ADD_SP_NAT: - loc = IA64_LOC_ADDR (c->sp + val, 0); - assert (!IA64_IS_REG_LOC (loc)); - set_nat_info (c, dst, - c->loc[IA64_REG_PRI_UNAT_MEM], - ia64_unat_slot_num (IA64_GET_ADDR (loc))); - break; + case IA64_INSN_ADD_SP_NAT: + loc = IA64_LOC_ADDR (c->sp + val, 0); + assert (!IA64_IS_REG_LOC (loc)); + set_nat_info (c, dst, + c->loc[IA64_REG_PRI_UNAT_MEM], + ia64_unat_slot_num (IA64_GET_ADDR (loc))); + break; - case IA64_INSN_MOVE_NAT: - loc = c->loc[val]; - set_nat_info (c, dst, - c->loc[val - IA64_REG_R4 + IA64_REG_NAT4], - c->nat_bitnr[val - IA64_REG_R4]); - break; + case IA64_INSN_MOVE_NAT: + loc = c->loc[val]; + set_nat_info (c, dst, + c->loc[val - IA64_REG_R4 + IA64_REG_NAT4], + c->nat_bitnr[val - IA64_REG_R4]); + break; - case IA64_INSN_MOVE_STACKED_NAT: - if ((ret = ia64_get_stacked (c, val, &loc, &nat_loc)) < 0) - return ret; - assert (!IA64_IS_REG_LOC (loc)); - set_nat_info (c, dst, nat_loc, rse_slot_num (IA64_GET_ADDR (loc))); - break; + case IA64_INSN_MOVE_STACKED_NAT: + if ((ret = ia64_get_stacked (c, val, &loc, &nat_loc)) < 0) + return ret; + assert (!IA64_IS_REG_LOC (loc)); + set_nat_info (c, dst, nat_loc, rse_slot_num (IA64_GET_ADDR (loc))); + break; - case IA64_INSN_MOVE_SCRATCH_NAT: - loc = ia64_scratch_loc (c, val, NULL); - nat_loc = ia64_scratch_loc (c, val + (UNW_IA64_NAT - UNW_IA64_GR), - &nat_bitnr); - set_nat_info (c, dst, nat_loc, nat_bitnr); - break; - } + case IA64_INSN_MOVE_SCRATCH_NAT: + loc = ia64_scratch_loc (c, val, NULL); + nat_loc = ia64_scratch_loc (c, val + (UNW_IA64_NAT - UNW_IA64_GR), + &nat_bitnr); + set_nat_info (c, dst, nat_loc, nat_bitnr); + break; + } c->loc[dst] = loc; } return 0; @@ -629,8 +629,8 @@ uncached_find_save_locs (struct cursor *c) if ((ret = build_script (c, &script)) < 0) { if (ret != -UNW_ESTOPUNWIND) - Dprintf ("%s: failed to build unwind script for ip %lx\n", - __FUNCTION__, (long) c->ip); + Dprintf ("%s: failed to build unwind script for ip %lx\n", + __FUNCTION__, (long) c->ip); return ret; } return run_script (&script, c); @@ -656,23 +656,23 @@ ia64_find_save_locs (struct cursor *c) { script = script_lookup (cache, c); Debug (8, "ip %lx %s in script cache\n", (long) c->ip, - script ? "hit" : "missed"); + script ? "hit" : "missed"); if (!script || (script->count == 0 && !script->pi.unwind_info)) { - if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0) - goto out; + if ((ret = ia64_fetch_proc_info (c, c->ip, 1)) < 0) + goto out; } if (!script) { - script = script_new (cache, c->ip); - if (!script) - { - Dprintf ("%s: failed to create unwind script\n", __FUNCTION__); - ret = -UNW_EUNSPEC; - goto out; - } + script = script_new (cache, c->ip); + if (!script) + { + Dprintf ("%s: failed to create unwind script\n", __FUNCTION__); + ret = -UNW_EUNSPEC; + goto out; + } } cache->buckets[c->prev_script].hint = script - cache->buckets; @@ -686,10 +686,10 @@ ia64_find_save_locs (struct cursor *c) if (ret < 0) { - if (ret != -UNW_ESTOPUNWIND) - Dprintf ("%s: failed to locate/build unwind script for ip %lx\n", - __FUNCTION__, (long) c->ip); - goto out; + if (ret != -UNW_ESTOPUNWIND) + Dprintf ("%s: failed to locate/build unwind script for ip %lx\n", + __FUNCTION__, (long) c->ip); + goto out; } ret = run_script (script, c); @@ -723,7 +723,7 @@ ia64_cache_proc_info (struct cursor *c) cache = get_script_cache (c->as, &saved_mask); if (!cache) - return ret; /* cache is busy */ + return ret; /* cache is busy */ /* Re-check to see if a cache entry has been added in the meantime: */ script = script_lookup (cache, c); @@ -754,7 +754,7 @@ ia64_get_cached_proc_info (struct cursor *c) cache = get_script_cache (c->as, &saved_mask); if (!cache) - return -UNW_ENOINFO; /* cache is busy */ + return -UNW_ENOINFO; /* cache is busy */ { script = script_lookup (cache, c); if (script) diff --git a/src/ia64/Gstep.c b/src/ia64/Gstep.c index e6329107..0191f642 100644 --- a/src/ia64/Gstep.c +++ b/src/ia64/Gstep.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ static inline int linux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc, - unw_word_t *num_regsp) + unw_word_t *num_regsp) { #if defined(UNW_LOCAL_ONLY) && !defined(__linux) return -UNW_EINVAL; @@ -37,8 +37,8 @@ linux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc, int ret; if ((ret = ia64_get (c, IA64_LOC_ADDR (c->sp + 0x10 - + LINUX_SIGFRAME_ARG2_OFF, 0), - &sc_addr)) < 0) + + LINUX_SIGFRAME_ARG2_OFF, 0), + &sc_addr)) < 0) return ret; c->sigcontext_addr = sc_addr; @@ -47,7 +47,7 @@ linux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc, && IA64_GET_ADDR (c->loc[IA64_REG_IP]) == sc_addr + LINUX_SC_BR_OFF + 8) { /* Linux kernels before 2.4.19 and 2.5.10 had buggy - unwind info for sigtramp. Fix it up here. */ + unwind info for sigtramp. Fix it up here. */ c->loc[IA64_REG_IP] = IA64_LOC_ADDR (sc_addr + LINUX_SC_IP_OFF, 0); c->cfm_loc = IA64_LOC_ADDR (sc_addr + LINUX_SC_CFM_OFF, 0); } @@ -55,14 +55,14 @@ linux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc, /* do what can't be described by unwind directives: */ c->loc[IA64_REG_PFS] = IA64_LOC_ADDR (sc_addr + LINUX_SC_AR_PFS_OFF, 0); c->ec_loc = prev_cfm_loc; - *num_regsp = c->cfm & 0x7f; /* size of frame */ + *num_regsp = c->cfm & 0x7f; /* size of frame */ return 0; #endif } static inline int linux_interrupt (struct cursor *c, ia64_loc_t prev_cfm_loc, - unw_word_t *num_regsp, int marker) + unw_word_t *num_regsp, int marker) { #if defined(UNW_LOCAL_ONLY) && !(defined(__linux) && defined(__KERNEL__)) return -UNW_EINVAL; @@ -79,19 +79,19 @@ linux_interrupt (struct cursor *c, ia64_loc_t prev_cfm_loc, /* do what can't be described by unwind directives: */ if (marker == ABI_MARKER_OLD_LINUX_INTERRUPT) - pfs_loc = IA64_LOC_ADDR (sc_addr + LINUX_OLD_PT_PFS_OFF, 0); + pfs_loc = IA64_LOC_ADDR (sc_addr + LINUX_OLD_PT_PFS_OFF, 0); else - pfs_loc = IA64_LOC_ADDR (sc_addr + LINUX_PT_PFS_OFF, 0); + pfs_loc = IA64_LOC_ADDR (sc_addr + LINUX_PT_PFS_OFF, 0); c->loc[IA64_REG_PFS] = pfs_loc; c->ec_loc = prev_cfm_loc; - *num_regsp = num_regs; /* size of frame */ + *num_regsp = num_regs; /* size of frame */ return 0; #endif } static inline int hpux_sigtramp (struct cursor *c, ia64_loc_t prev_cfm_loc, - unw_word_t *num_regsp) + unw_word_t *num_regsp) { #if defined(UNW_LOCAL_ONLY) && !defined(__hpux) return -UNW_EINVAL; @@ -177,36 +177,36 @@ check_rbs_switch (struct cursor *c) if (c->pi.flags & UNW_PI_FLAG_IA64_RBS_SWITCH) { /* Got ourselves a frame that has saved ar.bspstore, ar.bsp, - and ar.rnat, so we're all set for rbs-switching: */ + and ar.rnat, so we're all set for rbs-switching: */ if ((ret = ia64_get (c, c->loc[IA64_REG_BSP], &saved_bsp)) < 0 - || (ret = ia64_get (c, c->loc[IA64_REG_BSPSTORE], &saved_bspstore))) - return ret; + || (ret = ia64_get (c, c->loc[IA64_REG_BSPSTORE], &saved_bspstore))) + return ret; } else if ((c->abi_marker == ABI_MARKER_LINUX_SIGTRAMP - || c->abi_marker == ABI_MARKER_OLD_LINUX_SIGTRAMP) - && !IA64_IS_REG_LOC (c->loc[IA64_REG_BSP]) - && (IA64_GET_ADDR (c->loc[IA64_REG_BSP]) - == c->sigcontext_addr + LINUX_SC_AR_BSP_OFF)) + || c->abi_marker == ABI_MARKER_OLD_LINUX_SIGTRAMP) + && !IA64_IS_REG_LOC (c->loc[IA64_REG_BSP]) + && (IA64_GET_ADDR (c->loc[IA64_REG_BSP]) + == c->sigcontext_addr + LINUX_SC_AR_BSP_OFF)) { /* When Linux delivers a signal on an alternate stack, it - does things a bit differently from what the unwind - conventions allow us to describe: instead of saving - ar.rnat, ar.bsp, and ar.bspstore, it saves the former two - plus the "loadrs" value. Because of this, we need to - detect & record a potential rbs-area switch - manually... */ + does things a bit differently from what the unwind + conventions allow us to describe: instead of saving + ar.rnat, ar.bsp, and ar.bspstore, it saves the former two + plus the "loadrs" value. Because of this, we need to + detect & record a potential rbs-area switch + manually... */ /* If ar.bsp has been saved already AND the current bsp is - not equal to the saved value, then we know for sure that - we're past the point where the backing store has been - switched (and before the point where it's restored). */ + not equal to the saved value, then we know for sure that + we're past the point where the backing store has been + switched (and before the point where it's restored). */ if ((ret = ia64_get (c, IA64_LOC_ADDR (c->sigcontext_addr - + LINUX_SC_AR_BSP_OFF, 0), - &saved_bsp) < 0) - || (ret = ia64_get (c, IA64_LOC_ADDR (c->sigcontext_addr - + LINUX_SC_LOADRS_OFF, 0), - &loadrs) < 0)) - return ret; + + LINUX_SC_AR_BSP_OFF, 0), + &saved_bsp) < 0) + || (ret = ia64_get (c, IA64_LOC_ADDR (c->sigcontext_addr + + LINUX_SC_LOADRS_OFF, 0), + &loadrs) < 0)) + return ret; loadrs >>= 16; ndirty = rse_num_regs (c->bsp - loadrs, c->bsp); saved_bspstore = rse_skip_regs (saved_bsp, -ndirty); @@ -267,54 +267,54 @@ update_frame_state (struct cursor *c) { c->last_abi_marker = c->abi_marker; switch (ia64_get_abi_marker (c)) - { - case ABI_MARKER_LINUX_SIGTRAMP: - case ABI_MARKER_OLD_LINUX_SIGTRAMP: - ia64_set_abi (c, ABI_LINUX); - if ((ret = linux_sigtramp (c, prev_cfm_loc, &num_regs)) < 0) - return ret; - break; + { + case ABI_MARKER_LINUX_SIGTRAMP: + case ABI_MARKER_OLD_LINUX_SIGTRAMP: + ia64_set_abi (c, ABI_LINUX); + if ((ret = linux_sigtramp (c, prev_cfm_loc, &num_regs)) < 0) + return ret; + break; - case ABI_MARKER_OLD_LINUX_INTERRUPT: - case ABI_MARKER_LINUX_INTERRUPT: - ia64_set_abi (c, ABI_LINUX); - if ((ret = linux_interrupt (c, prev_cfm_loc, &num_regs, - c->abi_marker)) < 0) - return ret; - break; + case ABI_MARKER_OLD_LINUX_INTERRUPT: + case ABI_MARKER_LINUX_INTERRUPT: + ia64_set_abi (c, ABI_LINUX); + if ((ret = linux_interrupt (c, prev_cfm_loc, &num_regs, + c->abi_marker)) < 0) + return ret; + break; - case ABI_MARKER_HP_UX_SIGTRAMP: - ia64_set_abi (c, ABI_HPUX); - if ((ret = hpux_sigtramp (c, prev_cfm_loc, &num_regs)) < 0) - return ret; - break; + case ABI_MARKER_HP_UX_SIGTRAMP: + ia64_set_abi (c, ABI_HPUX); + if ((ret = hpux_sigtramp (c, prev_cfm_loc, &num_regs)) < 0) + return ret; + break; - default: - Debug (1, "unknown ABI marker: ABI=%u, context=%u\n", - c->abi_marker >> 8, c->abi_marker & 0xff); - return -UNW_EINVAL; - } + default: + Debug (1, "unknown ABI marker: ABI=%u, context=%u\n", + c->abi_marker >> 8, c->abi_marker & 0xff); + return -UNW_EINVAL; + } Debug (12, "sigcontext_addr=%lx (ret=%d)\n", - (unsigned long) c->sigcontext_addr, ret); + (unsigned long) c->sigcontext_addr, ret); c->sigcontext_off = c->sigcontext_addr - c->sp; /* update the IP cache: */ if ((ret = ia64_get (c, c->loc[IA64_REG_IP], &ip)) < 0) - return ret; + return ret; c->ip = ip; if (ip == 0) - /* end of frame-chain reached */ - return 0; + /* end of frame-chain reached */ + return 0; } else - num_regs = (c->cfm >> 7) & 0x7f; /* size of locals */ + num_regs = (c->cfm >> 7) & 0x7f; /* size of locals */ if (!IA64_IS_NULL_LOC (c->loc[IA64_REG_BSP])) { ret = check_rbs_switch (c); if (ret < 0) - return ret; + return ret; } c->bsp = rse_skip_regs (c->bsp, -num_regs); @@ -325,7 +325,7 @@ update_frame_state (struct cursor *c) if (c->ip == prev_ip && c->sp == prev_sp && c->bsp == prev_bsp) { Dprintf ("%s: ip, sp, and bsp unchanged; stopping here (ip=0x%lx)\n", - __FUNCTION__, (long) ip); + __FUNCTION__, (long) ip); return -UNW_EBADFRAME; } diff --git a/src/ia64/Gtables.c b/src/ia64/Gtables.c index de9e86f0..6959cae9 100644 --- a/src/ia64/Gtables.c +++ b/src/ia64/Gtables.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2001-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -74,17 +74,17 @@ read_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *valp, void *arg) } /* Helper macro for reading an ia64_table_entry from remote memory. */ -#define remote_read(addr, member) \ - (*a->access_mem) (as, (addr) + offsetof (struct ia64_table_entry, \ - member), &member, 0, arg) +#define remote_read(addr, member) \ + (*a->access_mem) (as, (addr) + offsetof (struct ia64_table_entry, \ + member), &member, 0, arg) /* Lookup an unwind-table entry in remote memory. Returns 1 if an entry is found, 0 if no entry is found, negative if an error occurred reading remote memory. */ static int remote_lookup (unw_addr_space_t as, - unw_word_t table, size_t table_size, unw_word_t rel_ip, - struct ia64_table_entry *e, void *arg) + unw_word_t table, size_t table_size, unw_word_t rel_ip, + struct ia64_table_entry *e, void *arg) { unw_word_t e_addr = 0, start_offset, end_offset, info_offset; unw_accessors_t *a = unw_get_accessors (as); @@ -97,20 +97,20 @@ remote_lookup (unw_addr_space_t as, mid = (lo + hi) / 2; e_addr = table + mid * sizeof (struct ia64_table_entry); if ((ret = remote_read (e_addr, start_offset)) < 0) - return ret; + return ret; if (rel_ip < start_offset) - hi = mid; + hi = mid; else - { - if ((ret = remote_read (e_addr, end_offset)) < 0) - return ret; + { + if ((ret = remote_read (e_addr, end_offset)) < 0) + return ret; - if (rel_ip >= end_offset) - lo = mid + 1; - else - break; - } + if (rel_ip >= end_offset) + lo = mid + 1; + else + break; + } } if (rel_ip < start_offset || rel_ip >= end_offset) return 0; @@ -157,7 +157,7 @@ _Uia64_find_dyn_list (unw_addr_space_t as, unw_dyn_info_t *di, void *arg) table_size = di->u.ti.table_len * sizeof (di->u.ti.table_data[0]); segbase = di->u.ti.segbase; if (table_size < sizeof (struct ia64_table_entry)) - return 0; + return 0; start_offset = e[0].start_offset; end_offset = e[0].end_offset; info_offset = e[0].info_offset; @@ -165,18 +165,18 @@ _Uia64_find_dyn_list (unw_addr_space_t as, unw_dyn_info_t *di, void *arg) case UNW_INFO_FORMAT_REMOTE_TABLE: { - unw_accessors_t *a = unw_get_accessors (as); - unw_word_t e_addr = di->u.rti.table_data; + unw_accessors_t *a = unw_get_accessors (as); + unw_word_t e_addr = di->u.rti.table_data; - table_size = di->u.rti.table_len * sizeof (unw_word_t); - segbase = di->u.rti.segbase; - if (table_size < sizeof (struct ia64_table_entry)) - return 0; + table_size = di->u.rti.table_len * sizeof (unw_word_t); + segbase = di->u.rti.segbase; + if (table_size < sizeof (struct ia64_table_entry)) + return 0; - if ( (ret = remote_read (e_addr, start_offset) < 0) - || (ret = remote_read (e_addr, end_offset) < 0) - || (ret = remote_read (e_addr, info_offset) < 0)) - return ret; + if ( (ret = remote_read (e_addr, start_offset) < 0) + || (ret = remote_read (e_addr, end_offset) < 0) + || (ret = remote_read (e_addr, info_offset) < 0)) + return ret; } break; } @@ -236,11 +236,11 @@ lookup (struct ia64_table_entry *table, size_t table_size, unw_word_t rel_ip) mid = (lo + hi) / 2; e = table + mid; if (rel_ip < e->start_offset) - hi = mid; + hi = mid; else if (rel_ip >= e->end_offset) - lo = mid + 1; + lo = mid + 1; else - break; + break; } if (rel_ip < e->start_offset || rel_ip >= e->end_offset) return NULL; @@ -249,8 +249,8 @@ lookup (struct ia64_table_entry *table, size_t table_size, unw_word_t rel_ip) PROTECTED int unw_search_ia64_unwind_table (unw_addr_space_t as, unw_word_t ip, - unw_dyn_info_t *di, unw_proc_info_t *pi, - int need_unwind_info, void *arg) + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg) { unw_word_t addr, hdr_addr, info_addr, info_end_addr, hdr, *wp; const struct ia64_table_entry *e = NULL; @@ -261,8 +261,8 @@ unw_search_ia64_unwind_table (unw_addr_space_t as, unw_word_t ip, #endif assert ((di->format == UNW_INFO_FORMAT_TABLE - || di->format == UNW_INFO_FORMAT_REMOTE_TABLE) - && (ip >= di->start_ip && ip < di->end_ip)); + || di->format == UNW_INFO_FORMAT_REMOTE_TABLE) + && (ip >= di->start_ip && ip < di->end_ip)); pi->flags = 0; pi->unwind_info = 0; @@ -272,26 +272,26 @@ unw_search_ia64_unwind_table (unw_addr_space_t as, unw_word_t ip, { segbase = di->u.ti.segbase; e = lookup ((struct ia64_table_entry *) di->u.ti.table_data, - di->u.ti.table_len * sizeof (unw_word_t), - ip - segbase); + di->u.ti.table_len * sizeof (unw_word_t), + ip - segbase); } #ifndef UNW_LOCAL_ONLY else { segbase = di->u.rti.segbase; if ((ret = remote_lookup (as, di->u.rti.table_data, - di->u.rti.table_len * sizeof (unw_word_t), - ip - segbase, &ent, arg)) < 0) - return ret; + di->u.rti.table_len * sizeof (unw_word_t), + ip - segbase, &ent, arg)) < 0) + return ret; if (ret) - e = &ent; + e = &ent; } #endif if (!e) { /* IP is inside this table's range, but there is no explicit - unwind info => use default conventions (i.e., this is NOT an - error). */ + unwind info => use default conventions (i.e., this is NOT an + error). */ memset (pi, 0, sizeof (*pi)); pi->start_ip = 0; pi->end_ip = 0; @@ -316,8 +316,8 @@ unw_search_ia64_unwind_table (unw_addr_space_t as, unw_word_t ip, if (IA64_UNW_VER (hdr) != 1) { Debug (1, "Unknown header version %ld (hdr word=0x%lx @ 0x%lx)\n", - IA64_UNW_VER (hdr), (unsigned long) hdr, - (unsigned long) hdr_addr); + IA64_UNW_VER (hdr), (unsigned long) hdr, + (unsigned long) hdr_addr); return -UNW_EBADVERSION; } @@ -333,36 +333,36 @@ unw_search_ia64_unwind_table (unw_addr_space_t as, unw_word_t ip, pi->unwind_info_size = 8 * IA64_UNW_LENGTH (hdr); if (is_local) - pi->unwind_info = (void *) (uintptr_t) info_addr; + pi->unwind_info = (void *) (uintptr_t) info_addr; else - { - /* Internalize unwind info. Note: since we're doing this - only for non-local address spaces, there is no - signal-safety issue and it is OK to use malloc()/free(). */ - pi->unwind_info = malloc (8 * IA64_UNW_LENGTH (hdr)); - if (!pi->unwind_info) - return -UNW_ENOMEM; + { + /* Internalize unwind info. Note: since we're doing this + only for non-local address spaces, there is no + signal-safety issue and it is OK to use malloc()/free(). */ + pi->unwind_info = malloc (8 * IA64_UNW_LENGTH (hdr)); + if (!pi->unwind_info) + return -UNW_ENOMEM; - wp = (unw_word_t *) pi->unwind_info; - for (addr = info_addr; addr < info_end_addr; addr += 8, ++wp) - { - if ((ret = read_mem (as, addr, wp, arg)) < 0) - { - free (pi->unwind_info); - return ret; - } - } - } + wp = (unw_word_t *) pi->unwind_info; + for (addr = info_addr; addr < info_end_addr; addr += 8, ++wp) + { + if ((ret = read_mem (as, addr, wp, arg)) < 0) + { + free (pi->unwind_info); + return ret; + } + } + } } if (IA64_UNW_FLAG_EHANDLER (hdr) || IA64_UNW_FLAG_UHANDLER (hdr)) { /* read the personality routine address (address is gp-relative): */ if ((ret = read_mem (as, info_end_addr, &handler_offset, arg)) < 0) - return ret; + return ret; Debug (4, "handler ptr @ offset=%lx, gp=%lx\n", handler_offset, di->gp); if ((read_mem (as, handler_offset + di->gp, &pi->handler, arg)) < 0) - return ret; + return ret; } pi->lsda = info_end_addr + 8; pi->gp = di->gp; @@ -387,7 +387,7 @@ unw_search_ia64_unwind_table (unw_addr_space_t as, unw_word_t ip, # include # include # ifndef __NR_getunwind -# define __NR_getunwind 1215 +# define __NR_getunwind 1215 # endif static unsigned long @@ -413,7 +413,7 @@ get_kernel_table (unw_dyn_info_t *di) if (!ktab) { Dprintf (__FILE__".%s: failed to allocate %zu bytes", - __FUNCTION__, size); + __FUNCTION__, size); return -UNW_ENOMEM; } getunwind (ktab, size); @@ -432,8 +432,8 @@ get_kernel_table (unw_dyn_info_t *di) di->u.ti.table_data = (unw_word_t *) ktab; Debug (16, "found table `%s': [%lx-%lx) segbase=%lx len=%lu\n", - (char *) di->u.ti.name_ptr, di->start_ip, di->end_ip, - di->u.ti.segbase, di->u.ti.table_len); + (char *) di->u.ti.name_ptr, di->start_ip, di->end_ip, + di->u.ti.segbase, di->u.ti.table_len); return 0; } @@ -478,11 +478,11 @@ callback (struct dl_phdr_info *info, size_t size, void *ptr) /* Make sure struct dl_phdr_info is at least as big as we need. */ if (size < offsetof (struct dl_phdr_info, dlpi_phnum) - + sizeof (info->dlpi_phnum)) + + sizeof (info->dlpi_phnum)) return -1; Debug (16, "checking `%s' (load_base=%lx)\n", - info->dlpi_name, info->dlpi_addr); + info->dlpi_name, info->dlpi_addr); phdr = info->dlpi_phdr; load_base = info->dlpi_addr; @@ -495,52 +495,52 @@ callback (struct dl_phdr_info *info, size_t size, void *ptr) for (n = info->dlpi_phnum; --n >= 0; phdr++) { if (phdr->p_type == PT_LOAD) - { - Elf64_Addr vaddr = phdr->p_vaddr + load_base; - if (di->u.ti.segbase >= vaddr - && di->u.ti.segbase < vaddr + phdr->p_memsz) - p_text = phdr; - } + { + Elf64_Addr vaddr = phdr->p_vaddr + load_base; + if (di->u.ti.segbase >= vaddr + && di->u.ti.segbase < vaddr + phdr->p_memsz) + p_text = phdr; + } else if (phdr->p_type == PT_IA_64_UNWIND) - p_unwind = phdr; + p_unwind = phdr; else if (phdr->p_type == PT_DYNAMIC) - p_dynamic = phdr; + p_dynamic = phdr; } if (!p_text || !p_unwind) return 0; if (likely (p_unwind->p_vaddr >= p_text->p_vaddr - && p_unwind->p_vaddr < p_text->p_vaddr + p_text->p_memsz)) + && p_unwind->p_vaddr < p_text->p_vaddr + p_text->p_memsz)) /* normal case: unwind table is inside text segment */ segbase = p_text->p_vaddr + load_base; else { /* Special case: unwind table is in some other segment; this - happens for the Linux kernel's gate DSO, for example. */ + happens for the Linux kernel's gate DSO, for example. */ phdr = info->dlpi_phdr; for (n = info->dlpi_phnum; --n >= 0; phdr++) - { - if (phdr->p_type == PT_LOAD && p_unwind->p_vaddr >= phdr->p_vaddr - && p_unwind->p_vaddr < phdr->p_vaddr + phdr->p_memsz) - { - segbase = phdr->p_vaddr + load_base; - break; - } - } + { + if (phdr->p_type == PT_LOAD && p_unwind->p_vaddr >= phdr->p_vaddr + && p_unwind->p_vaddr < phdr->p_vaddr + phdr->p_memsz) + { + segbase = phdr->p_vaddr + load_base; + break; + } + } } if (p_dynamic) { /* For dynamicly linked executables and shared libraries, - DT_PLTGOT is the gp value for that object. */ + DT_PLTGOT is the gp value for that object. */ Elf64_Dyn *dyn = (Elf64_Dyn *)(p_dynamic->p_vaddr + load_base); for (; dyn->d_tag != DT_NULL; ++dyn) - if (dyn->d_tag == DT_PLTGOT) - { - /* On IA-64, _DYNAMIC is writable and GLIBC has relocated it. */ - di->gp = dyn->d_un.d_ptr; - break; - } + if (dyn->d_tag == DT_PLTGOT) + { + /* On IA-64, _DYNAMIC is writable and GLIBC has relocated it. */ + di->gp = dyn->d_un.d_ptr; + break; + } } else /* Otherwise this is a static executable with no _DYNAMIC. @@ -555,8 +555,8 @@ callback (struct dl_phdr_info *info, size_t size, void *ptr) di->u.ti.segbase = segbase; Debug (16, "found table `%s': segbase=%lx, len=%lu, gp=%lx, " - "table_data=%p\n", (char *) di->u.ti.name_ptr, di->u.ti.segbase, - di->u.ti.table_len, di->gp, di->u.ti.table_data); + "table_data=%p\n", (char *) di->u.ti.name_ptr, di->u.ti.segbase, + di->u.ti.table_len, di->gp, di->u.ti.table_data); return 1; } @@ -611,7 +611,7 @@ check_callback (struct dl_phdr_info *info, size_t size, void *ptr) as->shared_object_removals = info->dlpi_subs; unw_flush_cache (as, 0, 0); - return -1; /* indicate that there were removals */ + return -1; /* indicate that there were removals */ # else return 1; # endif @@ -645,14 +645,14 @@ validate_cache (unw_addr_space_t as) HIDDEN int tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, int need_unwind_info, void *arg) + unw_proc_info_t *pi, int need_unwind_info, void *arg) { # if defined(HAVE_DL_ITERATE_PHDR) unw_dyn_info_t di, *dip = &di; intrmask_t saved_mask; int ret; - di.u.ti.segbase = ip; /* this is cheap... */ + di.u.ti.segbase = ip; /* this is cheap... */ SIGPROCMASK (SIG_SETMASK, &unwi_full_mask, &saved_mask); ret = dl_iterate_phdr (callback, &di); @@ -661,16 +661,16 @@ tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, if (ret <= 0) { if (!kernel_table.u.ti.table_data) - { - if ((ret = get_kernel_table (&kernel_table)) < 0) - return ret; - } + { + if ((ret = get_kernel_table (&kernel_table)) < 0) + return ret; + } if (ip < kernel_table.start_ip || ip >= kernel_table.end_ip) - return -UNW_ENOINFO; + return -UNW_ENOINFO; dip = &kernel_table; } # elif defined(HAVE_DLMODINFO) -# define UNWIND_TBL_32BIT 0x8000000000000000 +# define UNWIND_TBL_32BIT 0x8000000000000000 struct load_module_desc lmd; unw_dyn_info_t di, *dip = &di; struct unwind_header @@ -688,7 +688,7 @@ tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, di.start_ip = lmd.text_base; di.end_ip = lmd.text_base + lmd.text_size; di.gp = lmd.linkage_ptr; - di.u.ti.name_ptr = 0; /* no obvious table-name available */ + di.u.ti.name_ptr = 0; /* no obvious table-name available */ di.u.ti.segbase = lmd.text_base; uhdr = (struct unwind_header *) lmd.unwind_base; @@ -697,7 +697,7 @@ tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, && (uhdr->header_version & ~UNWIND_TBL_32BIT) != 2) { Debug (1, "encountered unknown unwind header version %ld\n", - (long) (uhdr->header_version & ~UNWIND_TBL_32BIT)); + (long) (uhdr->header_version & ~UNWIND_TBL_32BIT)); return -UNW_EBADVERSION; } if (uhdr->header_version & UNWIND_TBL_32BIT) @@ -708,11 +708,11 @@ tdep_find_proc_info (unw_addr_space_t as, unw_word_t ip, di.u.ti.table_data = (unw_word_t *) (di.u.ti.segbase + uhdr->start_offset); di.u.ti.table_len = ((uhdr->end_offset - uhdr->start_offset) - / sizeof (unw_word_t)); + / sizeof (unw_word_t)); Debug (16, "found table `%s': segbase=%lx, len=%lu, gp=%lx, " - "table_data=%p\n", (char *) di.u.ti.name_ptr, di.u.ti.segbase, - di.u.ti.table_len, di.gp, di.u.ti.table_data); + "table_data=%p\n", (char *) di.u.ti.name_ptr, di.u.ti.segbase, + di.u.ti.table_len, di.gp, di.u.ti.table_data); # endif /* now search the table: */ diff --git a/src/ia64/init.h b/src/ia64/init.h index 1f3f956d..6628a1d8 100644 --- a/src/ia64/init.h +++ b/src/ia64/init.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -35,17 +35,17 @@ common_init (struct cursor *c, unw_word_t sp, unw_word_t bsp) /* ensure cache doesn't have any stale contents: */ ia64_validate_cache (c->as, c->as_arg); - c->cfm_loc = IA64_REG_LOC (c, UNW_IA64_CFM); - c->loc[IA64_REG_BSP] = IA64_NULL_LOC; - c->loc[IA64_REG_BSPSTORE] = IA64_REG_LOC (c, UNW_IA64_AR_BSPSTORE); - c->loc[IA64_REG_PFS] = IA64_REG_LOC (c, UNW_IA64_AR_PFS); - c->loc[IA64_REG_RNAT] = IA64_REG_LOC (c, UNW_IA64_AR_RNAT); - c->loc[IA64_REG_IP] = IA64_REG_LOC (c, UNW_IA64_IP); + c->cfm_loc = IA64_REG_LOC (c, UNW_IA64_CFM); + c->loc[IA64_REG_BSP] = IA64_NULL_LOC; + c->loc[IA64_REG_BSPSTORE] = IA64_REG_LOC (c, UNW_IA64_AR_BSPSTORE); + c->loc[IA64_REG_PFS] = IA64_REG_LOC (c, UNW_IA64_AR_PFS); + c->loc[IA64_REG_RNAT] = IA64_REG_LOC (c, UNW_IA64_AR_RNAT); + c->loc[IA64_REG_IP] = IA64_REG_LOC (c, UNW_IA64_IP); c->loc[IA64_REG_PRI_UNAT_MEM] = IA64_NULL_LOC; /* no primary UNaT location */ - c->loc[IA64_REG_UNAT] = IA64_REG_LOC (c, UNW_IA64_AR_UNAT); - c->loc[IA64_REG_PR] = IA64_REG_LOC (c, UNW_IA64_PR); - c->loc[IA64_REG_LC] = IA64_REG_LOC (c, UNW_IA64_AR_LC); - c->loc[IA64_REG_FPSR] = IA64_REG_LOC (c, UNW_IA64_AR_FPSR); + c->loc[IA64_REG_UNAT] = IA64_REG_LOC (c, UNW_IA64_AR_UNAT); + c->loc[IA64_REG_PR] = IA64_REG_LOC (c, UNW_IA64_PR); + c->loc[IA64_REG_LC] = IA64_REG_LOC (c, UNW_IA64_AR_LC); + c->loc[IA64_REG_FPSR] = IA64_REG_LOC (c, UNW_IA64_AR_FPSR); c->loc[IA64_REG_R4] = IA64_REG_LOC (c, UNW_IA64_GR + 4); c->loc[IA64_REG_R5] = IA64_REG_LOC (c, UNW_IA64_GR + 5); @@ -115,8 +115,8 @@ common_init (struct cursor *c, unw_word_t sp, unw_word_t bsp) c->rbs_area[0].size = bspstore - rbs_base; c->rbs_area[0].rnat_loc = IA64_REG_LOC (c, UNW_IA64_AR_RNAT); Debug (10, "initial rbs-area: [0x%llx-0x%llx), rnat@%s\n", - (long long) rbs_base, (long long) c->rbs_area[0].end, - ia64_strloc (c->rbs_area[0].rnat_loc)); + (long long) rbs_base, (long long) c->rbs_area[0].end, + ia64_strloc (c->rbs_area[0].rnat_loc)); c->pi.flags = 0; diff --git a/src/ia64/mk_Gcursor_i.c b/src/ia64/mk_Gcursor_i.c index b8f32531..67b14d52 100644 --- a/src/ia64/mk_Gcursor_i.c +++ b/src/ia64/mk_Gcursor_i.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -31,10 +31,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ # undef offsetof #endif -#define offsetof(type,field) ((char *) &((type *) 0)->field - (char *) 0) +#define offsetof(type,field) ((char *) &((type *) 0)->field - (char *) 0) #define OFFSET(sym, offset) \ - asm volatile("\n->" #sym " %0" : : "i" (offset)) + asm volatile("\n->" #sym " %0" : : "i" (offset)) int main (void) diff --git a/src/ia64/offsets.h b/src/ia64/offsets.h index b169933b..5ab7f8b3 100644 --- a/src/ia64/offsets.h +++ b/src/ia64/offsets.h @@ -6,132 +6,132 @@ number, siginfo pointer, and sigcontext pointer passed to the signal handler. We use this to locate the sigcontext pointer. */ -#define LINUX_SIGFRAME_ARG2_OFF 0x10 +#define LINUX_SIGFRAME_ARG2_OFF 0x10 -#define LINUX_SC_FLAGS_OFF 0x000 -#define LINUX_SC_NAT_OFF 0x008 -#define LINUX_SC_STACK_OFF 0x010 -#define LINUX_SC_IP_OFF 0x028 -#define LINUX_SC_CFM_OFF 0x030 -#define LINUX_SC_UM_OFF 0x038 -#define LINUX_SC_AR_RSC_OFF 0x040 -#define LINUX_SC_AR_BSP_OFF 0x048 -#define LINUX_SC_AR_RNAT_OFF 0x050 -#define LINUX_SC_AR_CCV 0x058 -#define LINUX_SC_AR_UNAT_OFF 0x060 -#define LINUX_SC_AR_FPSR_OFF 0x068 -#define LINUX_SC_AR_PFS_OFF 0x070 -#define LINUX_SC_AR_LC_OFF 0x078 -#define LINUX_SC_PR_OFF 0x080 -#define LINUX_SC_BR_OFF 0x088 -#define LINUX_SC_GR_OFF 0x0c8 -#define LINUX_SC_FR_OFF 0x1d0 -#define LINUX_SC_RBS_BASE_OFF 0x9d0 -#define LINUX_SC_LOADRS_OFF 0x9d8 -#define LINUX_SC_AR_CSD_OFF 0x9e0 -#define LINUX_SC_AR_SSD_OFF 0x9e8 -#define LINUX_SC_MASK 0xa50 +#define LINUX_SC_FLAGS_OFF 0x000 +#define LINUX_SC_NAT_OFF 0x008 +#define LINUX_SC_STACK_OFF 0x010 +#define LINUX_SC_IP_OFF 0x028 +#define LINUX_SC_CFM_OFF 0x030 +#define LINUX_SC_UM_OFF 0x038 +#define LINUX_SC_AR_RSC_OFF 0x040 +#define LINUX_SC_AR_BSP_OFF 0x048 +#define LINUX_SC_AR_RNAT_OFF 0x050 +#define LINUX_SC_AR_CCV 0x058 +#define LINUX_SC_AR_UNAT_OFF 0x060 +#define LINUX_SC_AR_FPSR_OFF 0x068 +#define LINUX_SC_AR_PFS_OFF 0x070 +#define LINUX_SC_AR_LC_OFF 0x078 +#define LINUX_SC_PR_OFF 0x080 +#define LINUX_SC_BR_OFF 0x088 +#define LINUX_SC_GR_OFF 0x0c8 +#define LINUX_SC_FR_OFF 0x1d0 +#define LINUX_SC_RBS_BASE_OFF 0x9d0 +#define LINUX_SC_LOADRS_OFF 0x9d8 +#define LINUX_SC_AR_CSD_OFF 0x9e0 +#define LINUX_SC_AR_SSD_OFF 0x9e8 +#define LINUX_SC_MASK 0xa50 /* Layout of old Linux kernel interrupt frame (struct pt_regs). */ -#define LINUX_OLD_PT_IPSR_OFF 0x000 -#define LINUX_OLD_PT_IIP_OFF 0x008 -#define LINUX_OLD_PT_IFS_OFF 0x010 -#define LINUX_OLD_PT_UNAT_OFF 0x018 -#define LINUX_OLD_PT_PFS_OFF 0x020 -#define LINUX_OLD_PT_RSC_OFF 0x028 -#define LINUX_OLD_PT_RNAT_OFF 0x030 +#define LINUX_OLD_PT_IPSR_OFF 0x000 +#define LINUX_OLD_PT_IIP_OFF 0x008 +#define LINUX_OLD_PT_IFS_OFF 0x010 +#define LINUX_OLD_PT_UNAT_OFF 0x018 +#define LINUX_OLD_PT_PFS_OFF 0x020 +#define LINUX_OLD_PT_RSC_OFF 0x028 +#define LINUX_OLD_PT_RNAT_OFF 0x030 #define LINUX_OLD_PT_BSPSTORE_OFF 0x038 -#define LINUX_OLD_PT_PR_OFF 0x040 -#define LINUX_OLD_PT_B6_OFF 0x048 -#define LINUX_OLD_PT_LOADRS_OFF 0x050 -#define LINUX_OLD_PT_R1_OFF 0x058 -#define LINUX_OLD_PT_R2_OFF 0x060 -#define LINUX_OLD_PT_R3_OFF 0x068 -#define LINUX_OLD_PT_R12_OFF 0x070 -#define LINUX_OLD_PT_R13_OFF 0x078 -#define LINUX_OLD_PT_R14_OFF 0x080 -#define LINUX_OLD_PT_R15_OFF 0x088 -#define LINUX_OLD_PT_R8_OFF 0x090 -#define LINUX_OLD_PT_R9_OFF 0x098 -#define LINUX_OLD_PT_R10_OFF 0x0a0 -#define LINUX_OLD_PT_R11_OFF 0x0a8 -#define LINUX_OLD_PT_R16_OFF 0x0b0 -#define LINUX_OLD_PT_R17_OFF 0x0b8 -#define LINUX_OLD_PT_R18_OFF 0x0c0 -#define LINUX_OLD_PT_R19_OFF 0x0c8 -#define LINUX_OLD_PT_R20_OFF 0x0d0 -#define LINUX_OLD_PT_R21_OFF 0x0d8 -#define LINUX_OLD_PT_R22_OFF 0x0e0 -#define LINUX_OLD_PT_R23_OFF 0x0e8 -#define LINUX_OLD_PT_R24_OFF 0x0f0 -#define LINUX_OLD_PT_R25_OFF 0x0f8 -#define LINUX_OLD_PT_R26_OFF 0x100 -#define LINUX_OLD_PT_R27_OFF 0x108 -#define LINUX_OLD_PT_R28_OFF 0x110 -#define LINUX_OLD_PT_R29_OFF 0x118 -#define LINUX_OLD_PT_R30_OFF 0x120 -#define LINUX_OLD_PT_R31_OFF 0x128 -#define LINUX_OLD_PT_CCV_OFF 0x130 -#define LINUX_OLD_PT_FPSR_OFF 0x138 -#define LINUX_OLD_PT_B0_OFF 0x140 -#define LINUX_OLD_PT_B7_OFF 0x148 -#define LINUX_OLD_PT_F6_OFF 0x150 -#define LINUX_OLD_PT_F7_OFF 0x160 -#define LINUX_OLD_PT_F8_OFF 0x170 -#define LINUX_OLD_PT_F9_OFF 0x180 +#define LINUX_OLD_PT_PR_OFF 0x040 +#define LINUX_OLD_PT_B6_OFF 0x048 +#define LINUX_OLD_PT_LOADRS_OFF 0x050 +#define LINUX_OLD_PT_R1_OFF 0x058 +#define LINUX_OLD_PT_R2_OFF 0x060 +#define LINUX_OLD_PT_R3_OFF 0x068 +#define LINUX_OLD_PT_R12_OFF 0x070 +#define LINUX_OLD_PT_R13_OFF 0x078 +#define LINUX_OLD_PT_R14_OFF 0x080 +#define LINUX_OLD_PT_R15_OFF 0x088 +#define LINUX_OLD_PT_R8_OFF 0x090 +#define LINUX_OLD_PT_R9_OFF 0x098 +#define LINUX_OLD_PT_R10_OFF 0x0a0 +#define LINUX_OLD_PT_R11_OFF 0x0a8 +#define LINUX_OLD_PT_R16_OFF 0x0b0 +#define LINUX_OLD_PT_R17_OFF 0x0b8 +#define LINUX_OLD_PT_R18_OFF 0x0c0 +#define LINUX_OLD_PT_R19_OFF 0x0c8 +#define LINUX_OLD_PT_R20_OFF 0x0d0 +#define LINUX_OLD_PT_R21_OFF 0x0d8 +#define LINUX_OLD_PT_R22_OFF 0x0e0 +#define LINUX_OLD_PT_R23_OFF 0x0e8 +#define LINUX_OLD_PT_R24_OFF 0x0f0 +#define LINUX_OLD_PT_R25_OFF 0x0f8 +#define LINUX_OLD_PT_R26_OFF 0x100 +#define LINUX_OLD_PT_R27_OFF 0x108 +#define LINUX_OLD_PT_R28_OFF 0x110 +#define LINUX_OLD_PT_R29_OFF 0x118 +#define LINUX_OLD_PT_R30_OFF 0x120 +#define LINUX_OLD_PT_R31_OFF 0x128 +#define LINUX_OLD_PT_CCV_OFF 0x130 +#define LINUX_OLD_PT_FPSR_OFF 0x138 +#define LINUX_OLD_PT_B0_OFF 0x140 +#define LINUX_OLD_PT_B7_OFF 0x148 +#define LINUX_OLD_PT_F6_OFF 0x150 +#define LINUX_OLD_PT_F7_OFF 0x160 +#define LINUX_OLD_PT_F8_OFF 0x170 +#define LINUX_OLD_PT_F9_OFF 0x180 /* Layout of new Linux kernel interrupt frame (struct pt_regs). */ -#define LINUX_PT_B6_OFF 0 -#define LINUX_PT_B7_OFF 8 -#define LINUX_PT_CSD_OFF 16 -#define LINUX_PT_SSD_OFF 24 -#define LINUX_PT_R8_OFF 32 -#define LINUX_PT_R9_OFF 40 -#define LINUX_PT_R10_OFF 48 -#define LINUX_PT_R11_OFF 56 -#define LINUX_PT_IPSR_OFF 64 -#define LINUX_PT_IIP_OFF 72 -#define LINUX_PT_IFS_OFF 80 -#define LINUX_PT_UNAT_OFF 88 -#define LINUX_PT_PFS_OFF 96 -#define LINUX_PT_RSC_OFF 104 -#define LINUX_PT_RNAT_OFF 112 -#define LINUX_PT_BSPSTORE_OFF 120 -#define LINUX_PT_PR_OFF 128 -#define LINUX_PT_B0_OFF 136 -#define LINUX_PT_LOADRS_OFF 144 -#define LINUX_PT_R1_OFF 152 -#define LINUX_PT_R12_OFF 160 -#define LINUX_PT_R13_OFF 168 -#define LINUX_PT_FPSR_OFF 176 -#define LINUX_PT_R15_OFF 184 -#define LINUX_PT_R14_OFF 192 -#define LINUX_PT_R2_OFF 200 -#define LINUX_PT_R3_OFF 208 -#define LINUX_PT_R16_OFF 216 -#define LINUX_PT_R17_OFF 224 -#define LINUX_PT_R18_OFF 232 -#define LINUX_PT_R19_OFF 240 -#define LINUX_PT_R20_OFF 248 -#define LINUX_PT_R21_OFF 256 -#define LINUX_PT_R22_OFF 264 -#define LINUX_PT_R23_OFF 272 -#define LINUX_PT_R24_OFF 280 -#define LINUX_PT_R25_OFF 288 -#define LINUX_PT_R26_OFF 296 -#define LINUX_PT_R27_OFF 304 -#define LINUX_PT_R28_OFF 312 -#define LINUX_PT_R29_OFF 320 -#define LINUX_PT_R30_OFF 328 -#define LINUX_PT_R31_OFF 336 -#define LINUX_PT_CCV_OFF 344 -#define LINUX_PT_F6_OFF 352 -#define LINUX_PT_F7_OFF 368 -#define LINUX_PT_F8_OFF 384 -#define LINUX_PT_F9_OFF 400 -#define LINUX_PT_F10_OFF 416 -#define LINUX_PT_F11_OFF 432 +#define LINUX_PT_B6_OFF 0 +#define LINUX_PT_B7_OFF 8 +#define LINUX_PT_CSD_OFF 16 +#define LINUX_PT_SSD_OFF 24 +#define LINUX_PT_R8_OFF 32 +#define LINUX_PT_R9_OFF 40 +#define LINUX_PT_R10_OFF 48 +#define LINUX_PT_R11_OFF 56 +#define LINUX_PT_IPSR_OFF 64 +#define LINUX_PT_IIP_OFF 72 +#define LINUX_PT_IFS_OFF 80 +#define LINUX_PT_UNAT_OFF 88 +#define LINUX_PT_PFS_OFF 96 +#define LINUX_PT_RSC_OFF 104 +#define LINUX_PT_RNAT_OFF 112 +#define LINUX_PT_BSPSTORE_OFF 120 +#define LINUX_PT_PR_OFF 128 +#define LINUX_PT_B0_OFF 136 +#define LINUX_PT_LOADRS_OFF 144 +#define LINUX_PT_R1_OFF 152 +#define LINUX_PT_R12_OFF 160 +#define LINUX_PT_R13_OFF 168 +#define LINUX_PT_FPSR_OFF 176 +#define LINUX_PT_R15_OFF 184 +#define LINUX_PT_R14_OFF 192 +#define LINUX_PT_R2_OFF 200 +#define LINUX_PT_R3_OFF 208 +#define LINUX_PT_R16_OFF 216 +#define LINUX_PT_R17_OFF 224 +#define LINUX_PT_R18_OFF 232 +#define LINUX_PT_R19_OFF 240 +#define LINUX_PT_R20_OFF 248 +#define LINUX_PT_R21_OFF 256 +#define LINUX_PT_R22_OFF 264 +#define LINUX_PT_R23_OFF 272 +#define LINUX_PT_R24_OFF 280 +#define LINUX_PT_R25_OFF 288 +#define LINUX_PT_R26_OFF 296 +#define LINUX_PT_R27_OFF 304 +#define LINUX_PT_R28_OFF 312 +#define LINUX_PT_R29_OFF 320 +#define LINUX_PT_R30_OFF 328 +#define LINUX_PT_R31_OFF 336 +#define LINUX_PT_CCV_OFF 344 +#define LINUX_PT_F6_OFF 352 +#define LINUX_PT_F7_OFF 368 +#define LINUX_PT_F8_OFF 384 +#define LINUX_PT_F9_OFF 400 +#define LINUX_PT_F10_OFF 416 +#define LINUX_PT_F11_OFF 432 -#define LINUX_PT_P_NONSYS 5 /* must match pNonSys in entry.h */ +#define LINUX_PT_P_NONSYS 5 /* must match pNonSys in entry.h */ diff --git a/src/ia64/regname.c b/src/ia64/regname.c index 4936a3d2..8753e520 100644 --- a/src/ia64/regname.c +++ b/src/ia64/regname.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -42,142 +42,142 @@ purpose. */ /* Maintain the register names as a single string to keep the number of dynamic relocations in the shared object to a minimum. */ -#define regname_len 9 -#define regname_str \ - "r0\0\0\0\0\0\0\0r1\0\0\0\0\0\0\0r2\0\0\0\0\0\0\0r3\0\0\0\0\0\0\0" \ - "r4\0\0\0\0\0\0\0r5\0\0\0\0\0\0\0r6\0\0\0\0\0\0\0r7\0\0\0\0\0\0\0" \ - "r8\0\0\0\0\0\0\0r9\0\0\0\0\0\0\0r10\0\0\0\0\0\0r11\0\0\0\0\0\0" \ - "r12\0\0\0\0\0\0r13\0\0\0\0\0\0r14\0\0\0\0\0\0r15\0\0\0\0\0\0" \ - "r16\0\0\0\0\0\0r17\0\0\0\0\0\0r18\0\0\0\0\0\0r19\0\0\0\0\0\0" \ - "r20\0\0\0\0\0\0r21\0\0\0\0\0\0r22\0\0\0\0\0\0r23\0\0\0\0\0\0" \ - "r24\0\0\0\0\0\0r25\0\0\0\0\0\0r26\0\0\0\0\0\0r27\0\0\0\0\0\0" \ - "r28\0\0\0\0\0\0r29\0\0\0\0\0\0r30\0\0\0\0\0\0r31\0\0\0\0\0\0" \ - "r32\0\0\0\0\0\0r33\0\0\0\0\0\0r34\0\0\0\0\0\0r35\0\0\0\0\0\0" \ - "r36\0\0\0\0\0\0r37\0\0\0\0\0\0r38\0\0\0\0\0\0r39\0\0\0\0\0\0" \ - "r40\0\0\0\0\0\0r41\0\0\0\0\0\0r42\0\0\0\0\0\0r43\0\0\0\0\0\0" \ - "r44\0\0\0\0\0\0r45\0\0\0\0\0\0r46\0\0\0\0\0\0r47\0\0\0\0\0\0" \ - "r48\0\0\0\0\0\0r49\0\0\0\0\0\0r50\0\0\0\0\0\0r51\0\0\0\0\0\0" \ - "r52\0\0\0\0\0\0r53\0\0\0\0\0\0r54\0\0\0\0\0\0r55\0\0\0\0\0\0" \ - "r56\0\0\0\0\0\0r57\0\0\0\0\0\0r58\0\0\0\0\0\0r59\0\0\0\0\0\0" \ - "r60\0\0\0\0\0\0r61\0\0\0\0\0\0r62\0\0\0\0\0\0r63\0\0\0\0\0\0" \ - "r64\0\0\0\0\0\0r65\0\0\0\0\0\0r66\0\0\0\0\0\0r67\0\0\0\0\0\0" \ - "r68\0\0\0\0\0\0r69\0\0\0\0\0\0r70\0\0\0\0\0\0r71\0\0\0\0\0\0" \ - "r72\0\0\0\0\0\0r73\0\0\0\0\0\0r74\0\0\0\0\0\0r75\0\0\0\0\0\0" \ - "r76\0\0\0\0\0\0r77\0\0\0\0\0\0r78\0\0\0\0\0\0r79\0\0\0\0\0\0" \ - "r80\0\0\0\0\0\0r81\0\0\0\0\0\0r82\0\0\0\0\0\0r83\0\0\0\0\0\0" \ - "r84\0\0\0\0\0\0r85\0\0\0\0\0\0r86\0\0\0\0\0\0r87\0\0\0\0\0\0" \ - "r88\0\0\0\0\0\0r89\0\0\0\0\0\0r90\0\0\0\0\0\0r91\0\0\0\0\0\0" \ - "r92\0\0\0\0\0\0r93\0\0\0\0\0\0r94\0\0\0\0\0\0r95\0\0\0\0\0\0" \ - "r96\0\0\0\0\0\0r97\0\0\0\0\0\0r98\0\0\0\0\0\0r99\0\0\0\0\0\0" \ - "r100\0\0\0\0\0r101\0\0\0\0\0r102\0\0\0\0\0r103\0\0\0\0\0" \ - "r104\0\0\0\0\0r105\0\0\0\0\0r106\0\0\0\0\0r107\0\0\0\0\0" \ - "r108\0\0\0\0\0r109\0\0\0\0\0r110\0\0\0\0\0r111\0\0\0\0\0" \ - "r112\0\0\0\0\0r113\0\0\0\0\0r114\0\0\0\0\0r115\0\0\0\0\0" \ - "r116\0\0\0\0\0r117\0\0\0\0\0r118\0\0\0\0\0r119\0\0\0\0\0" \ - "r120\0\0\0\0\0r121\0\0\0\0\0r122\0\0\0\0\0r123\0\0\0\0\0" \ - "r124\0\0\0\0\0r125\0\0\0\0\0r126\0\0\0\0\0r127\0\0\0\0\0" \ - "nat0\0\0\0\0\0nat1\0\0\0\0\0nat2\0\0\0\0\0nat3\0\0\0\0\0" \ - "nat4\0\0\0\0\0nat5\0\0\0\0\0nat6\0\0\0\0\0nat7\0\0\0\0\0" \ - "nat8\0\0\0\0\0nat9\0\0\0\0\0nat10\0\0\0\0nat11\0\0\0\0" \ - "nat12\0\0\0\0nat13\0\0\0\0nat14\0\0\0\0nat15\0\0\0\0" \ - "nat16\0\0\0\0nat17\0\0\0\0nat18\0\0\0\0nat19\0\0\0\0" \ - "nat20\0\0\0\0nat21\0\0\0\0nat22\0\0\0\0nat23\0\0\0\0" \ - "nat24\0\0\0\0nat25\0\0\0\0nat26\0\0\0\0nat27\0\0\0\0" \ - "nat28\0\0\0\0nat29\0\0\0\0nat30\0\0\0\0nat31\0\0\0\0" \ - "nat32\0\0\0\0nat33\0\0\0\0nat34\0\0\0\0nat35\0\0\0\0" \ - "nat36\0\0\0\0nat37\0\0\0\0nat38\0\0\0\0nat39\0\0\0\0" \ - "nat40\0\0\0\0nat41\0\0\0\0nat42\0\0\0\0nat43\0\0\0\0" \ - "nat44\0\0\0\0nat45\0\0\0\0nat46\0\0\0\0nat47\0\0\0\0" \ - "nat48\0\0\0\0nat49\0\0\0\0nat50\0\0\0\0nat51\0\0\0\0" \ - "nat52\0\0\0\0nat53\0\0\0\0nat54\0\0\0\0nat55\0\0\0\0" \ - "nat56\0\0\0\0nat57\0\0\0\0nat58\0\0\0\0nat59\0\0\0\0" \ - "nat60\0\0\0\0nat61\0\0\0\0nat62\0\0\0\0nat63\0\0\0\0" \ - "nat64\0\0\0\0nat65\0\0\0\0nat66\0\0\0\0nat67\0\0\0\0" \ - "nat68\0\0\0\0nat69\0\0\0\0nat70\0\0\0\0nat71\0\0\0\0" \ - "nat72\0\0\0\0nat73\0\0\0\0nat74\0\0\0\0nat75\0\0\0\0" \ - "nat76\0\0\0\0nat77\0\0\0\0nat78\0\0\0\0nat79\0\0\0\0" \ - "nat80\0\0\0\0nat81\0\0\0\0nat82\0\0\0\0nat83\0\0\0\0" \ - "nat84\0\0\0\0nat85\0\0\0\0nat86\0\0\0\0nat87\0\0\0\0" \ - "nat88\0\0\0\0nat89\0\0\0\0nat90\0\0\0\0nat91\0\0\0\0" \ - "nat92\0\0\0\0nat93\0\0\0\0nat94\0\0\0\0nat95\0\0\0\0" \ - "nat96\0\0\0\0nat97\0\0\0\0nat98\0\0\0\0nat99\0\0\0\0" \ - "nat100\0\0\0nat101\0\0\0nat102\0\0\0nat103\0\0\0" \ - "nat104\0\0\0nat105\0\0\0nat106\0\0\0nat107\0\0\0" \ - "nat108\0\0\0nat109\0\0\0nat110\0\0\0nat111\0\0\0" \ - "nat112\0\0\0nat113\0\0\0nat114\0\0\0nat115\0\0\0" \ - "nat116\0\0\0nat117\0\0\0nat118\0\0\0nat119\0\0\0" \ - "nat120\0\0\0nat121\0\0\0nat122\0\0\0nat123\0\0\0" \ - "nat124\0\0\0nat125\0\0\0nat126\0\0\0nat127\0\0\0" \ - "f0\0\0\0\0\0\0\0f1\0\0\0\0\0\0\0f2\0\0\0\0\0\0\0f3\0\0\0\0\0\0\0" \ - "f4\0\0\0\0\0\0\0f5\0\0\0\0\0\0\0f6\0\0\0\0\0\0\0f7\0\0\0\0\0\0\0" \ - "f8\0\0\0\0\0\0\0f9\0\0\0\0\0\0\0f10\0\0\0\0\0\0f11\0\0\0\0\0\0" \ - "f12\0\0\0\0\0\0f13\0\0\0\0\0\0f14\0\0\0\0\0\0f15\0\0\0\0\0\0" \ - "f16\0\0\0\0\0\0f17\0\0\0\0\0\0f18\0\0\0\0\0\0f19\0\0\0\0\0\0" \ - "f20\0\0\0\0\0\0f21\0\0\0\0\0\0f22\0\0\0\0\0\0f23\0\0\0\0\0\0" \ - "f24\0\0\0\0\0\0f25\0\0\0\0\0\0f26\0\0\0\0\0\0f27\0\0\0\0\0\0" \ - "f28\0\0\0\0\0\0f29\0\0\0\0\0\0f30\0\0\0\0\0\0f31\0\0\0\0\0\0" \ - "f32\0\0\0\0\0\0f33\0\0\0\0\0\0f34\0\0\0\0\0\0f35\0\0\0\0\0\0" \ - "f36\0\0\0\0\0\0f37\0\0\0\0\0\0f38\0\0\0\0\0\0f39\0\0\0\0\0\0" \ - "f40\0\0\0\0\0\0f41\0\0\0\0\0\0f42\0\0\0\0\0\0f43\0\0\0\0\0\0" \ - "f44\0\0\0\0\0\0f45\0\0\0\0\0\0f46\0\0\0\0\0\0f47\0\0\0\0\0\0" \ - "f48\0\0\0\0\0\0f49\0\0\0\0\0\0f50\0\0\0\0\0\0f51\0\0\0\0\0\0" \ - "f52\0\0\0\0\0\0f53\0\0\0\0\0\0f54\0\0\0\0\0\0f55\0\0\0\0\0\0" \ - "f56\0\0\0\0\0\0f57\0\0\0\0\0\0f58\0\0\0\0\0\0f59\0\0\0\0\0\0" \ - "f60\0\0\0\0\0\0f61\0\0\0\0\0\0f62\0\0\0\0\0\0f63\0\0\0\0\0\0" \ - "f64\0\0\0\0\0\0f65\0\0\0\0\0\0f66\0\0\0\0\0\0f67\0\0\0\0\0\0" \ - "f68\0\0\0\0\0\0f69\0\0\0\0\0\0f70\0\0\0\0\0\0f71\0\0\0\0\0\0" \ - "f72\0\0\0\0\0\0f73\0\0\0\0\0\0f74\0\0\0\0\0\0f75\0\0\0\0\0\0" \ - "f76\0\0\0\0\0\0f77\0\0\0\0\0\0f78\0\0\0\0\0\0f79\0\0\0\0\0\0" \ - "f80\0\0\0\0\0\0f81\0\0\0\0\0\0f82\0\0\0\0\0\0f83\0\0\0\0\0\0" \ - "f84\0\0\0\0\0\0f85\0\0\0\0\0\0f86\0\0\0\0\0\0f87\0\0\0\0\0\0" \ - "f88\0\0\0\0\0\0f89\0\0\0\0\0\0f90\0\0\0\0\0\0f91\0\0\0\0\0\0" \ - "f92\0\0\0\0\0\0f93\0\0\0\0\0\0f94\0\0\0\0\0\0f95\0\0\0\0\0\0" \ - "f96\0\0\0\0\0\0f97\0\0\0\0\0\0f98\0\0\0\0\0\0f99\0\0\0\0\0\0" \ - "f100\0\0\0\0\0f101\0\0\0\0\0f102\0\0\0\0\0f103\0\0\0\0\0" \ - "f104\0\0\0\0\0f105\0\0\0\0\0f106\0\0\0\0\0f107\0\0\0\0\0" \ - "f108\0\0\0\0\0f109\0\0\0\0\0f110\0\0\0\0\0f111\0\0\0\0\0" \ - "f112\0\0\0\0\0f113\0\0\0\0\0f114\0\0\0\0\0f115\0\0\0\0\0" \ - "f116\0\0\0\0\0f117\0\0\0\0\0f118\0\0\0\0\0f119\0\0\0\0\0" \ - "f120\0\0\0\0\0f121\0\0\0\0\0f122\0\0\0\0\0f123\0\0\0\0\0" \ - "f124\0\0\0\0\0f125\0\0\0\0\0f126\0\0\0\0\0f127\0\0\0\0\0" \ - "ar0\0\0\0\0\0\0ar1\0\0\0\0\0\0ar2\0\0\0\0\0\0ar3\0\0\0\0\0\0" \ - "ar4\0\0\0\0\0\0ar5\0\0\0\0\0\0ar6\0\0\0\0\0\0ar7\0\0\0\0\0\0" \ - "ar8\0\0\0\0\0\0ar9\0\0\0\0\0\0ar10\0\0\0\0\0ar11\0\0\0\0\0" \ - "ar12\0\0\0\0\0ar13\0\0\0\0\0ar14\0\0\0\0\0ar15\0\0\0\0\0" \ - "rsc\0\0\0\0\0\0bsp\0\0\0\0\0\0bspstore\0rnat\0\0\0\0\0" \ - "ar20\0\0\0\0\0ar21\0\0\0\0\0ar22\0\0\0\0\0ar23\0\0\0\0\0" \ - "ar24\0\0\0\0\0ar25\0\0\0\0\0ar26\0\0\0\0\0ar27\0\0\0\0\0" \ - "ar28\0\0\0\0\0ar29\0\0\0\0\0ar30\0\0\0\0\0ar31\0\0\0\0\0" \ - "ccv\0\0\0\0\0\0ar33\0\0\0\0\0ar34\0\0\0\0\0ar35\0\0\0\0\0" \ - "unat\0\0\0\0\0ar37\0\0\0\0\0ar38\0\0\0\0\0ar39\0\0\0\0\0" \ - "fpsr\0\0\0\0\0ar41\0\0\0\0\0ar42\0\0\0\0\0ar43\0\0\0\0\0" \ - "ar44\0\0\0\0\0ar45\0\0\0\0\0ar46\0\0\0\0\0ar47\0\0\0\0\0" \ - "ar48\0\0\0\0\0ar49\0\0\0\0\0ar50\0\0\0\0\0ar51\0\0\0\0\0" \ - "ar52\0\0\0\0\0ar53\0\0\0\0\0ar54\0\0\0\0\0ar55\0\0\0\0\0" \ - "ar56\0\0\0\0\0ar57\0\0\0\0\0ar58\0\0\0\0\0ar59\0\0\0\0\0" \ - "ar60\0\0\0\0\0ar61\0\0\0\0\0ar62\0\0\0\0\0ar63\0\0\0\0\0" \ - "pfs\0\0\0\0\0\0lc\0\0\0\0\0\0\0ec\0\0\0\0\0\0\0ar67\0\0\0\0\0" \ - "ar68\0\0\0\0\0ar69\0\0\0\0\0ar70\0\0\0\0\0ar71\0\0\0\0\0" \ - "ar72\0\0\0\0\0ar73\0\0\0\0\0ar74\0\0\0\0\0ar75\0\0\0\0\0" \ - "ar76\0\0\0\0\0ar77\0\0\0\0\0ar78\0\0\0\0\0ar79\0\0\0\0\0" \ - "ar80\0\0\0\0\0ar81\0\0\0\0\0ar82\0\0\0\0\0ar83\0\0\0\0\0" \ - "ar84\0\0\0\0\0ar85\0\0\0\0\0ar86\0\0\0\0\0ar87\0\0\0\0\0" \ - "ar88\0\0\0\0\0ar89\0\0\0\0\0ar90\0\0\0\0\0ar91\0\0\0\0\0" \ - "ar92\0\0\0\0\0ar93\0\0\0\0\0ar94\0\0\0\0\0ar95\0\0\0\0\0" \ - "ar96\0\0\0\0\0ar97\0\0\0\0\0ar98\0\0\0\0\0ar99\0\0\0\0\0" \ - "ar100\0\0\0\0ar101\0\0\0\0ar102\0\0\0\0ar103\0\0\0\0" \ - "ar104\0\0\0\0ar105\0\0\0\0ar106\0\0\0\0ar107\0\0\0\0" \ - "ar108\0\0\0\0ar109\0\0\0\0ar110\0\0\0\0ar111\0\0\0\0" \ - "ar112\0\0\0\0ar113\0\0\0\0ar114\0\0\0\0ar115\0\0\0\0" \ - "ar116\0\0\0\0ar117\0\0\0\0ar118\0\0\0\0ar119\0\0\0\0" \ - "ar120\0\0\0\0ar121\0\0\0\0ar122\0\0\0\0ar123\0\0\0\0" \ - "ar124\0\0\0\0ar125\0\0\0\0ar126\0\0\0\0ar127\0\0\0\0" \ - "rp\0\0\0\0\0\0\0b1\0\0\0\0\0\0\0b2\0\0\0\0\0\0\0b3\0\0\0\0\0\0\0" \ - "b4\0\0\0\0\0\0\0b5\0\0\0\0\0\0\0b6\0\0\0\0\0\0\0b7\0\0\0\0\0\0\0" \ - "pr\0\0\0\0\0\0\0cfm\0\0\0\0\0\0bsp\0\0\0\0\0\0ip\0\0\0\0\0\0\0" \ +#define regname_len 9 +#define regname_str \ + "r0\0\0\0\0\0\0\0r1\0\0\0\0\0\0\0r2\0\0\0\0\0\0\0r3\0\0\0\0\0\0\0" \ + "r4\0\0\0\0\0\0\0r5\0\0\0\0\0\0\0r6\0\0\0\0\0\0\0r7\0\0\0\0\0\0\0" \ + "r8\0\0\0\0\0\0\0r9\0\0\0\0\0\0\0r10\0\0\0\0\0\0r11\0\0\0\0\0\0" \ + "r12\0\0\0\0\0\0r13\0\0\0\0\0\0r14\0\0\0\0\0\0r15\0\0\0\0\0\0" \ + "r16\0\0\0\0\0\0r17\0\0\0\0\0\0r18\0\0\0\0\0\0r19\0\0\0\0\0\0" \ + "r20\0\0\0\0\0\0r21\0\0\0\0\0\0r22\0\0\0\0\0\0r23\0\0\0\0\0\0" \ + "r24\0\0\0\0\0\0r25\0\0\0\0\0\0r26\0\0\0\0\0\0r27\0\0\0\0\0\0" \ + "r28\0\0\0\0\0\0r29\0\0\0\0\0\0r30\0\0\0\0\0\0r31\0\0\0\0\0\0" \ + "r32\0\0\0\0\0\0r33\0\0\0\0\0\0r34\0\0\0\0\0\0r35\0\0\0\0\0\0" \ + "r36\0\0\0\0\0\0r37\0\0\0\0\0\0r38\0\0\0\0\0\0r39\0\0\0\0\0\0" \ + "r40\0\0\0\0\0\0r41\0\0\0\0\0\0r42\0\0\0\0\0\0r43\0\0\0\0\0\0" \ + "r44\0\0\0\0\0\0r45\0\0\0\0\0\0r46\0\0\0\0\0\0r47\0\0\0\0\0\0" \ + "r48\0\0\0\0\0\0r49\0\0\0\0\0\0r50\0\0\0\0\0\0r51\0\0\0\0\0\0" \ + "r52\0\0\0\0\0\0r53\0\0\0\0\0\0r54\0\0\0\0\0\0r55\0\0\0\0\0\0" \ + "r56\0\0\0\0\0\0r57\0\0\0\0\0\0r58\0\0\0\0\0\0r59\0\0\0\0\0\0" \ + "r60\0\0\0\0\0\0r61\0\0\0\0\0\0r62\0\0\0\0\0\0r63\0\0\0\0\0\0" \ + "r64\0\0\0\0\0\0r65\0\0\0\0\0\0r66\0\0\0\0\0\0r67\0\0\0\0\0\0" \ + "r68\0\0\0\0\0\0r69\0\0\0\0\0\0r70\0\0\0\0\0\0r71\0\0\0\0\0\0" \ + "r72\0\0\0\0\0\0r73\0\0\0\0\0\0r74\0\0\0\0\0\0r75\0\0\0\0\0\0" \ + "r76\0\0\0\0\0\0r77\0\0\0\0\0\0r78\0\0\0\0\0\0r79\0\0\0\0\0\0" \ + "r80\0\0\0\0\0\0r81\0\0\0\0\0\0r82\0\0\0\0\0\0r83\0\0\0\0\0\0" \ + "r84\0\0\0\0\0\0r85\0\0\0\0\0\0r86\0\0\0\0\0\0r87\0\0\0\0\0\0" \ + "r88\0\0\0\0\0\0r89\0\0\0\0\0\0r90\0\0\0\0\0\0r91\0\0\0\0\0\0" \ + "r92\0\0\0\0\0\0r93\0\0\0\0\0\0r94\0\0\0\0\0\0r95\0\0\0\0\0\0" \ + "r96\0\0\0\0\0\0r97\0\0\0\0\0\0r98\0\0\0\0\0\0r99\0\0\0\0\0\0" \ + "r100\0\0\0\0\0r101\0\0\0\0\0r102\0\0\0\0\0r103\0\0\0\0\0" \ + "r104\0\0\0\0\0r105\0\0\0\0\0r106\0\0\0\0\0r107\0\0\0\0\0" \ + "r108\0\0\0\0\0r109\0\0\0\0\0r110\0\0\0\0\0r111\0\0\0\0\0" \ + "r112\0\0\0\0\0r113\0\0\0\0\0r114\0\0\0\0\0r115\0\0\0\0\0" \ + "r116\0\0\0\0\0r117\0\0\0\0\0r118\0\0\0\0\0r119\0\0\0\0\0" \ + "r120\0\0\0\0\0r121\0\0\0\0\0r122\0\0\0\0\0r123\0\0\0\0\0" \ + "r124\0\0\0\0\0r125\0\0\0\0\0r126\0\0\0\0\0r127\0\0\0\0\0" \ + "nat0\0\0\0\0\0nat1\0\0\0\0\0nat2\0\0\0\0\0nat3\0\0\0\0\0" \ + "nat4\0\0\0\0\0nat5\0\0\0\0\0nat6\0\0\0\0\0nat7\0\0\0\0\0" \ + "nat8\0\0\0\0\0nat9\0\0\0\0\0nat10\0\0\0\0nat11\0\0\0\0" \ + "nat12\0\0\0\0nat13\0\0\0\0nat14\0\0\0\0nat15\0\0\0\0" \ + "nat16\0\0\0\0nat17\0\0\0\0nat18\0\0\0\0nat19\0\0\0\0" \ + "nat20\0\0\0\0nat21\0\0\0\0nat22\0\0\0\0nat23\0\0\0\0" \ + "nat24\0\0\0\0nat25\0\0\0\0nat26\0\0\0\0nat27\0\0\0\0" \ + "nat28\0\0\0\0nat29\0\0\0\0nat30\0\0\0\0nat31\0\0\0\0" \ + "nat32\0\0\0\0nat33\0\0\0\0nat34\0\0\0\0nat35\0\0\0\0" \ + "nat36\0\0\0\0nat37\0\0\0\0nat38\0\0\0\0nat39\0\0\0\0" \ + "nat40\0\0\0\0nat41\0\0\0\0nat42\0\0\0\0nat43\0\0\0\0" \ + "nat44\0\0\0\0nat45\0\0\0\0nat46\0\0\0\0nat47\0\0\0\0" \ + "nat48\0\0\0\0nat49\0\0\0\0nat50\0\0\0\0nat51\0\0\0\0" \ + "nat52\0\0\0\0nat53\0\0\0\0nat54\0\0\0\0nat55\0\0\0\0" \ + "nat56\0\0\0\0nat57\0\0\0\0nat58\0\0\0\0nat59\0\0\0\0" \ + "nat60\0\0\0\0nat61\0\0\0\0nat62\0\0\0\0nat63\0\0\0\0" \ + "nat64\0\0\0\0nat65\0\0\0\0nat66\0\0\0\0nat67\0\0\0\0" \ + "nat68\0\0\0\0nat69\0\0\0\0nat70\0\0\0\0nat71\0\0\0\0" \ + "nat72\0\0\0\0nat73\0\0\0\0nat74\0\0\0\0nat75\0\0\0\0" \ + "nat76\0\0\0\0nat77\0\0\0\0nat78\0\0\0\0nat79\0\0\0\0" \ + "nat80\0\0\0\0nat81\0\0\0\0nat82\0\0\0\0nat83\0\0\0\0" \ + "nat84\0\0\0\0nat85\0\0\0\0nat86\0\0\0\0nat87\0\0\0\0" \ + "nat88\0\0\0\0nat89\0\0\0\0nat90\0\0\0\0nat91\0\0\0\0" \ + "nat92\0\0\0\0nat93\0\0\0\0nat94\0\0\0\0nat95\0\0\0\0" \ + "nat96\0\0\0\0nat97\0\0\0\0nat98\0\0\0\0nat99\0\0\0\0" \ + "nat100\0\0\0nat101\0\0\0nat102\0\0\0nat103\0\0\0" \ + "nat104\0\0\0nat105\0\0\0nat106\0\0\0nat107\0\0\0" \ + "nat108\0\0\0nat109\0\0\0nat110\0\0\0nat111\0\0\0" \ + "nat112\0\0\0nat113\0\0\0nat114\0\0\0nat115\0\0\0" \ + "nat116\0\0\0nat117\0\0\0nat118\0\0\0nat119\0\0\0" \ + "nat120\0\0\0nat121\0\0\0nat122\0\0\0nat123\0\0\0" \ + "nat124\0\0\0nat125\0\0\0nat126\0\0\0nat127\0\0\0" \ + "f0\0\0\0\0\0\0\0f1\0\0\0\0\0\0\0f2\0\0\0\0\0\0\0f3\0\0\0\0\0\0\0" \ + "f4\0\0\0\0\0\0\0f5\0\0\0\0\0\0\0f6\0\0\0\0\0\0\0f7\0\0\0\0\0\0\0" \ + "f8\0\0\0\0\0\0\0f9\0\0\0\0\0\0\0f10\0\0\0\0\0\0f11\0\0\0\0\0\0" \ + "f12\0\0\0\0\0\0f13\0\0\0\0\0\0f14\0\0\0\0\0\0f15\0\0\0\0\0\0" \ + "f16\0\0\0\0\0\0f17\0\0\0\0\0\0f18\0\0\0\0\0\0f19\0\0\0\0\0\0" \ + "f20\0\0\0\0\0\0f21\0\0\0\0\0\0f22\0\0\0\0\0\0f23\0\0\0\0\0\0" \ + "f24\0\0\0\0\0\0f25\0\0\0\0\0\0f26\0\0\0\0\0\0f27\0\0\0\0\0\0" \ + "f28\0\0\0\0\0\0f29\0\0\0\0\0\0f30\0\0\0\0\0\0f31\0\0\0\0\0\0" \ + "f32\0\0\0\0\0\0f33\0\0\0\0\0\0f34\0\0\0\0\0\0f35\0\0\0\0\0\0" \ + "f36\0\0\0\0\0\0f37\0\0\0\0\0\0f38\0\0\0\0\0\0f39\0\0\0\0\0\0" \ + "f40\0\0\0\0\0\0f41\0\0\0\0\0\0f42\0\0\0\0\0\0f43\0\0\0\0\0\0" \ + "f44\0\0\0\0\0\0f45\0\0\0\0\0\0f46\0\0\0\0\0\0f47\0\0\0\0\0\0" \ + "f48\0\0\0\0\0\0f49\0\0\0\0\0\0f50\0\0\0\0\0\0f51\0\0\0\0\0\0" \ + "f52\0\0\0\0\0\0f53\0\0\0\0\0\0f54\0\0\0\0\0\0f55\0\0\0\0\0\0" \ + "f56\0\0\0\0\0\0f57\0\0\0\0\0\0f58\0\0\0\0\0\0f59\0\0\0\0\0\0" \ + "f60\0\0\0\0\0\0f61\0\0\0\0\0\0f62\0\0\0\0\0\0f63\0\0\0\0\0\0" \ + "f64\0\0\0\0\0\0f65\0\0\0\0\0\0f66\0\0\0\0\0\0f67\0\0\0\0\0\0" \ + "f68\0\0\0\0\0\0f69\0\0\0\0\0\0f70\0\0\0\0\0\0f71\0\0\0\0\0\0" \ + "f72\0\0\0\0\0\0f73\0\0\0\0\0\0f74\0\0\0\0\0\0f75\0\0\0\0\0\0" \ + "f76\0\0\0\0\0\0f77\0\0\0\0\0\0f78\0\0\0\0\0\0f79\0\0\0\0\0\0" \ + "f80\0\0\0\0\0\0f81\0\0\0\0\0\0f82\0\0\0\0\0\0f83\0\0\0\0\0\0" \ + "f84\0\0\0\0\0\0f85\0\0\0\0\0\0f86\0\0\0\0\0\0f87\0\0\0\0\0\0" \ + "f88\0\0\0\0\0\0f89\0\0\0\0\0\0f90\0\0\0\0\0\0f91\0\0\0\0\0\0" \ + "f92\0\0\0\0\0\0f93\0\0\0\0\0\0f94\0\0\0\0\0\0f95\0\0\0\0\0\0" \ + "f96\0\0\0\0\0\0f97\0\0\0\0\0\0f98\0\0\0\0\0\0f99\0\0\0\0\0\0" \ + "f100\0\0\0\0\0f101\0\0\0\0\0f102\0\0\0\0\0f103\0\0\0\0\0" \ + "f104\0\0\0\0\0f105\0\0\0\0\0f106\0\0\0\0\0f107\0\0\0\0\0" \ + "f108\0\0\0\0\0f109\0\0\0\0\0f110\0\0\0\0\0f111\0\0\0\0\0" \ + "f112\0\0\0\0\0f113\0\0\0\0\0f114\0\0\0\0\0f115\0\0\0\0\0" \ + "f116\0\0\0\0\0f117\0\0\0\0\0f118\0\0\0\0\0f119\0\0\0\0\0" \ + "f120\0\0\0\0\0f121\0\0\0\0\0f122\0\0\0\0\0f123\0\0\0\0\0" \ + "f124\0\0\0\0\0f125\0\0\0\0\0f126\0\0\0\0\0f127\0\0\0\0\0" \ + "ar0\0\0\0\0\0\0ar1\0\0\0\0\0\0ar2\0\0\0\0\0\0ar3\0\0\0\0\0\0" \ + "ar4\0\0\0\0\0\0ar5\0\0\0\0\0\0ar6\0\0\0\0\0\0ar7\0\0\0\0\0\0" \ + "ar8\0\0\0\0\0\0ar9\0\0\0\0\0\0ar10\0\0\0\0\0ar11\0\0\0\0\0" \ + "ar12\0\0\0\0\0ar13\0\0\0\0\0ar14\0\0\0\0\0ar15\0\0\0\0\0" \ + "rsc\0\0\0\0\0\0bsp\0\0\0\0\0\0bspstore\0rnat\0\0\0\0\0" \ + "ar20\0\0\0\0\0ar21\0\0\0\0\0ar22\0\0\0\0\0ar23\0\0\0\0\0" \ + "ar24\0\0\0\0\0ar25\0\0\0\0\0ar26\0\0\0\0\0ar27\0\0\0\0\0" \ + "ar28\0\0\0\0\0ar29\0\0\0\0\0ar30\0\0\0\0\0ar31\0\0\0\0\0" \ + "ccv\0\0\0\0\0\0ar33\0\0\0\0\0ar34\0\0\0\0\0ar35\0\0\0\0\0" \ + "unat\0\0\0\0\0ar37\0\0\0\0\0ar38\0\0\0\0\0ar39\0\0\0\0\0" \ + "fpsr\0\0\0\0\0ar41\0\0\0\0\0ar42\0\0\0\0\0ar43\0\0\0\0\0" \ + "ar44\0\0\0\0\0ar45\0\0\0\0\0ar46\0\0\0\0\0ar47\0\0\0\0\0" \ + "ar48\0\0\0\0\0ar49\0\0\0\0\0ar50\0\0\0\0\0ar51\0\0\0\0\0" \ + "ar52\0\0\0\0\0ar53\0\0\0\0\0ar54\0\0\0\0\0ar55\0\0\0\0\0" \ + "ar56\0\0\0\0\0ar57\0\0\0\0\0ar58\0\0\0\0\0ar59\0\0\0\0\0" \ + "ar60\0\0\0\0\0ar61\0\0\0\0\0ar62\0\0\0\0\0ar63\0\0\0\0\0" \ + "pfs\0\0\0\0\0\0lc\0\0\0\0\0\0\0ec\0\0\0\0\0\0\0ar67\0\0\0\0\0" \ + "ar68\0\0\0\0\0ar69\0\0\0\0\0ar70\0\0\0\0\0ar71\0\0\0\0\0" \ + "ar72\0\0\0\0\0ar73\0\0\0\0\0ar74\0\0\0\0\0ar75\0\0\0\0\0" \ + "ar76\0\0\0\0\0ar77\0\0\0\0\0ar78\0\0\0\0\0ar79\0\0\0\0\0" \ + "ar80\0\0\0\0\0ar81\0\0\0\0\0ar82\0\0\0\0\0ar83\0\0\0\0\0" \ + "ar84\0\0\0\0\0ar85\0\0\0\0\0ar86\0\0\0\0\0ar87\0\0\0\0\0" \ + "ar88\0\0\0\0\0ar89\0\0\0\0\0ar90\0\0\0\0\0ar91\0\0\0\0\0" \ + "ar92\0\0\0\0\0ar93\0\0\0\0\0ar94\0\0\0\0\0ar95\0\0\0\0\0" \ + "ar96\0\0\0\0\0ar97\0\0\0\0\0ar98\0\0\0\0\0ar99\0\0\0\0\0" \ + "ar100\0\0\0\0ar101\0\0\0\0ar102\0\0\0\0ar103\0\0\0\0" \ + "ar104\0\0\0\0ar105\0\0\0\0ar106\0\0\0\0ar107\0\0\0\0" \ + "ar108\0\0\0\0ar109\0\0\0\0ar110\0\0\0\0ar111\0\0\0\0" \ + "ar112\0\0\0\0ar113\0\0\0\0ar114\0\0\0\0ar115\0\0\0\0" \ + "ar116\0\0\0\0ar117\0\0\0\0ar118\0\0\0\0ar119\0\0\0\0" \ + "ar120\0\0\0\0ar121\0\0\0\0ar122\0\0\0\0ar123\0\0\0\0" \ + "ar124\0\0\0\0ar125\0\0\0\0ar126\0\0\0\0ar127\0\0\0\0" \ + "rp\0\0\0\0\0\0\0b1\0\0\0\0\0\0\0b2\0\0\0\0\0\0\0b3\0\0\0\0\0\0\0" \ + "b4\0\0\0\0\0\0\0b5\0\0\0\0\0\0\0b6\0\0\0\0\0\0\0b7\0\0\0\0\0\0\0" \ + "pr\0\0\0\0\0\0\0cfm\0\0\0\0\0\0bsp\0\0\0\0\0\0ip\0\0\0\0\0\0\0" \ "sp\0\0\0\0\0\0\0" -#define NREGS ((int) (sizeof (regname_str) - 1) / regname_len) +#define NREGS ((int) (sizeof (regname_str) - 1) / regname_len) PROTECTED const char * unw_regname (unw_regnum_t reg) diff --git a/src/ia64/regs.h b/src/ia64/regs.h index 1e748bbe..a22a8187 100644 --- a/src/ia64/regs.h +++ b/src/ia64/regs.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -40,9 +40,9 @@ rotate_gr (struct cursor *c, int reg) preg = reg; else { - preg = reg + rrb_gr; /* apply rotation */ + preg = reg + rrb_gr; /* apply rotation */ if ((unsigned) (preg - 32) >= sor) - preg -= sor; /* wrap around */ + preg -= sor; /* wrap around */ } if (sor) Debug (15, "sor=%u rrb.gr=%u, r%d -> r%d\n", sor, rrb_gr, reg, preg); @@ -60,12 +60,12 @@ rotate_fr (struct cursor *c, int reg) rrb_fr = (c->cfm >> 25) & 0x7f; if (reg < 32) - preg = reg; /* register not part of the rotating partition */ + preg = reg; /* register not part of the rotating partition */ else { - preg = reg + rrb_fr; /* apply rotation */ + preg = reg + rrb_fr; /* apply rotation */ if (preg > 127) - preg -= 96; /* wrap around */ + preg -= 96; /* wrap around */ } if (rrb_fr) Debug (15, "rrb.fr=%u, f%d -> f%d\n", rrb_fr, reg, preg); diff --git a/src/ia64/ucontext_i.h b/src/ia64/ucontext_i.h index 34171fdf..ea32c8aa 100644 --- a/src/ia64/ucontext_i.h +++ b/src/ia64/ucontext_i.h @@ -25,44 +25,44 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Constants shared between setcontext() and getcontext(). Don't install this header file. */ -#define SIG_BLOCK 0 -#define SIG_UNBLOCK 1 -#define SIG_SETMASK 2 +#define SIG_BLOCK 0 +#define SIG_UNBLOCK 1 +#define SIG_SETMASK 2 -#define IA64_SC_FLAG_SYNCHRONOUS_BIT 63 +#define IA64_SC_FLAG_SYNCHRONOUS_BIT 63 #define SC_FLAGS 0x000 -#define SC_NAT 0x008 -#define SC_BSP 0x048 -#define SC_RNAT 0x050 -#define SC_UNAT 0x060 -#define SC_FPSR 0x068 -#define SC_PFS 0x070 -#define SC_LC 0x078 -#define SC_PR 0x080 -#define SC_BR 0x088 -#define SC_GR 0x0c8 -#define SC_FR 0x1d0 -#define SC_MASK 0x9d0 +#define SC_NAT 0x008 +#define SC_BSP 0x048 +#define SC_RNAT 0x050 +#define SC_UNAT 0x060 +#define SC_FPSR 0x068 +#define SC_PFS 0x070 +#define SC_LC 0x078 +#define SC_PR 0x080 +#define SC_BR 0x088 +#define SC_GR 0x0c8 +#define SC_FR 0x1d0 +#define SC_MASK 0x9d0 -#define rTMP r10 -#define rPOS r11 -#define rCPOS r14 -#define rNAT r15 -#define rFLAGS r16 +#define rTMP r10 +#define rPOS r11 +#define rCPOS r14 +#define rNAT r15 +#define rFLAGS r16 -#define rB5 r18 -#define rB4 r19 -#define rB3 r20 -#define rB2 r21 -#define rB1 r22 -#define rB0 r23 -#define rRSC r24 -#define rBSP r25 -#define rRNAT r26 -#define rUNAT r27 -#define rFPSR r28 -#define rPFS r29 -#define rLC r30 -#define rPR r31 +#define rB5 r18 +#define rB4 r19 +#define rB3 r20 +#define rB2 r21 +#define rB1 r22 +#define rB0 r23 +#define rRSC r24 +#define rBSP r25 +#define rRNAT r26 +#define rUNAT r27 +#define rFPSR r28 +#define rPFS r29 +#define rLC r30 +#define rPR r31 diff --git a/src/ia64/unwind_decoder.h b/src/ia64/unwind_decoder.h index f12c21d1..7fd41740 100644 --- a/src/ia64/unwind_decoder.h +++ b/src/ia64/unwind_decoder.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -33,55 +33,55 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ * macros/constants before including this file: * * Types: - * unw_word Unsigned integer type with at least 64 bits + * unw_word Unsigned integer type with at least 64 bits * * Register names: - * UNW_REG_BSP - * UNW_REG_BSPSTORE - * UNW_REG_FPSR - * UNW_REG_LC - * UNW_REG_PFS - * UNW_REG_PR - * UNW_REG_RNAT - * UNW_REG_PSP - * UNW_REG_RP - * UNW_REG_UNAT + * UNW_REG_BSP + * UNW_REG_BSPSTORE + * UNW_REG_FPSR + * UNW_REG_LC + * UNW_REG_PFS + * UNW_REG_PR + * UNW_REG_RNAT + * UNW_REG_PSP + * UNW_REG_RP + * UNW_REG_UNAT * * Decoder action macros: - * UNW_DEC_BAD_CODE(code) - * UNW_DEC_ABI(fmt,abi,context,arg) - * UNW_DEC_BR_GR(fmt,brmask,gr,arg) - * UNW_DEC_BR_MEM(fmt,brmask,arg) - * UNW_DEC_COPY_STATE(fmt,label,arg) - * UNW_DEC_EPILOGUE(fmt,t,ecount,arg) - * UNW_DEC_FRGR_MEM(fmt,grmask,frmask,arg) - * UNW_DEC_FR_MEM(fmt,frmask,arg) - * UNW_DEC_GR_GR(fmt,grmask,gr,arg) - * UNW_DEC_GR_MEM(fmt,grmask,arg) - * UNW_DEC_LABEL_STATE(fmt,label,arg) - * UNW_DEC_MEM_STACK_F(fmt,t,size,arg) - * UNW_DEC_MEM_STACK_V(fmt,t,arg) - * UNW_DEC_PRIUNAT_GR(fmt,r,arg) - * UNW_DEC_PRIUNAT_WHEN_GR(fmt,t,arg) - * UNW_DEC_PRIUNAT_WHEN_MEM(fmt,t,arg) - * UNW_DEC_PRIUNAT_WHEN_PSPREL(fmt,pspoff,arg) - * UNW_DEC_PRIUNAT_WHEN_SPREL(fmt,spoff,arg) - * UNW_DEC_PROLOGUE(fmt,body,rlen,arg) - * UNW_DEC_PROLOGUE_GR(fmt,rlen,mask,grsave,arg) - * UNW_DEC_REG_PSPREL(fmt,reg,pspoff,arg) - * UNW_DEC_REG_REG(fmt,src,dst,arg) - * UNW_DEC_REG_SPREL(fmt,reg,spoff,arg) - * UNW_DEC_REG_WHEN(fmt,reg,t,arg) - * UNW_DEC_RESTORE(fmt,t,abreg,arg) - * UNW_DEC_RESTORE_P(fmt,qp,t,abreg,arg) - * UNW_DEC_SPILL_BASE(fmt,pspoff,arg) - * UNW_DEC_SPILL_MASK(fmt,imaskp,arg) - * UNW_DEC_SPILL_PSPREL(fmt,t,abreg,pspoff,arg) - * UNW_DEC_SPILL_PSPREL_P(fmt,qp,t,abreg,pspoff,arg) - * UNW_DEC_SPILL_REG(fmt,t,abreg,x,ytreg,arg) - * UNW_DEC_SPILL_REG_P(fmt,qp,t,abreg,x,ytreg,arg) - * UNW_DEC_SPILL_SPREL(fmt,t,abreg,spoff,arg) - * UNW_DEC_SPILL_SPREL_P(fmt,qp,t,abreg,pspoff,arg) + * UNW_DEC_BAD_CODE(code) + * UNW_DEC_ABI(fmt,abi,context,arg) + * UNW_DEC_BR_GR(fmt,brmask,gr,arg) + * UNW_DEC_BR_MEM(fmt,brmask,arg) + * UNW_DEC_COPY_STATE(fmt,label,arg) + * UNW_DEC_EPILOGUE(fmt,t,ecount,arg) + * UNW_DEC_FRGR_MEM(fmt,grmask,frmask,arg) + * UNW_DEC_FR_MEM(fmt,frmask,arg) + * UNW_DEC_GR_GR(fmt,grmask,gr,arg) + * UNW_DEC_GR_MEM(fmt,grmask,arg) + * UNW_DEC_LABEL_STATE(fmt,label,arg) + * UNW_DEC_MEM_STACK_F(fmt,t,size,arg) + * UNW_DEC_MEM_STACK_V(fmt,t,arg) + * UNW_DEC_PRIUNAT_GR(fmt,r,arg) + * UNW_DEC_PRIUNAT_WHEN_GR(fmt,t,arg) + * UNW_DEC_PRIUNAT_WHEN_MEM(fmt,t,arg) + * UNW_DEC_PRIUNAT_WHEN_PSPREL(fmt,pspoff,arg) + * UNW_DEC_PRIUNAT_WHEN_SPREL(fmt,spoff,arg) + * UNW_DEC_PROLOGUE(fmt,body,rlen,arg) + * UNW_DEC_PROLOGUE_GR(fmt,rlen,mask,grsave,arg) + * UNW_DEC_REG_PSPREL(fmt,reg,pspoff,arg) + * UNW_DEC_REG_REG(fmt,src,dst,arg) + * UNW_DEC_REG_SPREL(fmt,reg,spoff,arg) + * UNW_DEC_REG_WHEN(fmt,reg,t,arg) + * UNW_DEC_RESTORE(fmt,t,abreg,arg) + * UNW_DEC_RESTORE_P(fmt,qp,t,abreg,arg) + * UNW_DEC_SPILL_BASE(fmt,pspoff,arg) + * UNW_DEC_SPILL_MASK(fmt,imaskp,arg) + * UNW_DEC_SPILL_PSPREL(fmt,t,abreg,pspoff,arg) + * UNW_DEC_SPILL_PSPREL_P(fmt,qp,t,abreg,pspoff,arg) + * UNW_DEC_SPILL_REG(fmt,t,abreg,x,ytreg,arg) + * UNW_DEC_SPILL_REG_P(fmt,qp,t,abreg,x,ytreg,arg) + * UNW_DEC_SPILL_SPREL(fmt,t,abreg,spoff,arg) + * UNW_DEC_SPILL_SPREL_P(fmt,qp,t,abreg,pspoff,arg) */ static unw_word @@ -96,7 +96,7 @@ unw_decode_uleb128 (unsigned char **dpp) byte = *bp++; result |= (byte & 0x7f) << shift; if ((byte & 0x80) == 0) - break; + break; shift += 7; } *dpp = bp; @@ -114,9 +114,9 @@ unw_decode_x1 (unsigned char *dp, unsigned char code, void *arg) off = unw_decode_uleb128 (&dp); abreg = (byte1 & 0x7f); if (byte1 & 0x80) - UNW_DEC_SPILL_SPREL(X1, t, abreg, off, arg); + UNW_DEC_SPILL_SPREL(X1, t, abreg, off, arg); else - UNW_DEC_SPILL_PSPREL(X1, t, abreg, off, arg); + UNW_DEC_SPILL_PSPREL(X1, t, abreg, off, arg); return dp; } @@ -232,7 +232,7 @@ unw_decode_p2_p5 (unsigned char *dp, unsigned char code, void *arg) unsigned char byte1 = *dp++; UNW_DEC_BR_GR(P2, ((code & 0xf) << 1) | ((byte1 >> 7) & 1), - (byte1 & 0x7f), arg); + (byte1 & 0x7f), arg); } else if ((code & 0x08) == 0) { @@ -241,21 +241,21 @@ unw_decode_p2_p5 (unsigned char *dp, unsigned char code, void *arg) r = ((code & 0x7) << 1) | ((byte1 >> 7) & 1); dst = (byte1 & 0x7f); switch (r) - { - case 0: UNW_DEC_REG_GR(P3, UNW_REG_PSP, dst, arg); break; - case 1: UNW_DEC_REG_GR(P3, UNW_REG_RP, dst, arg); break; - case 2: UNW_DEC_REG_GR(P3, UNW_REG_PFS, dst, arg); break; - case 3: UNW_DEC_REG_GR(P3, UNW_REG_PR, dst, arg); break; - case 4: UNW_DEC_REG_GR(P3, UNW_REG_UNAT, dst, arg); break; - case 5: UNW_DEC_REG_GR(P3, UNW_REG_LC, dst, arg); break; - case 6: UNW_DEC_RP_BR(P3, dst, arg); break; - case 7: UNW_DEC_REG_GR(P3, UNW_REG_RNAT, dst, arg); break; - case 8: UNW_DEC_REG_GR(P3, UNW_REG_BSP, dst, arg); break; - case 9: UNW_DEC_REG_GR(P3, UNW_REG_BSPSTORE, dst, arg); break; - case 10: UNW_DEC_REG_GR(P3, UNW_REG_FPSR, dst, arg); break; - case 11: UNW_DEC_PRIUNAT_GR(P3, dst, arg); break; - default: UNW_DEC_BAD_CODE(r); break; - } + { + case 0: UNW_DEC_REG_GR(P3, UNW_REG_PSP, dst, arg); break; + case 1: UNW_DEC_REG_GR(P3, UNW_REG_RP, dst, arg); break; + case 2: UNW_DEC_REG_GR(P3, UNW_REG_PFS, dst, arg); break; + case 3: UNW_DEC_REG_GR(P3, UNW_REG_PR, dst, arg); break; + case 4: UNW_DEC_REG_GR(P3, UNW_REG_UNAT, dst, arg); break; + case 5: UNW_DEC_REG_GR(P3, UNW_REG_LC, dst, arg); break; + case 6: UNW_DEC_RP_BR(P3, dst, arg); break; + case 7: UNW_DEC_REG_GR(P3, UNW_REG_RNAT, dst, arg); break; + case 8: UNW_DEC_REG_GR(P3, UNW_REG_BSP, dst, arg); break; + case 9: UNW_DEC_REG_GR(P3, UNW_REG_BSPSTORE, dst, arg); break; + case 10: UNW_DEC_REG_GR(P3, UNW_REG_FPSR, dst, arg); break; + case 11: UNW_DEC_PRIUNAT_GR(P3, dst, arg); break; + default: UNW_DEC_BAD_CODE(r); break; + } } else if ((code & 0x7) == 0) UNW_DEC_SPILL_MASK(P4, dp, arg); @@ -297,90 +297,90 @@ unw_decode_p7_p10 (unsigned char *dp, unsigned char code, void *arg) r = (code & 0xf); t = unw_decode_uleb128 (&dp); switch (r) - { - case 0: - size = unw_decode_uleb128 (&dp); - UNW_DEC_MEM_STACK_F(P7, t, size, arg); - break; + { + case 0: + size = unw_decode_uleb128 (&dp); + UNW_DEC_MEM_STACK_F(P7, t, size, arg); + break; - case 1: UNW_DEC_MEM_STACK_V(P7, t, arg); break; - case 2: UNW_DEC_SPILL_BASE(P7, t, arg); break; - case 3: UNW_DEC_REG_SPREL(P7, UNW_REG_PSP, t, arg); break; - case 4: UNW_DEC_REG_WHEN(P7, UNW_REG_RP, t, arg); break; - case 5: UNW_DEC_REG_PSPREL(P7, UNW_REG_RP, t, arg); break; - case 6: UNW_DEC_REG_WHEN(P7, UNW_REG_PFS, t, arg); break; - case 7: UNW_DEC_REG_PSPREL(P7, UNW_REG_PFS, t, arg); break; - case 8: UNW_DEC_REG_WHEN(P7, UNW_REG_PR, t, arg); break; - case 9: UNW_DEC_REG_PSPREL(P7, UNW_REG_PR, t, arg); break; - case 10: UNW_DEC_REG_WHEN(P7, UNW_REG_LC, t, arg); break; - case 11: UNW_DEC_REG_PSPREL(P7, UNW_REG_LC, t, arg); break; - case 12: UNW_DEC_REG_WHEN(P7, UNW_REG_UNAT, t, arg); break; - case 13: UNW_DEC_REG_PSPREL(P7, UNW_REG_UNAT, t, arg); break; - case 14: UNW_DEC_REG_WHEN(P7, UNW_REG_FPSR, t, arg); break; - case 15: UNW_DEC_REG_PSPREL(P7, UNW_REG_FPSR, t, arg); break; - default: UNW_DEC_BAD_CODE(r); break; - } + case 1: UNW_DEC_MEM_STACK_V(P7, t, arg); break; + case 2: UNW_DEC_SPILL_BASE(P7, t, arg); break; + case 3: UNW_DEC_REG_SPREL(P7, UNW_REG_PSP, t, arg); break; + case 4: UNW_DEC_REG_WHEN(P7, UNW_REG_RP, t, arg); break; + case 5: UNW_DEC_REG_PSPREL(P7, UNW_REG_RP, t, arg); break; + case 6: UNW_DEC_REG_WHEN(P7, UNW_REG_PFS, t, arg); break; + case 7: UNW_DEC_REG_PSPREL(P7, UNW_REG_PFS, t, arg); break; + case 8: UNW_DEC_REG_WHEN(P7, UNW_REG_PR, t, arg); break; + case 9: UNW_DEC_REG_PSPREL(P7, UNW_REG_PR, t, arg); break; + case 10: UNW_DEC_REG_WHEN(P7, UNW_REG_LC, t, arg); break; + case 11: UNW_DEC_REG_PSPREL(P7, UNW_REG_LC, t, arg); break; + case 12: UNW_DEC_REG_WHEN(P7, UNW_REG_UNAT, t, arg); break; + case 13: UNW_DEC_REG_PSPREL(P7, UNW_REG_UNAT, t, arg); break; + case 14: UNW_DEC_REG_WHEN(P7, UNW_REG_FPSR, t, arg); break; + case 15: UNW_DEC_REG_PSPREL(P7, UNW_REG_FPSR, t, arg); break; + default: UNW_DEC_BAD_CODE(r); break; + } } else { switch (code & 0xf) - { - case 0x0: /* p8 */ - { - r = *dp++; - t = unw_decode_uleb128 (&dp); - switch (r) - { - case 1: UNW_DEC_REG_SPREL(P8, UNW_REG_RP, t, arg); break; - case 2: UNW_DEC_REG_SPREL(P8, UNW_REG_PFS, t, arg); break; - case 3: UNW_DEC_REG_SPREL(P8, UNW_REG_PR, t, arg); break; - case 4: UNW_DEC_REG_SPREL(P8, UNW_REG_LC, t, arg); break; - case 5: UNW_DEC_REG_SPREL(P8, UNW_REG_UNAT, t, arg); break; - case 6: UNW_DEC_REG_SPREL(P8, UNW_REG_FPSR, t, arg); break; - case 7: UNW_DEC_REG_WHEN(P8, UNW_REG_BSP, t, arg); break; - case 8: UNW_DEC_REG_PSPREL(P8, UNW_REG_BSP, t, arg); break; - case 9: UNW_DEC_REG_SPREL(P8, UNW_REG_BSP, t, arg); break; - case 10: UNW_DEC_REG_WHEN(P8, UNW_REG_BSPSTORE, t, arg); break; - case 11: UNW_DEC_REG_PSPREL(P8, UNW_REG_BSPSTORE, t, arg); break; - case 12: UNW_DEC_REG_SPREL(P8, UNW_REG_BSPSTORE, t, arg); break; - case 13: UNW_DEC_REG_WHEN(P8, UNW_REG_RNAT, t, arg); break; - case 14: UNW_DEC_REG_PSPREL(P8, UNW_REG_RNAT, t, arg); break; - case 15: UNW_DEC_REG_SPREL(P8, UNW_REG_RNAT, t, arg); break; - case 16: UNW_DEC_PRIUNAT_WHEN_GR(P8, t, arg); break; - case 17: UNW_DEC_PRIUNAT_PSPREL(P8, t, arg); break; - case 18: UNW_DEC_PRIUNAT_SPREL(P8, t, arg); break; - case 19: UNW_DEC_PRIUNAT_WHEN_MEM(P8, t, arg); break; - default: UNW_DEC_BAD_CODE(r); break; - } - } - break; + { + case 0x0: /* p8 */ + { + r = *dp++; + t = unw_decode_uleb128 (&dp); + switch (r) + { + case 1: UNW_DEC_REG_SPREL(P8, UNW_REG_RP, t, arg); break; + case 2: UNW_DEC_REG_SPREL(P8, UNW_REG_PFS, t, arg); break; + case 3: UNW_DEC_REG_SPREL(P8, UNW_REG_PR, t, arg); break; + case 4: UNW_DEC_REG_SPREL(P8, UNW_REG_LC, t, arg); break; + case 5: UNW_DEC_REG_SPREL(P8, UNW_REG_UNAT, t, arg); break; + case 6: UNW_DEC_REG_SPREL(P8, UNW_REG_FPSR, t, arg); break; + case 7: UNW_DEC_REG_WHEN(P8, UNW_REG_BSP, t, arg); break; + case 8: UNW_DEC_REG_PSPREL(P8, UNW_REG_BSP, t, arg); break; + case 9: UNW_DEC_REG_SPREL(P8, UNW_REG_BSP, t, arg); break; + case 10: UNW_DEC_REG_WHEN(P8, UNW_REG_BSPSTORE, t, arg); break; + case 11: UNW_DEC_REG_PSPREL(P8, UNW_REG_BSPSTORE, t, arg); break; + case 12: UNW_DEC_REG_SPREL(P8, UNW_REG_BSPSTORE, t, arg); break; + case 13: UNW_DEC_REG_WHEN(P8, UNW_REG_RNAT, t, arg); break; + case 14: UNW_DEC_REG_PSPREL(P8, UNW_REG_RNAT, t, arg); break; + case 15: UNW_DEC_REG_SPREL(P8, UNW_REG_RNAT, t, arg); break; + case 16: UNW_DEC_PRIUNAT_WHEN_GR(P8, t, arg); break; + case 17: UNW_DEC_PRIUNAT_PSPREL(P8, t, arg); break; + case 18: UNW_DEC_PRIUNAT_SPREL(P8, t, arg); break; + case 19: UNW_DEC_PRIUNAT_WHEN_MEM(P8, t, arg); break; + default: UNW_DEC_BAD_CODE(r); break; + } + } + break; - case 0x1: - byte1 = *dp++; byte2 = *dp++; - UNW_DEC_GR_GR(P9, (byte1 & 0xf), (byte2 & 0x7f), arg); - break; + case 0x1: + byte1 = *dp++; byte2 = *dp++; + UNW_DEC_GR_GR(P9, (byte1 & 0xf), (byte2 & 0x7f), arg); + break; - case 0xf: /* p10 */ - byte1 = *dp++; byte2 = *dp++; - UNW_DEC_ABI(P10, byte1, byte2, arg); - break; + case 0xf: /* p10 */ + byte1 = *dp++; byte2 = *dp++; + UNW_DEC_ABI(P10, byte1, byte2, arg); + break; - case 0x9: - return unw_decode_x1 (dp, code, arg); + case 0x9: + return unw_decode_x1 (dp, code, arg); - case 0xa: - return unw_decode_x2 (dp, code, arg); + case 0xa: + return unw_decode_x2 (dp, code, arg); - case 0xb: - return unw_decode_x3 (dp, code, arg); + case 0xb: + return unw_decode_x3 (dp, code, arg); - case 0xc: - return unw_decode_x4 (dp, code, arg); + case 0xc: + return unw_decode_x4 (dp, code, arg); - default: - UNW_DEC_BAD_CODE(code); - break; - } + default: + UNW_DEC_BAD_CODE(code); + break; + } } return dp; } @@ -422,9 +422,9 @@ unw_decode_b3_x4 (unsigned char *dp, unsigned char code, void *arg) { label = unw_decode_uleb128 (&dp); if ((code & 0x08) != 0) - UNW_DEC_COPY_STATE(B4, label, arg); + UNW_DEC_COPY_STATE(B4, label, arg); else - UNW_DEC_LABEL_STATE(B4, label, arg); + UNW_DEC_LABEL_STATE(B4, label, arg); } else switch (code & 0x7) diff --git a/src/ia64/unwind_i.h b/src/ia64/unwind_i.h index c8cc52d6..8ccbb46c 100644 --- a/src/ia64/unwind_i.h +++ b/src/ia64/unwind_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -35,17 +35,17 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" -#define IA64_UNW_VER(x) ((x) >> 48) -#define IA64_UNW_FLAG_MASK ((unw_word_t) 0x0000ffff00000000ULL) -#define IA64_UNW_FLAG_OSMASK ((unw_word_t) 0x0000f00000000000ULL) +#define IA64_UNW_VER(x) ((x) >> 48) +#define IA64_UNW_FLAG_MASK ((unw_word_t) 0x0000ffff00000000ULL) +#define IA64_UNW_FLAG_OSMASK ((unw_word_t) 0x0000f00000000000ULL) #define IA64_UNW_FLAG_EHANDLER(x) ((x) & (unw_word_t) 0x0000000100000000ULL) #define IA64_UNW_FLAG_UHANDLER(x) ((x) & (unw_word_t) 0x0000000200000000ULL) -#define IA64_UNW_LENGTH(x) ((x) & (unw_word_t) 0x00000000ffffffffULL) +#define IA64_UNW_LENGTH(x) ((x) & (unw_word_t) 0x00000000ffffffffULL) #ifdef MIN # undef MIN #endif -#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#define MIN(a,b) ((a) < (b) ? (a) : (b)) #if !defined(HAVE_SYS_UC_ACCESS_H) && !defined(UNW_REMOTE_ONLY) @@ -57,23 +57,23 @@ inlined_uc_addr (ucontext_t *uc, int reg, uint8_t *nat_bitnr) switch (reg) { - case UNW_IA64_GR + 0: addr = &unw.read_only.r0; break; - case UNW_IA64_NAT + 0: addr = &unw.read_only.r0; break; - case UNW_IA64_FR + 0: addr = &unw.read_only.f0; break; + case UNW_IA64_GR + 0: addr = &unw.read_only.r0; break; + case UNW_IA64_NAT + 0: addr = &unw.read_only.r0; break; + case UNW_IA64_FR + 0: addr = &unw.read_only.f0; break; case UNW_IA64_FR + 1: if (__BYTE_ORDER == __BIG_ENDIAN) - addr = &unw.read_only.f1_be; + addr = &unw.read_only.f1_be; else - addr = &unw.read_only.f1_le; + addr = &unw.read_only.f1_le; break; - case UNW_IA64_IP: addr = &uc->uc_mcontext.sc_br[0]; break; - case UNW_IA64_CFM: addr = &uc->uc_mcontext.sc_ar_pfs; break; - case UNW_IA64_AR_RNAT: addr = &uc->uc_mcontext.sc_ar_rnat; break; - case UNW_IA64_AR_UNAT: addr = &uc->uc_mcontext.sc_ar_unat; break; - case UNW_IA64_AR_LC: addr = &uc->uc_mcontext.sc_ar_lc; break; - case UNW_IA64_AR_FPSR: addr = &uc->uc_mcontext.sc_ar_fpsr; break; - case UNW_IA64_PR: addr = &uc->uc_mcontext.sc_pr; break; - case UNW_IA64_AR_BSPSTORE: addr = &uc->uc_mcontext.sc_ar_bsp; break; + case UNW_IA64_IP: addr = &uc->uc_mcontext.sc_br[0]; break; + case UNW_IA64_CFM: addr = &uc->uc_mcontext.sc_ar_pfs; break; + case UNW_IA64_AR_RNAT: addr = &uc->uc_mcontext.sc_ar_rnat; break; + case UNW_IA64_AR_UNAT: addr = &uc->uc_mcontext.sc_ar_unat; break; + case UNW_IA64_AR_LC: addr = &uc->uc_mcontext.sc_ar_lc; break; + case UNW_IA64_AR_FPSR: addr = &uc->uc_mcontext.sc_ar_fpsr; break; + case UNW_IA64_PR: addr = &uc->uc_mcontext.sc_pr; break; + case UNW_IA64_AR_BSPSTORE: addr = &uc->uc_mcontext.sc_ar_bsp; break; case UNW_IA64_GR + 4 ... UNW_IA64_GR + 7: case UNW_IA64_GR + 12: @@ -117,41 +117,41 @@ static inline long ia64_read_only_reg (void *addr) { return ((unsigned long) ((char *) addr - (char *) &unw.read_only) - < sizeof (unw.read_only)); + < sizeof (unw.read_only)); } #endif /* !defined(HAVE_SYS_UC_ACCESS_H) && !defined(UNW_REMOTE_ONLY) */ /* Bits 0 and 1 of a location are used to encode its type: - bit 0: set if location uses floating-point format. - bit 1: set if location is a NaT bit on memory stack. */ + bit 0: set if location uses floating-point format. + bit 1: set if location is a NaT bit on memory stack. */ -#define IA64_LOC_TYPE_FP (1 << 0) -#define IA64_LOC_TYPE_MEMSTK_NAT (1 << 1) +#define IA64_LOC_TYPE_FP (1 << 0) +#define IA64_LOC_TYPE_MEMSTK_NAT (1 << 1) #ifdef UNW_LOCAL_ONLY -#define IA64_LOC_REG(r,t) (((r) << 2) | (t)) -#define IA64_LOC_ADDR(a,t) (((a) & ~0x3) | (t)) -#define IA64_LOC_UC_ADDR(a,t) IA64_LOC_ADDR(a, t) -#define IA64_NULL_LOC (0) +#define IA64_LOC_REG(r,t) (((r) << 2) | (t)) +#define IA64_LOC_ADDR(a,t) (((a) & ~0x3) | (t)) +#define IA64_LOC_UC_ADDR(a,t) IA64_LOC_ADDR(a, t) +#define IA64_NULL_LOC (0) -#define IA64_GET_REG(l) ((l) >> 2) -#define IA64_GET_ADDR(l) ((l) & ~0x3) -#define IA64_IS_NULL_LOC(l) ((l) == 0) -#define IA64_IS_FP_LOC(l) (((l) & IA64_LOC_TYPE_FP) != 0) -#define IA64_IS_MEMSTK_NAT(l) (((l) & IA64_LOC_TYPE_MEMSTK_NAT) != 0) -#define IA64_IS_REG_LOC(l) 0 -#define IA64_IS_UC_LOC(l) 0 +#define IA64_GET_REG(l) ((l) >> 2) +#define IA64_GET_ADDR(l) ((l) & ~0x3) +#define IA64_IS_NULL_LOC(l) ((l) == 0) +#define IA64_IS_FP_LOC(l) (((l) & IA64_LOC_TYPE_FP) != 0) +#define IA64_IS_MEMSTK_NAT(l) (((l) & IA64_LOC_TYPE_MEMSTK_NAT) != 0) +#define IA64_IS_REG_LOC(l) 0 +#define IA64_IS_UC_LOC(l) 0 -#define IA64_REG_LOC(c,r) ((unw_word_t) uc_addr((c)->as_arg, r, NULL)) -#define IA64_REG_NAT_LOC(c,r,n) ((unw_word_t) uc_addr((c)->as_arg, r, n)) -#define IA64_FPREG_LOC(c,r) \ - ((unw_word_t) uc_addr((c)->as_arg, (r), NULL) | IA64_LOC_TYPE_FP) +#define IA64_REG_LOC(c,r) ((unw_word_t) uc_addr((c)->as_arg, r, NULL)) +#define IA64_REG_NAT_LOC(c,r,n) ((unw_word_t) uc_addr((c)->as_arg, r, n)) +#define IA64_FPREG_LOC(c,r) \ + ((unw_word_t) uc_addr((c)->as_arg, (r), NULL) | IA64_LOC_TYPE_FP) -# define ia64_find_proc_info(c,ip,n) \ - tdep_find_proc_info(unw_local_addr_space, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define ia64_put_unwind_info(c, pi) do { ; } while (0) +# define ia64_find_proc_info(c,ip,n) \ + tdep_find_proc_info(unw_local_addr_space, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define ia64_put_unwind_info(c, pi) do { ; } while (0) /* Note: the register accessors (ia64_{get,set}{,fp}()) must check for NULL locations because uc_addr() returns NULL for unsaved @@ -224,47 +224,47 @@ ia64_put (struct cursor *c, unw_word_t loc, unw_word_t val) /* Bits 0 and 1 of the second word (w1) of a location are used to further distinguish what location we're dealing with: - bit 0: set if the location is a register - bit 1: set of the location is accessed via uc_access(3) */ -#define IA64_LOC_TYPE_REG (1 << 0) -#define IA64_LOC_TYPE_UC (1 << 1) + bit 0: set if the location is a register + bit 1: set of the location is accessed via uc_access(3) */ +#define IA64_LOC_TYPE_REG (1 << 0) +#define IA64_LOC_TYPE_UC (1 << 1) -#define IA64_LOC_REG(r,t) ((ia64_loc_t) { ((r) << 2) | (t), \ - IA64_LOC_TYPE_REG }) -#define IA64_LOC_ADDR(a,t) ((ia64_loc_t) { ((a) & ~0x3) | (t), 0 }) -#define IA64_LOC_UC_ADDR(a,t) ((ia64_loc_t) { ((a) & ~0x3) | (t), \ - IA64_LOC_TYPE_UC }) -#define IA64_LOC_UC_REG(r,a) ((ia64_loc_t) { ((r) << 2), \ - ((a) | IA64_LOC_TYPE_REG \ - | IA64_LOC_TYPE_UC) }) -#define IA64_NULL_LOC ((ia64_loc_t) { 0, 0 }) +#define IA64_LOC_REG(r,t) ((ia64_loc_t) { ((r) << 2) | (t), \ + IA64_LOC_TYPE_REG }) +#define IA64_LOC_ADDR(a,t) ((ia64_loc_t) { ((a) & ~0x3) | (t), 0 }) +#define IA64_LOC_UC_ADDR(a,t) ((ia64_loc_t) { ((a) & ~0x3) | (t), \ + IA64_LOC_TYPE_UC }) +#define IA64_LOC_UC_REG(r,a) ((ia64_loc_t) { ((r) << 2), \ + ((a) | IA64_LOC_TYPE_REG \ + | IA64_LOC_TYPE_UC) }) +#define IA64_NULL_LOC ((ia64_loc_t) { 0, 0 }) -#define IA64_GET_REG(l) ((l).w0 >> 2) -#define IA64_GET_ADDR(l) ((l).w0 & ~0x3) -#define IA64_GET_AUX_ADDR(l) ((l).w1 & ~0x3) -#define IA64_IS_NULL_LOC(l) (((l).w0 | (l).w1) == 0) -#define IA64_IS_FP_LOC(l) (((l).w0 & IA64_LOC_TYPE_FP) != 0) -#define IA64_IS_MEMSTK_NAT(l) (((l).w0 & IA64_LOC_TYPE_MEMSTK_NAT) != 0) -#define IA64_IS_REG_LOC(l) (((l).w1 & IA64_LOC_TYPE_REG) != 0) -#define IA64_IS_UC_LOC(l) (((l).w1 & IA64_LOC_TYPE_UC) != 0) +#define IA64_GET_REG(l) ((l).w0 >> 2) +#define IA64_GET_ADDR(l) ((l).w0 & ~0x3) +#define IA64_GET_AUX_ADDR(l) ((l).w1 & ~0x3) +#define IA64_IS_NULL_LOC(l) (((l).w0 | (l).w1) == 0) +#define IA64_IS_FP_LOC(l) (((l).w0 & IA64_LOC_TYPE_FP) != 0) +#define IA64_IS_MEMSTK_NAT(l) (((l).w0 & IA64_LOC_TYPE_MEMSTK_NAT) != 0) +#define IA64_IS_REG_LOC(l) (((l).w1 & IA64_LOC_TYPE_REG) != 0) +#define IA64_IS_UC_LOC(l) (((l).w1 & IA64_LOC_TYPE_UC) != 0) -#define IA64_REG_LOC(c,r) IA64_LOC_REG ((r), 0) -#define IA64_REG_NAT_LOC(c,r,n) IA64_LOC_REG ((r), 0) -#define IA64_FPREG_LOC(c,r) IA64_LOC_REG ((r), IA64_LOC_TYPE_FP) +#define IA64_REG_LOC(c,r) IA64_LOC_REG ((r), 0) +#define IA64_REG_NAT_LOC(c,r,n) IA64_LOC_REG ((r), 0) +#define IA64_FPREG_LOC(c,r) IA64_LOC_REG ((r), IA64_LOC_TYPE_FP) -# define ia64_find_proc_info(c,ip,n) \ - (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ - (c)->as_arg) -# define ia64_put_unwind_info(c,pi) \ - (*(c)->as->acc.put_unwind_info)((c)->as, (pi), (c)->as_arg) +# define ia64_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define ia64_put_unwind_info(c,pi) \ + (*(c)->as->acc.put_unwind_info)((c)->as, (pi), (c)->as_arg) -#define ia64_uc_access_reg UNW_OBJ(uc_access_reg) -#define ia64_uc_access_fpreg UNW_OBJ(uc_access_fpreg) +#define ia64_uc_access_reg UNW_OBJ(uc_access_reg) +#define ia64_uc_access_fpreg UNW_OBJ(uc_access_fpreg) extern int ia64_uc_access_reg (struct cursor *c, ia64_loc_t loc, - unw_word_t *valp, int write); + unw_word_t *valp, int write); extern int ia64_uc_access_fpreg (struct cursor *c, ia64_loc_t loc, - unw_fpreg_t *valp, int write); + unw_fpreg_t *valp, int write); static inline int ia64_getfp (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *val) @@ -283,16 +283,16 @@ ia64_getfp (struct cursor *c, ia64_loc_t loc, unw_fpreg_t *val) if (IA64_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, IA64_GET_REG (loc), - val, 0, c->as_arg); + val, 0, c->as_arg); addr = IA64_GET_ADDR (loc); ret = (*c->as->acc.access_mem) (c->as, addr + 0, &val->raw.bits[0], 0, - c->as_arg); + c->as_arg); if (ret < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 8, &val->raw.bits[1], 0, - c->as_arg); + c->as_arg); } static inline int @@ -312,16 +312,16 @@ ia64_putfp (struct cursor *c, ia64_loc_t loc, unw_fpreg_t val) if (IA64_IS_REG_LOC (loc)) return (*c->as->acc.access_fpreg) (c->as, IA64_GET_REG (loc), &val, 1, - c->as_arg); + c->as_arg); addr = IA64_GET_ADDR (loc); ret = (*c->as->acc.access_mem) (c->as, addr + 0, &val.raw.bits[0], 1, - c->as_arg); + c->as_arg); if (ret < 0) return ret; return (*c->as->acc.access_mem) (c->as, addr + 8, &val.raw.bits[1], 1, - c->as_arg); + c->as_arg); } /* Get the 64 data bits from location LOC. If bit 0 is cleared, LOC @@ -345,12 +345,12 @@ ia64_get (struct cursor *c, ia64_loc_t loc, unw_word_t *val) ret = ia64_getfp (c, loc, &tmp); if (ret < 0) - return ret; + return ret; if (c->as->big_endian) - *val = tmp.raw.bits[1]; + *val = tmp.raw.bits[1]; else - *val = tmp.raw.bits[0]; + *val = tmp.raw.bits[0]; return 0; } @@ -359,10 +359,10 @@ ia64_get (struct cursor *c, ia64_loc_t loc, unw_word_t *val) if (IA64_IS_REG_LOC (loc)) return (*c->as->acc.access_reg)(c->as, IA64_GET_REG (loc), val, 0, - c->as_arg); + c->as_arg); else return (*c->as->acc.access_mem)(c->as, IA64_GET_ADDR (loc), val, 0, - c->as_arg); + c->as_arg); } static inline int @@ -380,9 +380,9 @@ ia64_put (struct cursor *c, ia64_loc_t loc, unw_word_t val) memset (&tmp, 0, sizeof (tmp)); if (c->as->big_endian) - tmp.raw.bits[1] = val; + tmp.raw.bits[1] = val; else - tmp.raw.bits[0] = val; + tmp.raw.bits[0] = val; return ia64_putfp (c, loc, tmp); } @@ -391,10 +391,10 @@ ia64_put (struct cursor *c, ia64_loc_t loc, unw_word_t val) if (IA64_IS_REG_LOC (loc)) return (*c->as->acc.access_reg)(c->as, IA64_GET_REG (loc), &val, 1, - c->as_arg); + c->as_arg); else return (*c->as->acc.access_mem)(c->as, IA64_GET_ADDR (loc), &val, 1, - c->as_arg); + c->as_arg); } #endif /* !UNW_LOCAL_ONLY */ @@ -402,7 +402,7 @@ ia64_put (struct cursor *c, ia64_loc_t loc, unw_word_t val) struct ia64_unwind_block { unw_word_t header; - unw_word_t desc[0]; /* unwind descriptors */ + unw_word_t desc[0]; /* unwind descriptors */ /* Personality routine and language-specific data follow behind descriptors. */ @@ -410,58 +410,58 @@ struct ia64_unwind_block enum ia64_where { - IA64_WHERE_NONE, /* register isn't saved at all */ - IA64_WHERE_GR, /* register is saved in a general register */ - IA64_WHERE_FR, /* register is saved in a floating-point register */ - IA64_WHERE_BR, /* register is saved in a branch register */ - IA64_WHERE_SPREL, /* register is saved on memstack (sp-relative) */ - IA64_WHERE_PSPREL, /* register is saved on memstack (psp-relative) */ + IA64_WHERE_NONE, /* register isn't saved at all */ + IA64_WHERE_GR, /* register is saved in a general register */ + IA64_WHERE_FR, /* register is saved in a floating-point register */ + IA64_WHERE_BR, /* register is saved in a branch register */ + IA64_WHERE_SPREL, /* register is saved on memstack (sp-relative) */ + IA64_WHERE_PSPREL, /* register is saved on memstack (psp-relative) */ /* At the end of each prologue these locations get resolved to IA64_WHERE_PSPREL and IA64_WHERE_GR, respectively: */ IA64_WHERE_SPILL_HOME, /* register is saved in its spill home */ - IA64_WHERE_GR_SAVE /* register is saved in next general register */ + IA64_WHERE_GR_SAVE /* register is saved in next general register */ }; -#define IA64_WHEN_NEVER 0x7fffffff +#define IA64_WHEN_NEVER 0x7fffffff struct ia64_reg_info { - unw_word_t val; /* save location: register number or offset */ - enum ia64_where where; /* where the register gets saved */ - int when; /* when the register gets saved */ + unw_word_t val; /* save location: register number or offset */ + enum ia64_where where; /* where the register gets saved */ + int when; /* when the register gets saved */ }; -struct ia64_labeled_state; /* opaque structure */ +struct ia64_labeled_state; /* opaque structure */ struct ia64_reg_state { struct ia64_reg_state *next; /* next (outer) element on state stack */ - struct ia64_reg_info reg[IA64_NUM_PREGS]; /* register save locations */ + struct ia64_reg_info reg[IA64_NUM_PREGS]; /* register save locations */ }; struct ia64_state_record { - unsigned int first_region : 1; /* is this the first region? */ - unsigned int done : 1; /* are we done scanning descriptors? */ - unsigned int any_spills : 1; /* got any register spills? */ - unsigned int in_body : 1; /* are we inside prologue or body? */ - uint8_t *imask; /* imask of spill_mask record or NULL */ + unsigned int first_region : 1; /* is this the first region? */ + unsigned int done : 1; /* are we done scanning descriptors? */ + unsigned int any_spills : 1; /* got any register spills? */ + unsigned int in_body : 1; /* are we inside prologue or body? */ + uint8_t *imask; /* imask of spill_mask record or NULL */ uint16_t abi_marker; - unw_word_t pr_val; /* predicate values */ - unw_word_t pr_mask; /* predicate mask */ + unw_word_t pr_val; /* predicate values */ + unw_word_t pr_mask; /* predicate mask */ - long spill_offset; /* psp-relative offset for spill base */ + long spill_offset; /* psp-relative offset for spill base */ int region_start; int region_len; int when_sp_restored; int epilogue_count; int when_target; - uint8_t gr_save_loc; /* next save register */ - uint8_t return_link_reg; /* branch register used as return pointer */ + uint8_t gr_save_loc; /* next save register */ + uint8_t return_link_reg; /* branch register used as return pointer */ struct ia64_labeled_state *labeled_states; struct ia64_reg_state curr; @@ -469,65 +469,65 @@ struct ia64_state_record struct ia64_labeled_state { - struct ia64_labeled_state *next; /* next label (or NULL) */ - unsigned long label; /* label for this state */ + struct ia64_labeled_state *next; /* next label (or NULL) */ + unsigned long label; /* label for this state */ struct ia64_reg_state saved_state; }; /* Convenience macros: */ -#define ia64_make_proc_info UNW_OBJ(make_proc_info) -#define ia64_fetch_proc_info UNW_OBJ(fetch_proc_info) -#define ia64_create_state_record UNW_OBJ(create_state_record) -#define ia64_free_state_record UNW_OBJ(free_state_record) -#define ia64_find_save_locs UNW_OBJ(find_save_locs) -#define ia64_validate_cache UNW_OBJ(ia64_validate_cache) -#define ia64_local_validate_cache UNW_OBJ(ia64_local_validate_cache) -#define ia64_per_thread_cache UNW_OBJ(per_thread_cache) -#define ia64_scratch_loc UNW_OBJ(scratch_loc) -#define ia64_local_resume UNW_OBJ(local_resume) -#define ia64_local_addr_space_init UNW_OBJ(local_addr_space_init) -#define ia64_strloc UNW_OBJ(strloc) -#define ia64_install_cursor UNW_OBJ(install_cursor) -#define rbs_switch UNW_OBJ(rbs_switch) -#define rbs_find_stacked UNW_OBJ(rbs_find_stacked) +#define ia64_make_proc_info UNW_OBJ(make_proc_info) +#define ia64_fetch_proc_info UNW_OBJ(fetch_proc_info) +#define ia64_create_state_record UNW_OBJ(create_state_record) +#define ia64_free_state_record UNW_OBJ(free_state_record) +#define ia64_find_save_locs UNW_OBJ(find_save_locs) +#define ia64_validate_cache UNW_OBJ(ia64_validate_cache) +#define ia64_local_validate_cache UNW_OBJ(ia64_local_validate_cache) +#define ia64_per_thread_cache UNW_OBJ(per_thread_cache) +#define ia64_scratch_loc UNW_OBJ(scratch_loc) +#define ia64_local_resume UNW_OBJ(local_resume) +#define ia64_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define ia64_strloc UNW_OBJ(strloc) +#define ia64_install_cursor UNW_OBJ(install_cursor) +#define rbs_switch UNW_OBJ(rbs_switch) +#define rbs_find_stacked UNW_OBJ(rbs_find_stacked) extern int ia64_make_proc_info (struct cursor *c); extern int ia64_fetch_proc_info (struct cursor *c, unw_word_t ip, - int need_unwind_info); + int need_unwind_info); /* The proc-info must be valid for IP before this routine can be called: */ extern int ia64_create_state_record (struct cursor *c, - struct ia64_state_record *sr); + struct ia64_state_record *sr); extern int ia64_free_state_record (struct ia64_state_record *sr); extern int ia64_find_save_locs (struct cursor *c); extern void ia64_validate_cache (unw_addr_space_t as, void *arg); extern int ia64_local_validate_cache (unw_addr_space_t as, void *arg); extern void ia64_local_addr_space_init (void); extern ia64_loc_t ia64_scratch_loc (struct cursor *c, unw_regnum_t reg, - uint8_t *nat_bitnr); + uint8_t *nat_bitnr); extern NORETURN void ia64_install_cursor (struct cursor *c, - unw_word_t pri_unat, - unw_word_t *extra, - unw_word_t bspstore, - unw_word_t dirty_size, - unw_word_t *dirty_partition, - unw_word_t dirty_rnat); + unw_word_t pri_unat, + unw_word_t *extra, + unw_word_t bspstore, + unw_word_t dirty_size, + unw_word_t *dirty_partition, + unw_word_t dirty_rnat); extern int ia64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, - void *arg); + void *arg); extern int rbs_switch (struct cursor *c, - unw_word_t saved_bsp, unw_word_t saved_bspstore, - ia64_loc_t saved_rnat_loc); + unw_word_t saved_bsp, unw_word_t saved_bspstore, + ia64_loc_t saved_rnat_loc); extern int rbs_find_stacked (struct cursor *c, unw_word_t regs_to_skip, - ia64_loc_t *locp, ia64_loc_t *rnat_locp); + ia64_loc_t *locp, ia64_loc_t *rnat_locp); #ifndef UNW_REMOTE_ONLY # define NEED_RBS_COVER_AND_FLUSH -# define rbs_cover_and_flush UNW_OBJ(rbs_cover_and_flush) +# define rbs_cover_and_flush UNW_OBJ(rbs_cover_and_flush) extern int rbs_cover_and_flush (struct cursor *c, unw_word_t nregs, - unw_word_t *dirty_partition, - unw_word_t *dirty_rnat, - unw_word_t *bspstore); + unw_word_t *dirty_partition, + unw_word_t *dirty_rnat, + unw_word_t *bspstore); #endif /* Warning: ia64_strloc() is for debugging only and it is NOT re-entrant! */ @@ -554,7 +554,7 @@ rbs_contains (struct rbs_area *rbs, unw_word_t bsp) take advantage of the fact that -n == ~n + 1. */ result = bsp - rbs->end > ~rbs->size; Debug (16, "0x%lx in [0x%lx-0x%lx) => %d\n", - (long) bsp, (long) (rbs->end - rbs->size), (long) rbs->end, result); + (long) bsp, (long) (rbs->end - rbs->size), (long) rbs->end, result); return result; } @@ -567,9 +567,9 @@ rbs_get_rnat_loc (struct rbs_area *rbs, unw_word_t bsp) if (rbs_contains (rbs, rnat_addr)) { if (rbs_on_uc (rbs)) - rnat_loc = IA64_LOC_UC_ADDR (rnat_addr, 0); + rnat_loc = IA64_LOC_UC_ADDR (rnat_addr, 0); else - rnat_loc = IA64_LOC_ADDR (rnat_addr, 0); + rnat_loc = IA64_LOC_ADDR (rnat_addr, 0); } else rnat_loc = rbs->rnat_loc; @@ -587,7 +587,7 @@ rbs_loc (struct rbs_area *rbs, unw_word_t bsp) static inline int ia64_get_stacked (struct cursor *c, unw_word_t reg, - ia64_loc_t *locp, ia64_loc_t *rnat_locp) + ia64_loc_t *locp, ia64_loc_t *rnat_locp) { struct rbs_area *rbs = c->rbs_area + c->rbs_curr; unw_word_t addr, regs_to_skip = reg - 32; @@ -609,15 +609,15 @@ ia64_get_stacked (struct cursor *c, unw_word_t reg, /* The UNaT slot # calculation is identical to the one for RNaT slots, but for readability/clarity, we don't want to use ia64_rnat_slot_num() directly. */ -#define ia64_unat_slot_num(addr) rse_slot_num(addr) +#define ia64_unat_slot_num(addr) rse_slot_num(addr) /* The following are helper macros which makes it easier for libunwind to be used in the kernel. They allow the kernel to optimize away any unused code without littering everything with #ifdefs. */ -#define ia64_is_big_endian(c) ((c)->as->big_endian) -#define ia64_get_abi(c) ((c)->as->abi) -#define ia64_set_abi(c, v) ((c)->as->abi = (v)) -#define ia64_get_abi_marker(c) ((c)->last_abi_marker) +#define ia64_is_big_endian(c) ((c)->as->big_endian) +#define ia64_get_abi(c) ((c)->as->abi) +#define ia64_set_abi(c, v) ((c)->as->abi = (v)) +#define ia64_get_abi_marker(c) ((c)->last_abi_marker) /* XXX should be in glibc: */ #ifndef IA64_SC_FLAG_ONSTACK @@ -625,9 +625,9 @@ ia64_get_stacked (struct cursor *c, unw_word_t reg, # define IA64_SC_FLAG_IN_SYSCALL_BIT 1 /* did signal interrupt a syscall? */ # define IA64_SC_FLAG_FPH_VALID_BIT 2 /* is state in f[32]-f[127] valid? */ -# define IA64_SC_FLAG_ONSTACK (1 << IA64_SC_FLAG_ONSTACK_BIT) -# define IA64_SC_FLAG_IN_SYSCALL (1 << IA64_SC_FLAG_IN_SYSCALL_BIT) -# define IA64_SC_FLAG_FPH_VALID (1 << IA64_SC_FLAG_FPH_VALID_BIT) +# define IA64_SC_FLAG_ONSTACK (1 << IA64_SC_FLAG_ONSTACK_BIT) +# define IA64_SC_FLAG_IN_SYSCALL (1 << IA64_SC_FLAG_IN_SYSCALL_BIT) +# define IA64_SC_FLAG_FPH_VALID (1 << IA64_SC_FLAG_FPH_VALID_BIT) #endif #endif /* unwind_i_h */ diff --git a/src/mi/Gdestroy_addr_space.c b/src/mi/Gdestroy_addr_space.c index 83a01b92..719c051e 100644 --- a/src/mi/Gdestroy_addr_space.c +++ b/src/mi/Gdestroy_addr_space.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/Gdyn-extract.c b/src/mi/Gdyn-extract.c index 5258839f..a0833509 100644 --- a/src/mi/Gdyn-extract.c +++ b/src/mi/Gdyn-extract.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,8 +27,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int unwi_extract_dynamic_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, unw_dyn_info_t *di, - int need_unwind_info, void *arg) + unw_proc_info_t *pi, unw_dyn_info_t *di, + int need_unwind_info, void *arg) { pi->start_ip = di->start_ip; pi->end_ip = di->end_ip; @@ -42,9 +42,9 @@ unwi_extract_dynamic_proc_info (unw_addr_space_t as, unw_word_t ip, pi->flags = di->u.pi.flags; pi->unwind_info_size = 0; if (need_unwind_info) - pi->unwind_info = di; + pi->unwind_info = di; else - pi->unwind_info = NULL; + pi->unwind_info = NULL; return 0; case UNW_INFO_FORMAT_TABLE: diff --git a/src/mi/Gdyn-remote.c b/src/mi/Gdyn-remote.c index 917a11de..1f029b4d 100644 --- a/src/mi/Gdyn-remote.c +++ b/src/mi/Gdyn-remote.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -38,7 +38,7 @@ free_regions (unw_dyn_region_info_t *region) static int intern_op (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, - unw_dyn_op_t *op, void *arg) + unw_dyn_op_t *op, void *arg) { int ret; @@ -53,7 +53,7 @@ intern_op (unw_addr_space_t as, unw_accessors_t *a, unw_word_t *addr, static int intern_regions (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, unw_dyn_region_info_t **regionp, void *arg) + unw_word_t *addr, unw_dyn_region_info_t **regionp, void *arg) { uint32_t insn_count, op_count, i; unw_dyn_region_info_t *region; @@ -63,7 +63,7 @@ intern_regions (unw_addr_space_t as, unw_accessors_t *a, *regionp = NULL; if (!*addr) - return 0; /* NULL region-list */ + return 0; /* NULL region-list */ if ((ret = fetchw (as, a, addr, &next_addr, arg)) < 0 || (ret = fetch32 (as, a, addr, (int32_t *) &insn_count, arg)) < 0 @@ -98,8 +98,8 @@ intern_regions (unw_addr_space_t as, unw_accessors_t *a, static int intern_array (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, unw_word_t table_len, unw_word_t **table_data, - void *arg) + unw_word_t *addr, unw_word_t table_len, unw_word_t **table_data, + void *arg) { unw_word_t i, *data = calloc (table_len, WSIZE); int ret = 0; @@ -130,18 +130,18 @@ free_dyn_info (unw_dyn_info_t *di) { case UNW_INFO_FORMAT_DYNAMIC: if (di->u.pi.regions) - { - free_regions (di->u.pi.regions); - di->u.pi.regions = NULL; - } + { + free_regions (di->u.pi.regions); + di->u.pi.regions = NULL; + } break; case UNW_INFO_FORMAT_TABLE: if (di->u.ti.table_data) - { - free (di->u.ti.table_data); - di->u.ti.table_data = NULL; - } + { + free (di->u.ti.table_data); + di->u.ti.table_data = NULL; + } break; case UNW_INFO_FORMAT_REMOTE_TABLE: @@ -152,7 +152,7 @@ free_dyn_info (unw_dyn_info_t *di) static int intern_dyn_info (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t *addr, unw_dyn_info_t *di, void *arg) + unw_word_t *addr, unw_dyn_info_t *di, void *arg) { unw_word_t first_region; int ret; @@ -161,32 +161,32 @@ intern_dyn_info (unw_addr_space_t as, unw_accessors_t *a, { case UNW_INFO_FORMAT_DYNAMIC: if ((ret = fetchw (as, a, addr, &di->u.pi.name_ptr, arg)) < 0 - || (ret = fetchw (as, a, addr, &di->u.pi.handler, arg)) < 0 - || (ret = fetch32 (as, a, addr, - (int32_t *) &di->u.pi.flags, arg)) < 0) - goto out; - *addr += 4; /* skip over pad0 */ + || (ret = fetchw (as, a, addr, &di->u.pi.handler, arg)) < 0 + || (ret = fetch32 (as, a, addr, + (int32_t *) &di->u.pi.flags, arg)) < 0) + goto out; + *addr += 4; /* skip over pad0 */ if ((ret = fetchw (as, a, addr, &first_region, arg)) < 0 - || (ret = intern_regions (as, a, &first_region, &di->u.pi.regions, - arg)) < 0) - goto out; + || (ret = intern_regions (as, a, &first_region, &di->u.pi.regions, + arg)) < 0) + goto out; break; case UNW_INFO_FORMAT_TABLE: if ((ret = fetchw (as, a, addr, &di->u.ti.name_ptr, arg)) < 0 - || (ret = fetchw (as, a, addr, &di->u.ti.segbase, arg)) < 0 - || (ret = fetchw (as, a, addr, &di->u.ti.table_len, arg)) < 0 - || (ret = intern_array (as, a, addr, di->u.ti.table_len, - &di->u.ti.table_data, arg)) < 0) - goto out; + || (ret = fetchw (as, a, addr, &di->u.ti.segbase, arg)) < 0 + || (ret = fetchw (as, a, addr, &di->u.ti.table_len, arg)) < 0 + || (ret = intern_array (as, a, addr, di->u.ti.table_len, + &di->u.ti.table_data, arg)) < 0) + goto out; break; case UNW_INFO_FORMAT_REMOTE_TABLE: if ((ret = fetchw (as, a, addr, &di->u.rti.name_ptr, arg)) < 0 - || (ret = fetchw (as, a, addr, &di->u.rti.segbase, arg)) < 0 - || (ret = fetchw (as, a, addr, &di->u.rti.table_len, arg)) < 0 - || (ret = fetchw (as, a, addr, &di->u.rti.table_data, arg)) < 0) - goto out; + || (ret = fetchw (as, a, addr, &di->u.rti.segbase, arg)) < 0 + || (ret = fetchw (as, a, addr, &di->u.rti.table_len, arg)) < 0 + || (ret = fetchw (as, a, addr, &di->u.rti.table_data, arg)) < 0) + goto out; break; default: @@ -202,8 +202,8 @@ intern_dyn_info (unw_addr_space_t as, unw_accessors_t *a, HIDDEN int unwi_dyn_remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, - int need_unwind_info, void *arg) + unw_proc_info_t *pi, + int need_unwind_info, void *arg) { unw_accessors_t *a = unw_get_accessors (as); unw_word_t dyn_list_addr, addr, next_addr, gen1, gen2, start_ip, end_ip; @@ -215,9 +215,9 @@ unwi_dyn_remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, else { if ((*a->get_dyn_info_list_addr) (as, &dyn_list_addr, arg) < 0) - return -UNW_ENOINFO; + return -UNW_ENOINFO; if (as->caching_policy != UNW_CACHE_NONE) - as->dyn_info_list_addr = dyn_list_addr; + as->dyn_info_list_addr = dyn_list_addr; } do @@ -227,55 +227,55 @@ unwi_dyn_remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, ret = -UNW_ENOINFO; if (fetchw (as, a, &addr, &gen1, arg) < 0 - || fetchw (as, a, &addr, &next_addr, arg) < 0) - return ret; + || fetchw (as, a, &addr, &next_addr, arg) < 0) + return ret; for (addr = next_addr; addr != 0; addr = next_addr) - { - if (fetchw (as, a, &addr, &next_addr, arg) < 0) - goto recheck; /* only fail if generation # didn't change */ + { + if (fetchw (as, a, &addr, &next_addr, arg) < 0) + goto recheck; /* only fail if generation # didn't change */ - addr += WSIZE; /* skip over prev_addr */ + addr += WSIZE; /* skip over prev_addr */ - if (fetchw (as, a, &addr, &start_ip, arg) < 0 - || fetchw (as, a, &addr, &end_ip, arg) < 0) - goto recheck; /* only fail if generation # didn't change */ + if (fetchw (as, a, &addr, &start_ip, arg) < 0 + || fetchw (as, a, &addr, &end_ip, arg) < 0) + goto recheck; /* only fail if generation # didn't change */ - if (ip >= start_ip && ip < end_ip) - { - if (!di) - di = calloc (1, sizeof (*di)); + if (ip >= start_ip && ip < end_ip) + { + if (!di) + di = calloc (1, sizeof (*di)); - di->start_ip = start_ip; - di->end_ip = end_ip; + di->start_ip = start_ip; + di->end_ip = end_ip; - if (fetchw (as, a, &addr, &di->gp, arg) < 0 - || fetch32 (as, a, &addr, &di->format, arg) < 0) - goto recheck; /* only fail if generation # didn't change */ + if (fetchw (as, a, &addr, &di->gp, arg) < 0 + || fetch32 (as, a, &addr, &di->format, arg) < 0) + goto recheck; /* only fail if generation # didn't change */ - addr += 4; /* skip over padding */ + addr += 4; /* skip over padding */ - if (need_unwind_info - && intern_dyn_info (as, a, &addr, di, arg) < 0) - goto recheck; /* only fail if generation # didn't change */ + if (need_unwind_info + && intern_dyn_info (as, a, &addr, di, arg) < 0) + goto recheck; /* only fail if generation # didn't change */ - if (unwi_extract_dynamic_proc_info (as, ip, pi, di, - need_unwind_info, arg) < 0) - { - free_dyn_info (di); - goto recheck; /* only fail if generation # didn't change */ - } - ret = 0; /* OK, found it */ - break; - } - } + if (unwi_extract_dynamic_proc_info (as, ip, pi, di, + need_unwind_info, arg) < 0) + { + free_dyn_info (di); + goto recheck; /* only fail if generation # didn't change */ + } + ret = 0; /* OK, found it */ + break; + } + } /* Re-check generation number to ensure the data we have is - consistent. */ + consistent. */ recheck: addr = dyn_list_addr; if (fetchw (as, a, &addr, &gen2, arg) < 0) - return ret; + return ret; } while (gen1 != gen2); @@ -287,7 +287,7 @@ unwi_dyn_remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, HIDDEN void unwi_dyn_remote_put_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, - void *arg) + void *arg) { if (!pi->unwind_info) return; diff --git a/src/mi/Gfind_dynamic_proc_info.c b/src/mi/Gfind_dynamic_proc_info.c index 6cf3b427..98d35012 100644 --- a/src/mi/Gfind_dynamic_proc_info.c +++ b/src/mi/Gfind_dynamic_proc_info.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ static inline int local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, - int need_unwind_info, void *arg) + int need_unwind_info, void *arg) { return -UNW_ENOINFO; } @@ -38,7 +38,7 @@ local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, static inline int local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, - int need_unwind_info, void *arg) + int need_unwind_info, void *arg) { unw_dyn_info_list_t *list; unw_dyn_info_t *di; @@ -53,7 +53,7 @@ local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, for (di = list->first; di; di = di->next) if (ip >= di->start_ip && ip < di->end_ip) return unwi_extract_dynamic_proc_info (as, ip, pi, di, need_unwind_info, - arg); + arg); return -UNW_ENOINFO; } @@ -63,7 +63,7 @@ local_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, static inline int remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, - int need_unwind_info, void *arg) + int need_unwind_info, void *arg) { return -UNW_ENOINFO; } @@ -72,7 +72,7 @@ remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, static inline int remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, - int need_unwind_info, void *arg) + int need_unwind_info, void *arg) { return unwi_dyn_remote_find_proc_info (as, ip, pi, need_unwind_info, arg); } @@ -81,8 +81,8 @@ remote_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, HIDDEN int unwi_find_dynamic_proc_info (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, int need_unwind_info, - void *arg) + unw_proc_info_t *pi, int need_unwind_info, + void *arg) { if (as == unw_local_addr_space) return local_find_proc_info (as, ip, pi, need_unwind_info, arg); diff --git a/src/mi/Gget_accessors.c b/src/mi/Gget_accessors.c index 0e3606c6..548c7636 100644 --- a/src/mi/Gget_accessors.c +++ b/src/mi/Gget_accessors.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002, 2004-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/Gget_fpreg.c b/src/mi/Gget_fpreg.c index a9ae9bf6..f2f7405e 100644 --- a/src/mi/Gget_fpreg.c +++ b/src/mi/Gget_fpreg.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/Gget_proc_info_by_ip.c b/src/mi/Gget_proc_info_by_ip.c index 4c9de770..c39312d5 100644 --- a/src/mi/Gget_proc_info_by_ip.c +++ b/src/mi/Gget_proc_info_by_ip.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ PROTECTED int unw_get_proc_info_by_ip (unw_addr_space_t as, unw_word_t ip, - unw_proc_info_t *pi, void *as_arg) + unw_proc_info_t *pi, void *as_arg) { unw_accessors_t *a = unw_get_accessors (as); int ret; diff --git a/src/mi/Gget_proc_name.c b/src/mi/Gget_proc_name.c index bc3d23d2..5376f82c 100644 --- a/src/mi/Gget_proc_name.c +++ b/src/mi/Gget_proc_name.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ static inline int intern_string (unw_addr_space_t as, unw_accessors_t *a, - unw_word_t addr, char *buf, size_t buf_len, void *arg) + unw_word_t addr, char *buf, size_t buf_len, void *arg) { size_t i; int ret; @@ -36,24 +36,24 @@ intern_string (unw_addr_space_t as, unw_accessors_t *a, for (i = 0; i < buf_len; ++i) { if ((ret = fetch8 (as, a, &addr, (int8_t *) buf + i, arg)) < 0) - return ret; + return ret; if (buf[i] == '\0') - return 0; /* copied full string; return success */ + return 0; /* copied full string; return success */ } - buf[buf_len - 1] = '\0'; /* ensure string is NUL terminated */ + buf[buf_len - 1] = '\0'; /* ensure string is NUL terminated */ return -UNW_ENOMEM; } static inline int get_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, void *arg) + char *buf, size_t buf_len, unw_word_t *offp, void *arg) { unw_accessors_t *a = unw_get_accessors (as); unw_proc_info_t pi; int ret; - buf[0] = '\0'; /* always return a valid string, even if it's empty */ + buf[0] = '\0'; /* always return a valid string, even if it's empty */ ret = unwi_find_dynamic_proc_info (as, ip, &pi, 1, arg); if (ret == 0) @@ -61,25 +61,25 @@ get_proc_name (unw_addr_space_t as, unw_word_t ip, unw_dyn_info_t *di = pi.unwind_info; if (offp) - *offp = ip - pi.start_ip; + *offp = ip - pi.start_ip; switch (di->format) - { - case UNW_INFO_FORMAT_DYNAMIC: - ret = intern_string (as, a, di->u.pi.name_ptr, buf, buf_len, arg); - break; + { + case UNW_INFO_FORMAT_DYNAMIC: + ret = intern_string (as, a, di->u.pi.name_ptr, buf, buf_len, arg); + break; - case UNW_INFO_FORMAT_TABLE: - case UNW_INFO_FORMAT_REMOTE_TABLE: - /* XXX should we create a fake name, e.g.: "tablenameN", - where N is the index of the function in the table??? */ - ret = -UNW_ENOINFO; - break; + case UNW_INFO_FORMAT_TABLE: + case UNW_INFO_FORMAT_REMOTE_TABLE: + /* XXX should we create a fake name, e.g.: "tablenameN", + where N is the index of the function in the table??? */ + ret = -UNW_ENOINFO; + break; - default: - ret = -UNW_EINVAL; - break; - } + default: + ret = -UNW_EINVAL; + break; + } unwi_put_dynamic_unwind_info (as, &pi, arg); return ret; } @@ -97,7 +97,7 @@ get_proc_name (unw_addr_space_t as, unw_word_t ip, PROTECTED int unw_get_proc_name (unw_cursor_t *cursor, char *buf, size_t buf_len, - unw_word_t *offp) + unw_word_t *offp) { struct cursor *c = (struct cursor *) cursor; unw_word_t ip; @@ -107,7 +107,7 @@ unw_get_proc_name (unw_cursor_t *cursor, char *buf, size_t buf_len, if (c->dwarf.use_prev_instr) --ip; error = get_proc_name (tdep_get_as (c), ip, buf, buf_len, offp, - tdep_get_as_arg (c)); + tdep_get_as_arg (c)); if (c->dwarf.use_prev_instr && offp != NULL && error == 0) *offp += 1; return error; diff --git a/src/mi/Gget_reg.c b/src/mi/Gget_reg.c index 021d913e..7c0a5a9c 100644 --- a/src/mi/Gget_reg.c +++ b/src/mi/Gget_reg.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/Gput_dynamic_unwind_info.c b/src/mi/Gput_dynamic_unwind_info.c index 13a9c1ab..ca377c98 100644 --- a/src/mi/Gput_dynamic_unwind_info.c +++ b/src/mi/Gput_dynamic_unwind_info.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN void unwi_put_dynamic_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, - void *arg) + void *arg) { switch (pi->format) { @@ -37,7 +37,7 @@ unwi_put_dynamic_unwind_info (unw_addr_space_t as, unw_proc_info_t *pi, unwi_dyn_remote_put_unwind_info (as, pi, arg); # else if (as != unw_local_addr_space) - unwi_dyn_remote_put_unwind_info (as, pi, arg); + unwi_dyn_remote_put_unwind_info (as, pi, arg); # endif #endif break; diff --git a/src/mi/Gset_caching_policy.c b/src/mi/Gset_caching_policy.c index 421c4357..45ba1001 100644 --- a/src/mi/Gset_caching_policy.c +++ b/src/mi/Gset_caching_policy.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -37,7 +37,7 @@ unw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy) #endif if (policy == as->caching_policy) - return 0; /* no change */ + return 0; /* no change */ as->caching_policy = policy; /* Ensure caches are empty (and initialized). */ diff --git a/src/mi/Gset_fpreg.c b/src/mi/Gset_fpreg.c index d3b202de..4f2fa7be 100644 --- a/src/mi/Gset_fpreg.c +++ b/src/mi/Gset_fpreg.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/Gset_reg.c b/src/mi/Gset_reg.c index 09fa09a3..c9b6e6aa 100644 --- a/src/mi/Gset_reg.c +++ b/src/mi/Gset_reg.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/_ReadSLEB.c b/src/mi/_ReadSLEB.c index ce08f339..c041e37a 100644 --- a/src/mi/_ReadSLEB.c +++ b/src/mi/_ReadSLEB.c @@ -13,7 +13,7 @@ _ReadSLEB (unsigned char **dpp) result |= (byte & 0x7f) << shift; shift += 7; if ((byte & 0x80) == 0) - break; + break; } if (shift < 8 * sizeof (unw_word_t) && (byte & 0x40) != 0) diff --git a/src/mi/_ReadULEB.c b/src/mi/_ReadULEB.c index 8952e635..116f3e19 100644 --- a/src/mi/_ReadULEB.c +++ b/src/mi/_ReadULEB.c @@ -12,7 +12,7 @@ _ReadULEB (unsigned char **dpp) byte = *bp++; result |= (byte & 0x7f) << shift; if ((byte & 0x80) == 0) - break; + break; shift += 7; } *dpp = bp; diff --git a/src/mi/backtrace.c b/src/mi/backtrace.c index 91d6597a..c7aa2bdc 100644 --- a/src/mi/backtrace.c +++ b/src/mi/backtrace.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -45,10 +45,10 @@ slow_backtrace (void **buffer, int size, unw_context_t *uc) while (unw_step (&cursor) > 0) { if (n >= size) - return n; + return n; if (unw_get_reg (&cursor, UNW_REG_IP, &ip) < 0) - return n; + return n; buffer[n++] = (void *) (uintptr_t) ip; } return n; diff --git a/src/mi/dyn-cancel.c b/src/mi/dyn-cancel.c index e784317f..9d7472d5 100644 --- a/src/mi/dyn-cancel.c +++ b/src/mi/dyn-cancel.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/dyn-info-list.c b/src/mi/dyn-info-list.c index 5a5e30ee..1a0790d3 100644 --- a/src/mi/dyn-info-list.c +++ b/src/mi/dyn-info-list.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/dyn-register.c b/src/mi/dyn-register.c index c28954a2..efdad3de 100644 --- a/src/mi/dyn-register.c +++ b/src/mi/dyn-register.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2001-2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -37,7 +37,7 @@ _U_dyn_register (unw_dyn_info_t *di) di->next = _U_dyn_info_list.first; di->prev = NULL; if (di->next) - di->next->prev = di; + di->next->prev = di; _U_dyn_info_list.first = di; } mutex_unlock (&_U_dyn_info_list_lock); diff --git a/src/mi/flush_cache.c b/src/mi/flush_cache.c index 2e88fa8b..513d1356 100644 --- a/src/mi/flush_cache.c +++ b/src/mi/flush_cache.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/init.c b/src/mi/init.c index 4bf97c48..057027e0 100644 --- a/src/mi/init.c +++ b/src/mi/init.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/mi/mempool.c b/src/mi/mempool.c index dbc183fa..536b64e8 100644 --- a/src/mi/mempool.c +++ b/src/mi/mempool.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2003, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Copyright (C) 2012 Tommi Rantala This file is part of libunwind. @@ -30,13 +30,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ * __BIGGEST_ALIGNMENT__, which is the largest alignment ever used for any data * type on the target machine you are compiling for.'' */ #ifdef __BIGGEST_ALIGNMENT__ -# define MAX_ALIGN __BIGGEST_ALIGNMENT__ +# define MAX_ALIGN __BIGGEST_ALIGNMENT__ #else /* Crude hack to check that MAX_ALIGN is power-of-two. * sizeof(long double) = 12 on i386. */ -# define MAX_ALIGN_(n) (n < 8 ? 8 : \ - n < 16 ? 16 : n) -# define MAX_ALIGN MAX_ALIGN_(sizeof (long double)) +# define MAX_ALIGN_(n) (n < 8 ? 8 : \ + n < 16 ? 16 : n) +# define MAX_ALIGN MAX_ALIGN_(sizeof (long double)) #endif static char sos_memory[SOS_MEMORY_SIZE] ALIGNED(MAX_ALIGN); @@ -64,9 +64,9 @@ sos_alloc (size_t size) /* No assumptions about `sos_memory' alignment. */ if (sos_memory_freepos == 0) { - unsigned align = UNW_ALIGN((uintptr_t) &sos_memory[0], MAX_ALIGN) - - (uintptr_t) &sos_memory[0]; - sos_memory_freepos = align; + unsigned align = UNW_ALIGN((uintptr_t) &sos_memory[0], MAX_ALIGN) + - (uintptr_t) &sos_memory[0]; + sos_memory_freepos = align; } pos = sos_memory_freepos; sos_memory_freepos += size; @@ -114,11 +114,11 @@ expand (struct mempool *pool) size = UNW_ALIGN(pool->obj_size, pg_size); GET_MEMORY (mem, size); if (!mem) - { - /* last chance: try to allocate one object from the SOS memory */ - size = pool->obj_size; - mem = sos_alloc (size); - } + { + /* last chance: try to allocate one object from the SOS memory */ + size = pool->obj_size; + mem = sos_alloc (size); + } } add_memory (pool, mem, size, pool->obj_size); } @@ -140,7 +140,7 @@ mempool_init (struct mempool *pool, size_t obj_size, size_t reserve) { reserve = pg_size / obj_size / 4; if (!reserve) - reserve = 16; + reserve = 16; } pool->obj_size = obj_size; diff --git a/src/mi/strerror.c b/src/mi/strerror.c index ef647160..2cec73d1 100644 --- a/src/mi/strerror.c +++ b/src/mi/strerror.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 BEA Systems - Contributed by Thomas Hallgren + Contributed by Thomas Hallgren This file is part of libunwind. @@ -34,18 +34,18 @@ unw_strerror (int err_code) unw_error_t error = (unw_error_t)-err_code; switch (error) { - case UNW_ESUCCESS: cp = "no error"; break; - case UNW_EUNSPEC: cp = "unspecified (general) error"; break; - case UNW_ENOMEM: cp = "out of memory"; break; - case UNW_EBADREG: cp = "bad register number"; break; + case UNW_ESUCCESS: cp = "no error"; break; + case UNW_EUNSPEC: cp = "unspecified (general) error"; break; + case UNW_ENOMEM: cp = "out of memory"; break; + case UNW_EBADREG: cp = "bad register number"; break; case UNW_EREADONLYREG: cp = "attempt to write read-only register"; break; case UNW_ESTOPUNWIND: cp = "stop unwinding"; break; case UNW_EINVALIDIP: cp = "invalid IP"; break; - case UNW_EBADFRAME: cp = "bad frame"; break; - case UNW_EINVAL: cp = "unsupported operation or bad value"; break; + case UNW_EBADFRAME: cp = "bad frame"; break; + case UNW_EINVAL: cp = "unsupported operation or bad value"; break; case UNW_EBADVERSION: cp = "unwind info has unsupported version"; break; - case UNW_ENOINFO: cp = "no unwind info found"; break; - default: cp = "invalid error code"; + case UNW_ENOINFO: cp = "no unwind info found"; break; + default: cp = "invalid error code"; } return cp; } diff --git a/src/mips/Gget_save_loc.c b/src/mips/Gget_save_loc.c index 0f90847a..d6075b76 100644 --- a/src/mips/Gget_save_loc.c +++ b/src/mips/Gget_save_loc.c @@ -32,7 +32,7 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) struct cursor *c = (struct cursor *) cursor; dwarf_loc_t loc; - loc = DWARF_NULL_LOC; /* default to "not saved" */ + loc = DWARF_NULL_LOC; /* default to "not saved" */ switch (reg) { diff --git a/src/mips/Gglobal.c b/src/mips/Gglobal.c index f2231573..fa9478ee 100644 --- a/src/mips/Gglobal.c +++ b/src/mips/Gglobal.c @@ -48,7 +48,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY mips_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&mips_lock, saved_mask); diff --git a/src/mips/Ginit.c b/src/mips/Ginit.c index dc9c1250..8290c408 100644 --- a/src/mips/Ginit.c +++ b/src/mips/Ginit.c @@ -84,7 +84,7 @@ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { *dyn_info_list_addr = (unw_word_t) (intptr_t) &_U_dyn_info_list; return 0; @@ -92,7 +92,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (write) { @@ -109,7 +109,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, - void *arg) + void *arg) { unw_word_t *addr; ucontext_t *uc = arg; @@ -140,7 +140,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = arg; unw_fpreg_t *addr; @@ -154,14 +154,14 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, if (write) { Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); *(unw_fpreg_t *) (intptr_t) addr = *val; } else { *val = *(unw_fpreg_t *) (intptr_t) addr; Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); } return 0; @@ -173,8 +173,8 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return elf_w (get_proc_name) (as, getpid (), ip, buf, buf_len, offp); diff --git a/src/mips/Gregs.c b/src/mips/Gregs.c index 0dfc4a93..26977767 100644 --- a/src/mips/Gregs.c +++ b/src/mips/Gregs.c @@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { dwarf_loc_t loc = DWARF_NULL_LOC; @@ -96,7 +96,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, - int write) + int write) { Debug (1, "bad register number %u\n", reg); return -UNW_EBADREG; diff --git a/src/mips/init.h b/src/mips/init.h index 95322c6b..74c3ab95 100644 --- a/src/mips/init.h +++ b/src/mips/init.h @@ -41,7 +41,7 @@ common_init (struct cursor *c, unsigned use_prev_instr) return ret; ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_MIPS_R29), - &c->dwarf.cfa); + &c->dwarf.cfa); if (ret < 0) return ret; diff --git a/src/mips/offsets.h b/src/mips/offsets.h index 49af9704..49cfc30f 100644 --- a/src/mips/offsets.h +++ b/src/mips/offsets.h @@ -11,32 +11,32 @@ #if _MIPS_SIM == _ABIO32 -# define LINUX_UC_FLAGS_OFF 0x0 -# define LINUX_UC_LINK_OFF 0x4 -# define LINUX_UC_STACK_OFF 0x8 -# define LINUX_UC_MCONTEXT_OFF 0x18 -# define LINUX_UC_SIGMASK_OFF 0x268 -# define LINUX_UC_MCONTEXT_PC 0x20 -# define LINUX_UC_MCONTEXT_GREGS 0x28 +# define LINUX_UC_FLAGS_OFF 0x0 +# define LINUX_UC_LINK_OFF 0x4 +# define LINUX_UC_STACK_OFF 0x8 +# define LINUX_UC_MCONTEXT_OFF 0x18 +# define LINUX_UC_SIGMASK_OFF 0x268 +# define LINUX_UC_MCONTEXT_PC 0x20 +# define LINUX_UC_MCONTEXT_GREGS 0x28 #elif _MIPS_SIM == _ABIN32 -# define LINUX_UC_FLAGS_OFF 0x0 -# define LINUX_UC_LINK_OFF 0x4 -# define LINUX_UC_STACK_OFF 0x8 -# define LINUX_UC_MCONTEXT_OFF 0x18 -# define LINUX_UC_SIGMASK_OFF 0x270 -# define LINUX_UC_MCONTEXT_PC 0x258 -# define LINUX_UC_MCONTEXT_GREGS 0x18 +# define LINUX_UC_FLAGS_OFF 0x0 +# define LINUX_UC_LINK_OFF 0x4 +# define LINUX_UC_STACK_OFF 0x8 +# define LINUX_UC_MCONTEXT_OFF 0x18 +# define LINUX_UC_SIGMASK_OFF 0x270 +# define LINUX_UC_MCONTEXT_PC 0x258 +# define LINUX_UC_MCONTEXT_GREGS 0x18 #elif _MIPS_SIM == _ABI64 -# define LINUX_UC_FLAGS_OFF 0x0 -# define LINUX_UC_LINK_OFF 0x8 -# define LINUX_UC_STACK_OFF 0x10 -# define LINUX_UC_MCONTEXT_OFF 0x28 -# define LINUX_UC_SIGMASK_OFF 0x280 -# define LINUX_UC_MCONTEXT_PC 0x268 -# define LINUX_UC_MCONTEXT_GREGS 0x28 +# define LINUX_UC_FLAGS_OFF 0x0 +# define LINUX_UC_LINK_OFF 0x8 +# define LINUX_UC_STACK_OFF 0x10 +# define LINUX_UC_MCONTEXT_OFF 0x28 +# define LINUX_UC_SIGMASK_OFF 0x280 +# define LINUX_UC_MCONTEXT_PC 0x268 +# define LINUX_UC_MCONTEXT_GREGS 0x28 #endif diff --git a/src/mips/unwind_i.h b/src/mips/unwind_i.h index fc9ab0b4..3382dcfe 100644 --- a/src/mips/unwind_i.h +++ b/src/mips/unwind_i.h @@ -31,12 +31,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" -#define mips_lock UNW_OBJ(lock) -#define mips_local_resume UNW_OBJ(local_resume) -#define mips_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define mips_lock UNW_OBJ(lock) +#define mips_local_resume UNW_OBJ(local_resume) +#define mips_local_addr_space_init UNW_OBJ(local_addr_space_init) extern int mips_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, - void *arg); + void *arg); extern void mips_local_addr_space_init (void); diff --git a/src/os-freebsd.c b/src/os-freebsd.c index 76cdd23c..1aa1e078 100644 --- a/src/os-freebsd.c +++ b/src/os-freebsd.c @@ -90,7 +90,7 @@ get_pid_by_tid(int tid) PROTECTED int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen) + unsigned long *segbase, unsigned long *mapoff, char *path, size_t pathlen) { int mib[4], error, ret; size_t len, len1; @@ -110,7 +110,7 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, if (mib[3] != -1) error = sysctl(mib, 4, NULL, &len, NULL, 0); if (error == -1) - return (-UNW_EUNSPEC); + return (-UNW_EUNSPEC); } else return (-UNW_EUNSPEC); } diff --git a/src/os-hpux.c b/src/os-hpux.c index 11b1177c..2ee6fa74 100644 --- a/src/os-hpux.c +++ b/src/os-hpux.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -33,8 +33,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen) + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen) { struct load_module_desc lmd; const char *path2; @@ -49,7 +49,7 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, return -UNW_ENOINFO; *segbase = lmd.text_base; - *mapoff = 0; /* XXX fix me? */ + *mapoff = 0; /* XXX fix me? */ path2 = dlgetname (&lmd, sizeof (lmd), NULL, 0, 0); if (!path2) diff --git a/src/os-linux.c b/src/os-linux.c index bcc40368..1cc9ba52 100644 --- a/src/os-linux.c +++ b/src/os-linux.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -31,8 +31,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ PROTECTED int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, - unsigned long *segbase, unsigned long *mapoff, - char *path, size_t pathlen) + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen) { struct map_iterator mi; int found = 0, rc; @@ -44,8 +44,8 @@ tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, while (maps_next (&mi, segbase, &hi, mapoff)) if (ip >= *segbase && ip < hi) { - found = 1; - break; + found = 1; + break; } if (!found) diff --git a/src/os-linux.h b/src/os-linux.h index ad9d675e..3976b38c 100644 --- a/src/os-linux.h +++ b/src/os-linux.h @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -78,19 +78,19 @@ maps_init (struct map_iterator *mi, pid_t pid) /* Try to allocate a page-sized buffer. */ mi->buf_size = getpagesize (); cp = mmap (NULL, mi->buf_size, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (cp == MAP_FAILED) - { - close(mi->fd); - mi->fd = -1; - return -1; - } + { + close(mi->fd); + mi->fd = -1; + return -1; + } else - { - mi->offset = 0; - mi->buf = mi->buf_end = cp + mi->buf_size; - return 0; - } + { + mi->offset = 0; + mi->buf = mi->buf_end = cp + mi->buf_size; + return 0; + } } return -1; } @@ -119,13 +119,13 @@ scan_hex (char *cp, unsigned long *valp) { digit = *cp; if ((digit - '0') <= 9) - digit -= '0'; + digit -= '0'; else if ((digit - 'a') < 6) - digit -= 'a' - 10; + digit -= 'a' - 10; else if ((digit - 'A') < 6) - digit -= 'A' - 10; + digit -= 'A' - 10; else - break; + break; val = (val << 4) | digit; ++num_digits; ++cp; @@ -148,12 +148,12 @@ scan_dec (char *cp, unsigned long *valp) { digit = *cp; if ((digit - '0') <= 9) - { - digit -= '0'; - ++cp; - } + { + digit -= '0'; + ++cp; + } else - break; + break; val = (10 * val) + digit; ++num_digits; } @@ -190,7 +190,7 @@ scan_string (char *cp, char *valp, size_t buf_size) while (*cp != ' ' && *cp != '\t' && *cp != '\0') { if ((valp != NULL) && (i < buf_size - 1)) - valp[i++] = *cp; + valp[i++] = *cp; ++cp; } if (i == 0 || i >= buf_size) @@ -201,7 +201,7 @@ scan_string (char *cp, char *valp, size_t buf_size) static inline int maps_next (struct map_iterator *mi, - unsigned long *low, unsigned long *high, unsigned long *offset) + unsigned long *low, unsigned long *high, unsigned long *offset) { char perm[16], dash = 0, colon = 0, *cp; unsigned long major, minor, inum; @@ -216,45 +216,45 @@ maps_next (struct map_iterator *mi, char *eol = NULL; for (i = 0; i < bytes_left; ++i) - { - if (mi->buf[i] == '\n') - { - eol = mi->buf + i; - break; - } - else if (mi->buf[i] == '\0') - break; - } + { + if (mi->buf[i] == '\n') + { + eol = mi->buf + i; + break; + } + else if (mi->buf[i] == '\0') + break; + } if (!eol) - { - /* copy down the remaining bytes, if any */ - if (bytes_left > 0) - memmove (mi->buf_end - mi->buf_size, mi->buf, bytes_left); + { + /* copy down the remaining bytes, if any */ + if (bytes_left > 0) + memmove (mi->buf_end - mi->buf_size, mi->buf, bytes_left); - mi->buf = mi->buf_end - mi->buf_size; - nread = read (mi->fd, mi->buf + bytes_left, - mi->buf_size - bytes_left); - if (nread <= 0) - return 0; - else if ((size_t) (nread + bytes_left) < mi->buf_size) - { - /* Move contents to the end of the buffer so we - maintain the invariant that all bytes between - mi->buf and mi->buf_end are valid. */ - memmove (mi->buf_end - nread - bytes_left, mi->buf, - nread + bytes_left); - mi->buf = mi->buf_end - nread - bytes_left; - } + mi->buf = mi->buf_end - mi->buf_size; + nread = read (mi->fd, mi->buf + bytes_left, + mi->buf_size - bytes_left); + if (nread <= 0) + return 0; + else if ((size_t) (nread + bytes_left) < mi->buf_size) + { + /* Move contents to the end of the buffer so we + maintain the invariant that all bytes between + mi->buf and mi->buf_end are valid. */ + memmove (mi->buf_end - nread - bytes_left, mi->buf, + nread + bytes_left); + mi->buf = mi->buf_end - nread - bytes_left; + } - eol = mi->buf + bytes_left + nread - 1; + eol = mi->buf + bytes_left + nread - 1; - for (i = bytes_left; i < bytes_left + nread; ++i) - if (mi->buf[i] == '\n') - { - eol = mi->buf + i; - break; - } - } + for (i = bytes_left; i < bytes_left + nread; ++i) + if (mi->buf[i] == '\n') + { + eol = mi->buf + i; + break; + } + } cp = mi->buf; mi->buf = eol + 1; *eol = '\0'; @@ -271,10 +271,10 @@ maps_next (struct map_iterator *mi, cp = scan_dec (cp, &inum); cp = mi->path = skip_whitespace (cp); if (!cp) - continue; + continue; cp = scan_string (cp, NULL, 0); if (dash != '-' || colon != ':') - continue; /* skip line with unknown or bad format */ + continue; /* skip line with unknown or bad format */ return 1; } return 0; diff --git a/src/os-qnx.c b/src/os-qnx.c index 0f745a0b..97bc7663 100644 --- a/src/os-qnx.c +++ b/src/os-qnx.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2013 Garmin International - Contributed by Matt Fischer + Contributed by Matt Fischer This file is part of libunwind. diff --git a/src/ppc/Gis_signal_frame.c b/src/ppc/Gis_signal_frame.c index b5e11e32..e8b69178 100644 --- a/src/ppc/Gis_signal_frame.c +++ b/src/ppc/Gis_signal_frame.c @@ -38,7 +38,7 @@ unw_is_signal_frame (unw_cursor_t * cursor) int ret; as = c->dwarf.as; - as->validate = 1; /* Don't trust the ip */ + as->validate = 1; /* Don't trust the ip */ arg = c->dwarf.as_arg; /* Check if return address points at sigreturn sequence. diff --git a/src/ppc32/Gglobal.c b/src/ppc32/Gglobal.c index e817e094..a0f80bee 100644 --- a/src/ppc32/Gglobal.c +++ b/src/ppc32/Gglobal.c @@ -35,77 +35,77 @@ HIDDEN int tdep_init_done; registers, for now at least. */ HIDDEN const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH] = { - [UNW_PPC32_R0]=UNW_PPC32_R0, - [UNW_PPC32_R1]=UNW_PPC32_R1, - [UNW_PPC32_R2]=UNW_PPC32_R2, - [UNW_PPC32_R3]=UNW_PPC32_R3, - [UNW_PPC32_R4]=UNW_PPC32_R4, - [UNW_PPC32_R5]=UNW_PPC32_R5, - [UNW_PPC32_R6]=UNW_PPC32_R6, - [UNW_PPC32_R7]=UNW_PPC32_R7, - [UNW_PPC32_R8]=UNW_PPC32_R8, - [UNW_PPC32_R9]=UNW_PPC32_R9, - [UNW_PPC32_R10]=UNW_PPC32_R10, - [UNW_PPC32_R11]=UNW_PPC32_R11, - [UNW_PPC32_R12]=UNW_PPC32_R12, - [UNW_PPC32_R13]=UNW_PPC32_R13, - [UNW_PPC32_R14]=UNW_PPC32_R14, - [UNW_PPC32_R15]=UNW_PPC32_R15, - [UNW_PPC32_R16]=UNW_PPC32_R16, - [UNW_PPC32_R17]=UNW_PPC32_R17, - [UNW_PPC32_R18]=UNW_PPC32_R18, - [UNW_PPC32_R19]=UNW_PPC32_R19, - [UNW_PPC32_R20]=UNW_PPC32_R20, - [UNW_PPC32_R21]=UNW_PPC32_R21, - [UNW_PPC32_R22]=UNW_PPC32_R22, - [UNW_PPC32_R23]=UNW_PPC32_R23, - [UNW_PPC32_R24]=UNW_PPC32_R24, - [UNW_PPC32_R25]=UNW_PPC32_R25, - [UNW_PPC32_R26]=UNW_PPC32_R26, - [UNW_PPC32_R27]=UNW_PPC32_R27, - [UNW_PPC32_R28]=UNW_PPC32_R28, - [UNW_PPC32_R29]=UNW_PPC32_R29, - [UNW_PPC32_R30]=UNW_PPC32_R30, - [UNW_PPC32_R31]=UNW_PPC32_R31, + [UNW_PPC32_R0]=UNW_PPC32_R0, + [UNW_PPC32_R1]=UNW_PPC32_R1, + [UNW_PPC32_R2]=UNW_PPC32_R2, + [UNW_PPC32_R3]=UNW_PPC32_R3, + [UNW_PPC32_R4]=UNW_PPC32_R4, + [UNW_PPC32_R5]=UNW_PPC32_R5, + [UNW_PPC32_R6]=UNW_PPC32_R6, + [UNW_PPC32_R7]=UNW_PPC32_R7, + [UNW_PPC32_R8]=UNW_PPC32_R8, + [UNW_PPC32_R9]=UNW_PPC32_R9, + [UNW_PPC32_R10]=UNW_PPC32_R10, + [UNW_PPC32_R11]=UNW_PPC32_R11, + [UNW_PPC32_R12]=UNW_PPC32_R12, + [UNW_PPC32_R13]=UNW_PPC32_R13, + [UNW_PPC32_R14]=UNW_PPC32_R14, + [UNW_PPC32_R15]=UNW_PPC32_R15, + [UNW_PPC32_R16]=UNW_PPC32_R16, + [UNW_PPC32_R17]=UNW_PPC32_R17, + [UNW_PPC32_R18]=UNW_PPC32_R18, + [UNW_PPC32_R19]=UNW_PPC32_R19, + [UNW_PPC32_R20]=UNW_PPC32_R20, + [UNW_PPC32_R21]=UNW_PPC32_R21, + [UNW_PPC32_R22]=UNW_PPC32_R22, + [UNW_PPC32_R23]=UNW_PPC32_R23, + [UNW_PPC32_R24]=UNW_PPC32_R24, + [UNW_PPC32_R25]=UNW_PPC32_R25, + [UNW_PPC32_R26]=UNW_PPC32_R26, + [UNW_PPC32_R27]=UNW_PPC32_R27, + [UNW_PPC32_R28]=UNW_PPC32_R28, + [UNW_PPC32_R29]=UNW_PPC32_R29, + [UNW_PPC32_R30]=UNW_PPC32_R30, + [UNW_PPC32_R31]=UNW_PPC32_R31, - [UNW_PPC32_CTR]=UNW_PPC32_CTR, - [UNW_PPC32_XER]=UNW_PPC32_XER, - [UNW_PPC32_CCR]=UNW_PPC32_CCR, - [UNW_PPC32_LR]=UNW_PPC32_LR, - [UNW_PPC32_FPSCR]=UNW_PPC32_FPSCR, + [UNW_PPC32_CTR]=UNW_PPC32_CTR, + [UNW_PPC32_XER]=UNW_PPC32_XER, + [UNW_PPC32_CCR]=UNW_PPC32_CCR, + [UNW_PPC32_LR]=UNW_PPC32_LR, + [UNW_PPC32_FPSCR]=UNW_PPC32_FPSCR, - [UNW_PPC32_F0]=UNW_PPC32_F0, - [UNW_PPC32_F1]=UNW_PPC32_F1, - [UNW_PPC32_F2]=UNW_PPC32_F2, - [UNW_PPC32_F3]=UNW_PPC32_F3, - [UNW_PPC32_F4]=UNW_PPC32_F4, - [UNW_PPC32_F5]=UNW_PPC32_F5, - [UNW_PPC32_F6]=UNW_PPC32_F6, - [UNW_PPC32_F7]=UNW_PPC32_F7, - [UNW_PPC32_F8]=UNW_PPC32_F8, - [UNW_PPC32_F9]=UNW_PPC32_F9, - [UNW_PPC32_F10]=UNW_PPC32_F10, - [UNW_PPC32_F11]=UNW_PPC32_F11, - [UNW_PPC32_F12]=UNW_PPC32_F12, - [UNW_PPC32_F13]=UNW_PPC32_F13, - [UNW_PPC32_F14]=UNW_PPC32_F14, - [UNW_PPC32_F15]=UNW_PPC32_F15, - [UNW_PPC32_F16]=UNW_PPC32_F16, - [UNW_PPC32_F17]=UNW_PPC32_F17, - [UNW_PPC32_F18]=UNW_PPC32_F18, - [UNW_PPC32_F19]=UNW_PPC32_F19, - [UNW_PPC32_F20]=UNW_PPC32_F20, - [UNW_PPC32_F21]=UNW_PPC32_F21, - [UNW_PPC32_F22]=UNW_PPC32_F22, - [UNW_PPC32_F23]=UNW_PPC32_F23, - [UNW_PPC32_F24]=UNW_PPC32_F24, - [UNW_PPC32_F25]=UNW_PPC32_F25, - [UNW_PPC32_F26]=UNW_PPC32_F26, - [UNW_PPC32_F27]=UNW_PPC32_F27, - [UNW_PPC32_F28]=UNW_PPC32_F28, - [UNW_PPC32_F29]=UNW_PPC32_F29, - [UNW_PPC32_F30]=UNW_PPC32_F30, - [UNW_PPC32_F31]=UNW_PPC32_F31, + [UNW_PPC32_F0]=UNW_PPC32_F0, + [UNW_PPC32_F1]=UNW_PPC32_F1, + [UNW_PPC32_F2]=UNW_PPC32_F2, + [UNW_PPC32_F3]=UNW_PPC32_F3, + [UNW_PPC32_F4]=UNW_PPC32_F4, + [UNW_PPC32_F5]=UNW_PPC32_F5, + [UNW_PPC32_F6]=UNW_PPC32_F6, + [UNW_PPC32_F7]=UNW_PPC32_F7, + [UNW_PPC32_F8]=UNW_PPC32_F8, + [UNW_PPC32_F9]=UNW_PPC32_F9, + [UNW_PPC32_F10]=UNW_PPC32_F10, + [UNW_PPC32_F11]=UNW_PPC32_F11, + [UNW_PPC32_F12]=UNW_PPC32_F12, + [UNW_PPC32_F13]=UNW_PPC32_F13, + [UNW_PPC32_F14]=UNW_PPC32_F14, + [UNW_PPC32_F15]=UNW_PPC32_F15, + [UNW_PPC32_F16]=UNW_PPC32_F16, + [UNW_PPC32_F17]=UNW_PPC32_F17, + [UNW_PPC32_F18]=UNW_PPC32_F18, + [UNW_PPC32_F19]=UNW_PPC32_F19, + [UNW_PPC32_F20]=UNW_PPC32_F20, + [UNW_PPC32_F21]=UNW_PPC32_F21, + [UNW_PPC32_F22]=UNW_PPC32_F22, + [UNW_PPC32_F23]=UNW_PPC32_F23, + [UNW_PPC32_F24]=UNW_PPC32_F24, + [UNW_PPC32_F25]=UNW_PPC32_F25, + [UNW_PPC32_F26]=UNW_PPC32_F26, + [UNW_PPC32_F27]=UNW_PPC32_F27, + [UNW_PPC32_F28]=UNW_PPC32_F28, + [UNW_PPC32_F29]=UNW_PPC32_F29, + [UNW_PPC32_F30]=UNW_PPC32_F30, + [UNW_PPC32_F31]=UNW_PPC32_F31, }; HIDDEN void @@ -128,7 +128,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY ppc32_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&ppc32_lock, saved_mask); diff --git a/src/ppc32/Ginit.c b/src/ppc32/Ginit.c index f4f215ef..f2e6e823 100644 --- a/src/ppc32/Ginit.c +++ b/src/ppc32/Ginit.c @@ -60,22 +60,22 @@ uc_addr (ucontext_t *uc, int reg) unsigned gregs_idx; switch (reg) - { - case UNW_PPC32_CTR: - gregs_idx = CTR_IDX; - break; - case UNW_PPC32_LR: - gregs_idx = LINK_IDX; - break; - case UNW_PPC32_XER: - gregs_idx = XER_IDX; - break; - case UNW_PPC32_CCR: - gregs_idx = CCR_IDX; - break; - default: - return NULL; - } + { + case UNW_PPC32_CTR: + gregs_idx = CTR_IDX; + break; + case UNW_PPC32_LR: + gregs_idx = LINK_IDX; + break; + case UNW_PPC32_XER: + gregs_idx = XER_IDX; + break; + case UNW_PPC32_CCR: + gregs_idx = CCR_IDX; + break; + default: + return NULL; + } addr = &uc->uc_mcontext.uc_regs->gregs[gregs_idx]; } return addr; @@ -89,7 +89,7 @@ tdep_uc_addr (ucontext_t *uc, int reg) return uc_addr (uc, reg); } -# endif /* UNW_LOCAL_ONLY */ +# endif /* UNW_LOCAL_ONLY */ HIDDEN unw_dyn_info_list_t _U_dyn_info_list; @@ -102,7 +102,7 @@ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; return 0; @@ -110,7 +110,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (write) { @@ -127,7 +127,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, - int write, void *arg) + int write, void *arg) { unw_word_t *addr; ucontext_t *uc = arg; @@ -159,7 +159,7 @@ badreg: static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = arg; unw_fpreg_t *addr; @@ -191,8 +191,8 @@ badreg: static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); } diff --git a/src/ppc32/Gregs.c b/src/ppc32/Gregs.c index 92be3216..9344455e 100644 --- a/src/ppc32/Gregs.c +++ b/src/ppc32/Gregs.c @@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { struct dwarf_loc loc; @@ -37,19 +37,19 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, { case UNW_TDEP_IP: if (write) - { - c->dwarf.ip = *valp; /* update the IP cache */ - if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip - || *valp >= c->dwarf.pi.end_ip)) - c->dwarf.pi_valid = 0; /* new IP outside of current proc */ - } + { + c->dwarf.ip = *valp; /* update the IP cache */ + if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip + || *valp >= c->dwarf.pi.end_ip)) + c->dwarf.pi_valid = 0; /* new IP outside of current proc */ + } else - *valp = c->dwarf.ip; + *valp = c->dwarf.ip; return 0; case UNW_TDEP_SP: if (write) - return -UNW_EREADONLYREG; + return -UNW_EREADONLYREG; *valp = c->dwarf.cfa; return 0; @@ -72,7 +72,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, - int write) + int write) { struct dwarf_loc loc; diff --git a/src/ppc32/Gresume.c b/src/ppc32/Gresume.c index 5446c980..955d061c 100644 --- a/src/ppc32/Gresume.c +++ b/src/ppc32/Gresume.c @@ -73,5 +73,5 @@ unw_resume (unw_cursor_t *cursor) return ret; return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, - c->dwarf.as_arg); + c->dwarf.as_arg); } diff --git a/src/ppc32/Gstep.c b/src/ppc32/Gstep.c index efb993a6..8506a618 100644 --- a/src/ppc32/Gstep.c +++ b/src/ppc32/Gstep.c @@ -80,48 +80,48 @@ unw_step (unw_cursor_t * cursor) if (unlikely (ret < 0)) { if (likely (!unw_is_signal_frame (cursor))) - { - /* DWARF unwinding failed. As of 09/26/2006, gcc in 64-bit mode - produces the mandatory level of traceback record in the code, but - I get the impression that this is transitory, that eventually gcc - will not produce any traceback records at all. So, for now, we - won't bother to try to find and use these records. + { + /* DWARF unwinding failed. As of 09/26/2006, gcc in 64-bit mode + produces the mandatory level of traceback record in the code, but + I get the impression that this is transitory, that eventually gcc + will not produce any traceback records at all. So, for now, we + won't bother to try to find and use these records. - We can, however, attempt to unwind the frame by using the callback - chain. This is very crude, however, and won't be able to unwind - any registers besides the IP, SP, and LR . */ + We can, however, attempt to unwind the frame by using the callback + chain. This is very crude, however, and won't be able to unwind + any registers besides the IP, SP, and LR . */ - back_chain_offset = ((void *) &dummy.back_chain - (void *) &dummy); - lr_save_offset = ((void *) &dummy.lr_save - (void *) &dummy); + back_chain_offset = ((void *) &dummy.back_chain - (void *) &dummy); + lr_save_offset = ((void *) &dummy.lr_save - (void *) &dummy); - back_chain_loc = DWARF_LOC (c->dwarf.cfa + back_chain_offset, 0); + back_chain_loc = DWARF_LOC (c->dwarf.cfa + back_chain_offset, 0); - if ((ret = - dwarf_get (&c->dwarf, back_chain_loc, &c->dwarf.cfa)) < 0) - { - Debug (2, - "Unable to retrieve CFA from back chain in stack frame - %d\n", - ret); - return ret; - } - if (c->dwarf.cfa == 0) - /* Unless the cursor or stack is corrupt or uninitialized we've most - likely hit the top of the stack */ - return 0; + if ((ret = + dwarf_get (&c->dwarf, back_chain_loc, &c->dwarf.cfa)) < 0) + { + Debug (2, + "Unable to retrieve CFA from back chain in stack frame - %d\n", + ret); + return ret; + } + if (c->dwarf.cfa == 0) + /* Unless the cursor or stack is corrupt or uninitialized we've most + likely hit the top of the stack */ + return 0; - lr_save_loc = DWARF_LOC (c->dwarf.cfa + lr_save_offset, 0); + lr_save_loc = DWARF_LOC (c->dwarf.cfa + lr_save_offset, 0); - if ((ret = dwarf_get (&c->dwarf, lr_save_loc, &c->dwarf.ip)) < 0) - { - Debug (2, - "Unable to retrieve IP from lr save in stack frame - %d\n", - ret); - return ret; - } - ret = 1; - } + if ((ret = dwarf_get (&c->dwarf, lr_save_loc, &c->dwarf.ip)) < 0) + { + Debug (2, + "Unable to retrieve IP from lr save in stack frame - %d\n", + ret); + return ret; + } + ret = 1; + } else - { + { /* Find the sigcontext record by taking the CFA and adjusting by the dummy signal frame size. @@ -132,178 +132,178 @@ unw_step (unw_cursor_t * cursor) following code will likely cause a seg fault or other crash condition. */ - unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE; + unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE; - Debug (1, "signal frame, skip over trampoline\n"); + Debug (1, "signal frame, skip over trampoline\n"); - c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME; - c->sigcontext_addr = ucontext; + c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME; + c->sigcontext_addr = ucontext; - sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); - ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0); + sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); + ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0); - ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa); - if (ret < 0) - { - Debug (2, "returning %d\n", ret); - return ret; - } - ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip); - if (ret < 0) - { - Debug (2, "returning %d\n", ret); - return ret; - } + ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } - /* Instead of just restoring the non-volatile registers, do all - of the registers for now. This will incur a performance hit, - but it's rare enough not to cause too much of a problem, and - might be useful in some cases. */ - c->dwarf.loc[UNW_PPC32_R0] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0); - c->dwarf.loc[UNW_PPC32_R1] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); - c->dwarf.loc[UNW_PPC32_R2] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0); - c->dwarf.loc[UNW_PPC32_R3] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0); - c->dwarf.loc[UNW_PPC32_R4] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0); - c->dwarf.loc[UNW_PPC32_R5] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0); - c->dwarf.loc[UNW_PPC32_R6] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0); - c->dwarf.loc[UNW_PPC32_R7] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0); - c->dwarf.loc[UNW_PPC32_R8] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0); - c->dwarf.loc[UNW_PPC32_R9] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0); - c->dwarf.loc[UNW_PPC32_R10] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0); - c->dwarf.loc[UNW_PPC32_R11] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0); - c->dwarf.loc[UNW_PPC32_R12] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0); - c->dwarf.loc[UNW_PPC32_R13] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0); - c->dwarf.loc[UNW_PPC32_R14] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0); - c->dwarf.loc[UNW_PPC32_R15] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0); - c->dwarf.loc[UNW_PPC32_R16] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0); - c->dwarf.loc[UNW_PPC32_R17] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0); - c->dwarf.loc[UNW_PPC32_R18] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0); - c->dwarf.loc[UNW_PPC32_R19] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0); - c->dwarf.loc[UNW_PPC32_R20] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0); - c->dwarf.loc[UNW_PPC32_R21] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0); - c->dwarf.loc[UNW_PPC32_R22] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0); - c->dwarf.loc[UNW_PPC32_R23] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0); - c->dwarf.loc[UNW_PPC32_R24] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0); - c->dwarf.loc[UNW_PPC32_R25] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0); - c->dwarf.loc[UNW_PPC32_R26] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0); - c->dwarf.loc[UNW_PPC32_R27] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0); - c->dwarf.loc[UNW_PPC32_R28] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0); - c->dwarf.loc[UNW_PPC32_R29] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0); - c->dwarf.loc[UNW_PPC32_R30] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0); - c->dwarf.loc[UNW_PPC32_R31] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0); + /* Instead of just restoring the non-volatile registers, do all + of the registers for now. This will incur a performance hit, + but it's rare enough not to cause too much of a problem, and + might be useful in some cases. */ + c->dwarf.loc[UNW_PPC32_R0] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0); + c->dwarf.loc[UNW_PPC32_R1] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); + c->dwarf.loc[UNW_PPC32_R2] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0); + c->dwarf.loc[UNW_PPC32_R3] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0); + c->dwarf.loc[UNW_PPC32_R4] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0); + c->dwarf.loc[UNW_PPC32_R5] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0); + c->dwarf.loc[UNW_PPC32_R6] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0); + c->dwarf.loc[UNW_PPC32_R7] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0); + c->dwarf.loc[UNW_PPC32_R8] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0); + c->dwarf.loc[UNW_PPC32_R9] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0); + c->dwarf.loc[UNW_PPC32_R10] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0); + c->dwarf.loc[UNW_PPC32_R11] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0); + c->dwarf.loc[UNW_PPC32_R12] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0); + c->dwarf.loc[UNW_PPC32_R13] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0); + c->dwarf.loc[UNW_PPC32_R14] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0); + c->dwarf.loc[UNW_PPC32_R15] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0); + c->dwarf.loc[UNW_PPC32_R16] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0); + c->dwarf.loc[UNW_PPC32_R17] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0); + c->dwarf.loc[UNW_PPC32_R18] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0); + c->dwarf.loc[UNW_PPC32_R19] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0); + c->dwarf.loc[UNW_PPC32_R20] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0); + c->dwarf.loc[UNW_PPC32_R21] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0); + c->dwarf.loc[UNW_PPC32_R22] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0); + c->dwarf.loc[UNW_PPC32_R23] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0); + c->dwarf.loc[UNW_PPC32_R24] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0); + c->dwarf.loc[UNW_PPC32_R25] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0); + c->dwarf.loc[UNW_PPC32_R26] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0); + c->dwarf.loc[UNW_PPC32_R27] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0); + c->dwarf.loc[UNW_PPC32_R28] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0); + c->dwarf.loc[UNW_PPC32_R29] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0); + c->dwarf.loc[UNW_PPC32_R30] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0); + c->dwarf.loc[UNW_PPC32_R31] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0); - c->dwarf.loc[UNW_PPC32_LR] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0); - c->dwarf.loc[UNW_PPC32_CTR] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0); + c->dwarf.loc[UNW_PPC32_LR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0); + c->dwarf.loc[UNW_PPC32_CTR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0); - /* This CR0 assignment is probably wrong. There are 8 dwarf columns - assigned to the CR registers, but only one CR register in the - mcontext structure */ - c->dwarf.loc[UNW_PPC32_CCR] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0); - c->dwarf.loc[UNW_PPC32_XER] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0); + /* This CR0 assignment is probably wrong. There are 8 dwarf columns + assigned to the CR registers, but only one CR register in the + mcontext structure */ + c->dwarf.loc[UNW_PPC32_CCR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0); + c->dwarf.loc[UNW_PPC32_XER] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0); - c->dwarf.loc[UNW_PPC32_F0] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0); - c->dwarf.loc[UNW_PPC32_F1] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0); - c->dwarf.loc[UNW_PPC32_F2] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0); - c->dwarf.loc[UNW_PPC32_F3] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0); - c->dwarf.loc[UNW_PPC32_F4] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0); - c->dwarf.loc[UNW_PPC32_F5] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0); - c->dwarf.loc[UNW_PPC32_F6] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0); - c->dwarf.loc[UNW_PPC32_F7] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0); - c->dwarf.loc[UNW_PPC32_F8] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0); - c->dwarf.loc[UNW_PPC32_F9] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0); - c->dwarf.loc[UNW_PPC32_F10] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0); - c->dwarf.loc[UNW_PPC32_F11] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0); - c->dwarf.loc[UNW_PPC32_F12] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0); - c->dwarf.loc[UNW_PPC32_F13] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0); - c->dwarf.loc[UNW_PPC32_F14] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0); - c->dwarf.loc[UNW_PPC32_F15] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0); - c->dwarf.loc[UNW_PPC32_F16] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0); - c->dwarf.loc[UNW_PPC32_F17] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0); - c->dwarf.loc[UNW_PPC32_F18] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0); - c->dwarf.loc[UNW_PPC32_F19] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0); - c->dwarf.loc[UNW_PPC32_F20] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0); - c->dwarf.loc[UNW_PPC32_F21] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0); - c->dwarf.loc[UNW_PPC32_F22] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0); - c->dwarf.loc[UNW_PPC32_F23] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0); - c->dwarf.loc[UNW_PPC32_F24] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0); - c->dwarf.loc[UNW_PPC32_F25] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0); - c->dwarf.loc[UNW_PPC32_F26] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0); - c->dwarf.loc[UNW_PPC32_F27] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0); - c->dwarf.loc[UNW_PPC32_F28] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0); - c->dwarf.loc[UNW_PPC32_F29] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0); - c->dwarf.loc[UNW_PPC32_F30] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0); - c->dwarf.loc[UNW_PPC32_F31] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0); + c->dwarf.loc[UNW_PPC32_F0] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0); + c->dwarf.loc[UNW_PPC32_F1] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0); + c->dwarf.loc[UNW_PPC32_F2] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0); + c->dwarf.loc[UNW_PPC32_F3] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0); + c->dwarf.loc[UNW_PPC32_F4] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0); + c->dwarf.loc[UNW_PPC32_F5] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0); + c->dwarf.loc[UNW_PPC32_F6] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0); + c->dwarf.loc[UNW_PPC32_F7] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0); + c->dwarf.loc[UNW_PPC32_F8] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0); + c->dwarf.loc[UNW_PPC32_F9] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0); + c->dwarf.loc[UNW_PPC32_F10] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0); + c->dwarf.loc[UNW_PPC32_F11] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0); + c->dwarf.loc[UNW_PPC32_F12] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0); + c->dwarf.loc[UNW_PPC32_F13] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0); + c->dwarf.loc[UNW_PPC32_F14] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0); + c->dwarf.loc[UNW_PPC32_F15] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0); + c->dwarf.loc[UNW_PPC32_F16] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0); + c->dwarf.loc[UNW_PPC32_F17] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0); + c->dwarf.loc[UNW_PPC32_F18] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0); + c->dwarf.loc[UNW_PPC32_F19] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0); + c->dwarf.loc[UNW_PPC32_F20] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0); + c->dwarf.loc[UNW_PPC32_F21] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0); + c->dwarf.loc[UNW_PPC32_F22] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0); + c->dwarf.loc[UNW_PPC32_F23] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0); + c->dwarf.loc[UNW_PPC32_F24] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0); + c->dwarf.loc[UNW_PPC32_F25] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0); + c->dwarf.loc[UNW_PPC32_F26] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0); + c->dwarf.loc[UNW_PPC32_F27] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0); + c->dwarf.loc[UNW_PPC32_F28] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0); + c->dwarf.loc[UNW_PPC32_F29] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0); + c->dwarf.loc[UNW_PPC32_F30] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0); + c->dwarf.loc[UNW_PPC32_F31] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0); - ret = 1; - } + ret = 1; + } } return ret; } diff --git a/src/ppc32/get_func_addr.c b/src/ppc32/get_func_addr.c index 14797c9b..66ff795f 100644 --- a/src/ppc32/get_func_addr.c +++ b/src/ppc32/get_func_addr.c @@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ int tdep_get_func_addr (unw_addr_space_t as, unw_word_t symbol_val_addr, - unw_word_t *real_func_addr) + unw_word_t *real_func_addr) { *real_func_addr = symbol_val_addr; return 0; diff --git a/src/ppc32/init.h b/src/ppc32/init.h index 4cb91920..e8bb3ba5 100644 --- a/src/ppc32/init.h +++ b/src/ppc32/init.h @@ -53,7 +53,7 @@ common_init_ppc32 (struct cursor *c, unsigned use_prev_instr) return ret; ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_PPC32_R1), - &c->dwarf.cfa); + &c->dwarf.cfa); if (ret < 0) return ret; diff --git a/src/ppc32/ucontext_i.h b/src/ppc32/ucontext_i.h index 11e4a570..c6ba806a 100644 --- a/src/ppc32/ucontext_i.h +++ b/src/ppc32/ucontext_i.h @@ -34,13 +34,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /usr/src/linux-2.6.18-1.8/arch/powerpc/kernel/ppc32.h */ -//#define NIP_IDX 32 -#define CTR_IDX 32 -#define XER_IDX 33 -#define CCR_IDX 34 -#define MSR_IDX 35 -//#define MQ_IDX 36 -#define LINK_IDX 36 +//#define NIP_IDX 32 +#define CTR_IDX 32 +#define XER_IDX 33 +#define CCR_IDX 34 +#define MSR_IDX 35 +//#define MQ_IDX 36 +#define LINK_IDX 36 /* These are dummy structures used only for obtaining the offsets of the various structure members. */ diff --git a/src/ppc32/unwind_i.h b/src/ppc32/unwind_i.h index 5f559bd8..ad32d056 100644 --- a/src/ppc32/unwind_i.h +++ b/src/ppc32/unwind_i.h @@ -35,12 +35,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include -#define ppc32_lock UNW_OBJ(lock) -#define ppc32_local_resume UNW_OBJ(local_resume) -#define ppc32_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define ppc32_lock UNW_OBJ(lock) +#define ppc32_local_resume UNW_OBJ(local_resume) +#define ppc32_local_addr_space_init UNW_OBJ(local_addr_space_init) extern void ppc32_local_addr_space_init (void); extern int ppc32_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, - void *arg); + void *arg); #endif /* unwind_i_h */ diff --git a/src/ppc64/Gglobal.c b/src/ppc64/Gglobal.c index 8b46c3d8..9d0b0f55 100644 --- a/src/ppc64/Gglobal.c +++ b/src/ppc64/Gglobal.c @@ -35,124 +35,124 @@ HIDDEN int tdep_init_done; registers, for now at least. */ HIDDEN const uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH] = { - [UNW_PPC64_R0]=UNW_PPC64_R0, - [UNW_PPC64_R1]=UNW_PPC64_R1, - [UNW_PPC64_R2]=UNW_PPC64_R2, - [UNW_PPC64_R3]=UNW_PPC64_R3, - [UNW_PPC64_R4]=UNW_PPC64_R4, - [UNW_PPC64_R5]=UNW_PPC64_R5, - [UNW_PPC64_R6]=UNW_PPC64_R6, - [UNW_PPC64_R7]=UNW_PPC64_R7, - [UNW_PPC64_R8]=UNW_PPC64_R8, - [UNW_PPC64_R9]=UNW_PPC64_R9, - [UNW_PPC64_R10]=UNW_PPC64_R10, - [UNW_PPC64_R11]=UNW_PPC64_R11, - [UNW_PPC64_R12]=UNW_PPC64_R12, - [UNW_PPC64_R13]=UNW_PPC64_R13, - [UNW_PPC64_R14]=UNW_PPC64_R14, - [UNW_PPC64_R15]=UNW_PPC64_R15, - [UNW_PPC64_R16]=UNW_PPC64_R16, - [UNW_PPC64_R17]=UNW_PPC64_R17, - [UNW_PPC64_R18]=UNW_PPC64_R18, - [UNW_PPC64_R19]=UNW_PPC64_R19, - [UNW_PPC64_R20]=UNW_PPC64_R20, - [UNW_PPC64_R21]=UNW_PPC64_R21, - [UNW_PPC64_R22]=UNW_PPC64_R22, - [UNW_PPC64_R23]=UNW_PPC64_R23, - [UNW_PPC64_R24]=UNW_PPC64_R24, - [UNW_PPC64_R25]=UNW_PPC64_R25, - [UNW_PPC64_R26]=UNW_PPC64_R26, - [UNW_PPC64_R27]=UNW_PPC64_R27, - [UNW_PPC64_R28]=UNW_PPC64_R28, - [UNW_PPC64_R29]=UNW_PPC64_R29, - [UNW_PPC64_R30]=UNW_PPC64_R30, - [UNW_PPC64_R31]=UNW_PPC64_R31, + [UNW_PPC64_R0]=UNW_PPC64_R0, + [UNW_PPC64_R1]=UNW_PPC64_R1, + [UNW_PPC64_R2]=UNW_PPC64_R2, + [UNW_PPC64_R3]=UNW_PPC64_R3, + [UNW_PPC64_R4]=UNW_PPC64_R4, + [UNW_PPC64_R5]=UNW_PPC64_R5, + [UNW_PPC64_R6]=UNW_PPC64_R6, + [UNW_PPC64_R7]=UNW_PPC64_R7, + [UNW_PPC64_R8]=UNW_PPC64_R8, + [UNW_PPC64_R9]=UNW_PPC64_R9, + [UNW_PPC64_R10]=UNW_PPC64_R10, + [UNW_PPC64_R11]=UNW_PPC64_R11, + [UNW_PPC64_R12]=UNW_PPC64_R12, + [UNW_PPC64_R13]=UNW_PPC64_R13, + [UNW_PPC64_R14]=UNW_PPC64_R14, + [UNW_PPC64_R15]=UNW_PPC64_R15, + [UNW_PPC64_R16]=UNW_PPC64_R16, + [UNW_PPC64_R17]=UNW_PPC64_R17, + [UNW_PPC64_R18]=UNW_PPC64_R18, + [UNW_PPC64_R19]=UNW_PPC64_R19, + [UNW_PPC64_R20]=UNW_PPC64_R20, + [UNW_PPC64_R21]=UNW_PPC64_R21, + [UNW_PPC64_R22]=UNW_PPC64_R22, + [UNW_PPC64_R23]=UNW_PPC64_R23, + [UNW_PPC64_R24]=UNW_PPC64_R24, + [UNW_PPC64_R25]=UNW_PPC64_R25, + [UNW_PPC64_R26]=UNW_PPC64_R26, + [UNW_PPC64_R27]=UNW_PPC64_R27, + [UNW_PPC64_R28]=UNW_PPC64_R28, + [UNW_PPC64_R29]=UNW_PPC64_R29, + [UNW_PPC64_R30]=UNW_PPC64_R30, + [UNW_PPC64_R31]=UNW_PPC64_R31, - [UNW_PPC64_F0]=UNW_PPC64_F0, - [UNW_PPC64_F1]=UNW_PPC64_F1, - [UNW_PPC64_F2]=UNW_PPC64_F2, - [UNW_PPC64_F3]=UNW_PPC64_F3, - [UNW_PPC64_F4]=UNW_PPC64_F4, - [UNW_PPC64_F5]=UNW_PPC64_F5, - [UNW_PPC64_F6]=UNW_PPC64_F6, - [UNW_PPC64_F7]=UNW_PPC64_F7, - [UNW_PPC64_F8]=UNW_PPC64_F8, - [UNW_PPC64_F9]=UNW_PPC64_F9, - [UNW_PPC64_F10]=UNW_PPC64_F10, - [UNW_PPC64_F11]=UNW_PPC64_F11, - [UNW_PPC64_F12]=UNW_PPC64_F12, - [UNW_PPC64_F13]=UNW_PPC64_F13, - [UNW_PPC64_F14]=UNW_PPC64_F14, - [UNW_PPC64_F15]=UNW_PPC64_F15, - [UNW_PPC64_F16]=UNW_PPC64_F16, - [UNW_PPC64_F17]=UNW_PPC64_F17, - [UNW_PPC64_F18]=UNW_PPC64_F18, - [UNW_PPC64_F19]=UNW_PPC64_F19, - [UNW_PPC64_F20]=UNW_PPC64_F20, - [UNW_PPC64_F21]=UNW_PPC64_F21, - [UNW_PPC64_F22]=UNW_PPC64_F22, - [UNW_PPC64_F23]=UNW_PPC64_F23, - [UNW_PPC64_F24]=UNW_PPC64_F24, - [UNW_PPC64_F25]=UNW_PPC64_F25, - [UNW_PPC64_F26]=UNW_PPC64_F26, - [UNW_PPC64_F27]=UNW_PPC64_F27, - [UNW_PPC64_F28]=UNW_PPC64_F28, - [UNW_PPC64_F29]=UNW_PPC64_F29, - [UNW_PPC64_F30]=UNW_PPC64_F30, - [UNW_PPC64_F31]=UNW_PPC64_F31, + [UNW_PPC64_F0]=UNW_PPC64_F0, + [UNW_PPC64_F1]=UNW_PPC64_F1, + [UNW_PPC64_F2]=UNW_PPC64_F2, + [UNW_PPC64_F3]=UNW_PPC64_F3, + [UNW_PPC64_F4]=UNW_PPC64_F4, + [UNW_PPC64_F5]=UNW_PPC64_F5, + [UNW_PPC64_F6]=UNW_PPC64_F6, + [UNW_PPC64_F7]=UNW_PPC64_F7, + [UNW_PPC64_F8]=UNW_PPC64_F8, + [UNW_PPC64_F9]=UNW_PPC64_F9, + [UNW_PPC64_F10]=UNW_PPC64_F10, + [UNW_PPC64_F11]=UNW_PPC64_F11, + [UNW_PPC64_F12]=UNW_PPC64_F12, + [UNW_PPC64_F13]=UNW_PPC64_F13, + [UNW_PPC64_F14]=UNW_PPC64_F14, + [UNW_PPC64_F15]=UNW_PPC64_F15, + [UNW_PPC64_F16]=UNW_PPC64_F16, + [UNW_PPC64_F17]=UNW_PPC64_F17, + [UNW_PPC64_F18]=UNW_PPC64_F18, + [UNW_PPC64_F19]=UNW_PPC64_F19, + [UNW_PPC64_F20]=UNW_PPC64_F20, + [UNW_PPC64_F21]=UNW_PPC64_F21, + [UNW_PPC64_F22]=UNW_PPC64_F22, + [UNW_PPC64_F23]=UNW_PPC64_F23, + [UNW_PPC64_F24]=UNW_PPC64_F24, + [UNW_PPC64_F25]=UNW_PPC64_F25, + [UNW_PPC64_F26]=UNW_PPC64_F26, + [UNW_PPC64_F27]=UNW_PPC64_F27, + [UNW_PPC64_F28]=UNW_PPC64_F28, + [UNW_PPC64_F29]=UNW_PPC64_F29, + [UNW_PPC64_F30]=UNW_PPC64_F30, + [UNW_PPC64_F31]=UNW_PPC64_F31, - [UNW_PPC64_LR]=UNW_PPC64_LR, - [UNW_PPC64_CTR]=UNW_PPC64_CTR, - [UNW_PPC64_ARG_POINTER]=UNW_PPC64_ARG_POINTER, + [UNW_PPC64_LR]=UNW_PPC64_LR, + [UNW_PPC64_CTR]=UNW_PPC64_CTR, + [UNW_PPC64_ARG_POINTER]=UNW_PPC64_ARG_POINTER, - [UNW_PPC64_CR0]=UNW_PPC64_CR0, - [UNW_PPC64_CR1]=UNW_PPC64_CR1, - [UNW_PPC64_CR2]=UNW_PPC64_CR2, - [UNW_PPC64_CR3]=UNW_PPC64_CR3, - [UNW_PPC64_CR4]=UNW_PPC64_CR4, - [UNW_PPC64_CR5]=UNW_PPC64_CR5, - [UNW_PPC64_CR6]=UNW_PPC64_CR6, - [UNW_PPC64_CR7]=UNW_PPC64_CR7, + [UNW_PPC64_CR0]=UNW_PPC64_CR0, + [UNW_PPC64_CR1]=UNW_PPC64_CR1, + [UNW_PPC64_CR2]=UNW_PPC64_CR2, + [UNW_PPC64_CR3]=UNW_PPC64_CR3, + [UNW_PPC64_CR4]=UNW_PPC64_CR4, + [UNW_PPC64_CR5]=UNW_PPC64_CR5, + [UNW_PPC64_CR6]=UNW_PPC64_CR6, + [UNW_PPC64_CR7]=UNW_PPC64_CR7, - [UNW_PPC64_XER]=UNW_PPC64_XER, + [UNW_PPC64_XER]=UNW_PPC64_XER, - [UNW_PPC64_V0]=UNW_PPC64_V0, - [UNW_PPC64_V1]=UNW_PPC64_V1, - [UNW_PPC64_V2]=UNW_PPC64_V2, - [UNW_PPC64_V3]=UNW_PPC64_V3, - [UNW_PPC64_V4]=UNW_PPC64_V4, - [UNW_PPC64_V5]=UNW_PPC64_V5, - [UNW_PPC64_V6]=UNW_PPC64_V6, - [UNW_PPC64_V7]=UNW_PPC64_V7, - [UNW_PPC64_V8]=UNW_PPC64_V8, - [UNW_PPC64_V9]=UNW_PPC64_V9, - [UNW_PPC64_V10]=UNW_PPC64_V10, - [UNW_PPC64_V11]=UNW_PPC64_V11, - [UNW_PPC64_V12]=UNW_PPC64_V12, - [UNW_PPC64_V13]=UNW_PPC64_V13, - [UNW_PPC64_V14]=UNW_PPC64_V14, - [UNW_PPC64_V15]=UNW_PPC64_V15, - [UNW_PPC64_V16]=UNW_PPC64_V16, - [UNW_PPC64_V17]=UNW_PPC64_V17, - [UNW_PPC64_V18]=UNW_PPC64_V18, - [UNW_PPC64_V19]=UNW_PPC64_V19, - [UNW_PPC64_V20]=UNW_PPC64_V20, - [UNW_PPC64_V21]=UNW_PPC64_V21, - [UNW_PPC64_V22]=UNW_PPC64_V22, - [UNW_PPC64_V23]=UNW_PPC64_V23, - [UNW_PPC64_V24]=UNW_PPC64_V24, - [UNW_PPC64_V25]=UNW_PPC64_V25, - [UNW_PPC64_V26]=UNW_PPC64_V26, - [UNW_PPC64_V27]=UNW_PPC64_V27, - [UNW_PPC64_V28]=UNW_PPC64_V28, - [UNW_PPC64_V29]=UNW_PPC64_V29, - [UNW_PPC64_V30]=UNW_PPC64_V30, - [UNW_PPC64_V31]=UNW_PPC64_V31, + [UNW_PPC64_V0]=UNW_PPC64_V0, + [UNW_PPC64_V1]=UNW_PPC64_V1, + [UNW_PPC64_V2]=UNW_PPC64_V2, + [UNW_PPC64_V3]=UNW_PPC64_V3, + [UNW_PPC64_V4]=UNW_PPC64_V4, + [UNW_PPC64_V5]=UNW_PPC64_V5, + [UNW_PPC64_V6]=UNW_PPC64_V6, + [UNW_PPC64_V7]=UNW_PPC64_V7, + [UNW_PPC64_V8]=UNW_PPC64_V8, + [UNW_PPC64_V9]=UNW_PPC64_V9, + [UNW_PPC64_V10]=UNW_PPC64_V10, + [UNW_PPC64_V11]=UNW_PPC64_V11, + [UNW_PPC64_V12]=UNW_PPC64_V12, + [UNW_PPC64_V13]=UNW_PPC64_V13, + [UNW_PPC64_V14]=UNW_PPC64_V14, + [UNW_PPC64_V15]=UNW_PPC64_V15, + [UNW_PPC64_V16]=UNW_PPC64_V16, + [UNW_PPC64_V17]=UNW_PPC64_V17, + [UNW_PPC64_V18]=UNW_PPC64_V18, + [UNW_PPC64_V19]=UNW_PPC64_V19, + [UNW_PPC64_V20]=UNW_PPC64_V20, + [UNW_PPC64_V21]=UNW_PPC64_V21, + [UNW_PPC64_V22]=UNW_PPC64_V22, + [UNW_PPC64_V23]=UNW_PPC64_V23, + [UNW_PPC64_V24]=UNW_PPC64_V24, + [UNW_PPC64_V25]=UNW_PPC64_V25, + [UNW_PPC64_V26]=UNW_PPC64_V26, + [UNW_PPC64_V27]=UNW_PPC64_V27, + [UNW_PPC64_V28]=UNW_PPC64_V28, + [UNW_PPC64_V29]=UNW_PPC64_V29, + [UNW_PPC64_V30]=UNW_PPC64_V30, + [UNW_PPC64_V31]=UNW_PPC64_V31, - [UNW_PPC64_VRSAVE]=UNW_PPC64_VRSAVE, - [UNW_PPC64_VSCR]=UNW_PPC64_VSCR, - [UNW_PPC64_SPE_ACC]=UNW_PPC64_SPE_ACC, - [UNW_PPC64_SPEFSCR]=UNW_PPC64_SPEFSCR, + [UNW_PPC64_VRSAVE]=UNW_PPC64_VRSAVE, + [UNW_PPC64_VSCR]=UNW_PPC64_VSCR, + [UNW_PPC64_SPE_ACC]=UNW_PPC64_SPE_ACC, + [UNW_PPC64_SPEFSCR]=UNW_PPC64_SPEFSCR, }; HIDDEN void @@ -175,7 +175,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY ppc64_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&ppc64_lock, saved_mask); diff --git a/src/ppc64/Ginit.c b/src/ppc64/Ginit.c index c338e4b4..1606c10b 100644 --- a/src/ppc64/Ginit.c +++ b/src/ppc64/Ginit.c @@ -61,25 +61,25 @@ uc_addr (ucontext_t *uc, int reg) unsigned gregs_idx; switch (reg) - { - case UNW_PPC64_NIP: - gregs_idx = NIP_IDX; - break; - case UNW_PPC64_CTR: - gregs_idx = CTR_IDX; - break; - case UNW_PPC64_LR: - gregs_idx = LINK_IDX; - break; - case UNW_PPC64_XER: - gregs_idx = XER_IDX; - break; - case UNW_PPC64_CR0: - gregs_idx = CCR_IDX; - break; - default: - return NULL; - } + { + case UNW_PPC64_NIP: + gregs_idx = NIP_IDX; + break; + case UNW_PPC64_CTR: + gregs_idx = CTR_IDX; + break; + case UNW_PPC64_LR: + gregs_idx = LINK_IDX; + break; + case UNW_PPC64_XER: + gregs_idx = XER_IDX; + break; + case UNW_PPC64_CR0: + gregs_idx = CCR_IDX; + break; + default: + return NULL; + } addr = &uc->uc_mcontext.gp_regs[gregs_idx]; } return addr; @@ -93,7 +93,7 @@ tdep_uc_addr (ucontext_t *uc, int reg) return uc_addr (uc, reg); } -# endif /* UNW_LOCAL_ONLY */ +# endif /* UNW_LOCAL_ONLY */ HIDDEN unw_dyn_info_list_t _U_dyn_info_list; @@ -106,7 +106,7 @@ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; return 0; @@ -114,7 +114,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (write) { @@ -131,7 +131,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, - int write, void *arg) + int write, void *arg) { unw_word_t *addr; ucontext_t *uc = arg; @@ -164,7 +164,7 @@ badreg: static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = arg; unw_fpreg_t *addr; @@ -200,8 +200,8 @@ badreg: static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); } diff --git a/src/ppc64/Gregs.c b/src/ppc64/Gregs.c index b044504b..a5785613 100644 --- a/src/ppc64/Gregs.c +++ b/src/ppc64/Gregs.c @@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { struct dwarf_loc loc; @@ -37,19 +37,19 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, { case UNW_TDEP_IP: if (write) - { - c->dwarf.ip = *valp; /* update the IP cache */ - if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip - || *valp >= c->dwarf.pi.end_ip)) - c->dwarf.pi_valid = 0; /* new IP outside of current proc */ - } + { + c->dwarf.ip = *valp; /* update the IP cache */ + if (c->dwarf.pi_valid && (*valp < c->dwarf.pi.start_ip + || *valp >= c->dwarf.pi.end_ip)) + c->dwarf.pi_valid = 0; /* new IP outside of current proc */ + } else - *valp = c->dwarf.ip; + *valp = c->dwarf.ip; return 0; case UNW_TDEP_SP: if (write) - return -UNW_EREADONLYREG; + return -UNW_EREADONLYREG; *valp = c->dwarf.cfa; return 0; @@ -73,7 +73,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, - int write) + int write) { struct dwarf_loc loc; diff --git a/src/ppc64/Gresume.c b/src/ppc64/Gresume.c index 893ea63c..8ff93bd2 100644 --- a/src/ppc64/Gresume.c +++ b/src/ppc64/Gresume.c @@ -73,5 +73,5 @@ unw_resume (unw_cursor_t *cursor) return ret; return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, - c->dwarf.as_arg); + c->dwarf.as_arg); } diff --git a/src/ppc64/Gstep.c b/src/ppc64/Gstep.c index e9ab39f8..038510fe 100644 --- a/src/ppc64/Gstep.c +++ b/src/ppc64/Gstep.c @@ -81,48 +81,48 @@ unw_step (unw_cursor_t * cursor) if (unlikely (ret < 0)) { if (likely (!unw_is_signal_frame (cursor))) - { - /* DWARF unwinding failed. As of 09/26/2006, gcc in 64-bit mode - produces the mandatory level of traceback record in the code, but - I get the impression that this is transitory, that eventually gcc - will not produce any traceback records at all. So, for now, we - won't bother to try to find and use these records. + { + /* DWARF unwinding failed. As of 09/26/2006, gcc in 64-bit mode + produces the mandatory level of traceback record in the code, but + I get the impression that this is transitory, that eventually gcc + will not produce any traceback records at all. So, for now, we + won't bother to try to find and use these records. - We can, however, attempt to unwind the frame by using the callback - chain. This is very crude, however, and won't be able to unwind - any registers besides the IP, SP, and LR . */ + We can, however, attempt to unwind the frame by using the callback + chain. This is very crude, however, and won't be able to unwind + any registers besides the IP, SP, and LR . */ - back_chain_offset = ((void *) &dummy.back_chain - (void *) &dummy); - lr_save_offset = ((void *) &dummy.lr_save - (void *) &dummy); + back_chain_offset = ((void *) &dummy.back_chain - (void *) &dummy); + lr_save_offset = ((void *) &dummy.lr_save - (void *) &dummy); - back_chain_loc = DWARF_LOC (c->dwarf.cfa + back_chain_offset, 0); + back_chain_loc = DWARF_LOC (c->dwarf.cfa + back_chain_offset, 0); - if ((ret = - dwarf_get (&c->dwarf, back_chain_loc, &c->dwarf.cfa)) < 0) - { - Debug (2, - "Unable to retrieve CFA from back chain in stack frame - %d\n", - ret); - return ret; - } - if (c->dwarf.cfa == 0) - /* Unless the cursor or stack is corrupt or uninitialized we've most - likely hit the top of the stack */ - return 0; + if ((ret = + dwarf_get (&c->dwarf, back_chain_loc, &c->dwarf.cfa)) < 0) + { + Debug (2, + "Unable to retrieve CFA from back chain in stack frame - %d\n", + ret); + return ret; + } + if (c->dwarf.cfa == 0) + /* Unless the cursor or stack is corrupt or uninitialized we've most + likely hit the top of the stack */ + return 0; - lr_save_loc = DWARF_LOC (c->dwarf.cfa + lr_save_offset, 0); + lr_save_loc = DWARF_LOC (c->dwarf.cfa + lr_save_offset, 0); - if ((ret = dwarf_get (&c->dwarf, lr_save_loc, &c->dwarf.ip)) < 0) - { - Debug (2, - "Unable to retrieve IP from lr save in stack frame - %d\n", - ret); - return ret; - } - ret = 1; - } + if ((ret = dwarf_get (&c->dwarf, lr_save_loc, &c->dwarf.ip)) < 0) + { + Debug (2, + "Unable to retrieve IP from lr save in stack frame - %d\n", + ret); + return ret; + } + ret = 1; + } else - { + { /* Find the sigcontext record by taking the CFA and adjusting by the dummy signal frame size. @@ -133,304 +133,304 @@ unw_step (unw_cursor_t * cursor) following code will likely cause a seg fault or other crash condition. */ - unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE; + unw_word_t ucontext = c->dwarf.cfa + __SIGNAL_FRAMESIZE; - Debug (1, "signal frame, skip over trampoline\n"); + Debug (1, "signal frame, skip over trampoline\n"); - c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME; - c->sigcontext_addr = ucontext; + c->sigcontext_format = PPC_SCF_LINUX_RT_SIGFRAME; + c->sigcontext_addr = ucontext; - sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); - ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0); + sp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); + ip_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0); - ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa); - if (ret < 0) - { - Debug (2, "returning %d\n", ret); - return ret; - } - ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip); - if (ret < 0) - { - Debug (2, "returning %d\n", ret); - return ret; - } + ret = dwarf_get (&c->dwarf, sp_loc, &c->dwarf.cfa); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + ret = dwarf_get (&c->dwarf, ip_loc, &c->dwarf.ip); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } - /* Instead of just restoring the non-volatile registers, do all - of the registers for now. This will incur a performance hit, - but it's rare enough not to cause too much of a problem, and - might be useful in some cases. */ - c->dwarf.loc[UNW_PPC64_R0] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0); - c->dwarf.loc[UNW_PPC64_R1] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); - c->dwarf.loc[UNW_PPC64_R2] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0); - c->dwarf.loc[UNW_PPC64_R3] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0); - c->dwarf.loc[UNW_PPC64_R4] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0); - c->dwarf.loc[UNW_PPC64_R5] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0); - c->dwarf.loc[UNW_PPC64_R6] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0); - c->dwarf.loc[UNW_PPC64_R7] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0); - c->dwarf.loc[UNW_PPC64_R8] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0); - c->dwarf.loc[UNW_PPC64_R9] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0); - c->dwarf.loc[UNW_PPC64_R10] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0); - c->dwarf.loc[UNW_PPC64_R11] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0); - c->dwarf.loc[UNW_PPC64_R12] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0); - c->dwarf.loc[UNW_PPC64_R13] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0); - c->dwarf.loc[UNW_PPC64_R14] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0); - c->dwarf.loc[UNW_PPC64_R15] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0); - c->dwarf.loc[UNW_PPC64_R16] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0); - c->dwarf.loc[UNW_PPC64_R17] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0); - c->dwarf.loc[UNW_PPC64_R18] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0); - c->dwarf.loc[UNW_PPC64_R19] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0); - c->dwarf.loc[UNW_PPC64_R20] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0); - c->dwarf.loc[UNW_PPC64_R21] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0); - c->dwarf.loc[UNW_PPC64_R22] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0); - c->dwarf.loc[UNW_PPC64_R23] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0); - c->dwarf.loc[UNW_PPC64_R24] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0); - c->dwarf.loc[UNW_PPC64_R25] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0); - c->dwarf.loc[UNW_PPC64_R26] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0); - c->dwarf.loc[UNW_PPC64_R27] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0); - c->dwarf.loc[UNW_PPC64_R28] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0); - c->dwarf.loc[UNW_PPC64_R29] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0); - c->dwarf.loc[UNW_PPC64_R30] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0); - c->dwarf.loc[UNW_PPC64_R31] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0); + /* Instead of just restoring the non-volatile registers, do all + of the registers for now. This will incur a performance hit, + but it's rare enough not to cause too much of a problem, and + might be useful in some cases. */ + c->dwarf.loc[UNW_PPC64_R0] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R0, 0); + c->dwarf.loc[UNW_PPC64_R1] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R1, 0); + c->dwarf.loc[UNW_PPC64_R2] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R2, 0); + c->dwarf.loc[UNW_PPC64_R3] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R3, 0); + c->dwarf.loc[UNW_PPC64_R4] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R4, 0); + c->dwarf.loc[UNW_PPC64_R5] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R5, 0); + c->dwarf.loc[UNW_PPC64_R6] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R6, 0); + c->dwarf.loc[UNW_PPC64_R7] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R7, 0); + c->dwarf.loc[UNW_PPC64_R8] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R8, 0); + c->dwarf.loc[UNW_PPC64_R9] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R9, 0); + c->dwarf.loc[UNW_PPC64_R10] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R10, 0); + c->dwarf.loc[UNW_PPC64_R11] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R11, 0); + c->dwarf.loc[UNW_PPC64_R12] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R12, 0); + c->dwarf.loc[UNW_PPC64_R13] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R13, 0); + c->dwarf.loc[UNW_PPC64_R14] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R14, 0); + c->dwarf.loc[UNW_PPC64_R15] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R15, 0); + c->dwarf.loc[UNW_PPC64_R16] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R16, 0); + c->dwarf.loc[UNW_PPC64_R17] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R17, 0); + c->dwarf.loc[UNW_PPC64_R18] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R18, 0); + c->dwarf.loc[UNW_PPC64_R19] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R19, 0); + c->dwarf.loc[UNW_PPC64_R20] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R20, 0); + c->dwarf.loc[UNW_PPC64_R21] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R21, 0); + c->dwarf.loc[UNW_PPC64_R22] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R22, 0); + c->dwarf.loc[UNW_PPC64_R23] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R23, 0); + c->dwarf.loc[UNW_PPC64_R24] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R24, 0); + c->dwarf.loc[UNW_PPC64_R25] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R25, 0); + c->dwarf.loc[UNW_PPC64_R26] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R26, 0); + c->dwarf.loc[UNW_PPC64_R27] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R27, 0); + c->dwarf.loc[UNW_PPC64_R28] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R28, 0); + c->dwarf.loc[UNW_PPC64_R29] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R29, 0); + c->dwarf.loc[UNW_PPC64_R30] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R30, 0); + c->dwarf.loc[UNW_PPC64_R31] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_R31, 0); - c->dwarf.loc[UNW_PPC64_LR] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0); - c->dwarf.loc[UNW_PPC64_CTR] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0); - /* This CR0 assignment is probably wrong. There are 8 dwarf columns - assigned to the CR registers, but only one CR register in the - mcontext structure */ - c->dwarf.loc[UNW_PPC64_CR0] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0); - c->dwarf.loc[UNW_PPC64_XER] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0); - c->dwarf.loc[UNW_PPC64_NIP] = - DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0); + c->dwarf.loc[UNW_PPC64_LR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_LINK, 0); + c->dwarf.loc[UNW_PPC64_CTR] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CTR, 0); + /* This CR0 assignment is probably wrong. There are 8 dwarf columns + assigned to the CR registers, but only one CR register in the + mcontext structure */ + c->dwarf.loc[UNW_PPC64_CR0] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_CCR, 0); + c->dwarf.loc[UNW_PPC64_XER] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_XER, 0); + c->dwarf.loc[UNW_PPC64_NIP] = + DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_NIP, 0); - /* TODO: Is there a way of obtaining the value of the - pseudo frame pointer (which is sp + some fixed offset, I - assume), based on the contents of the ucontext record - structure? For now, set this loc to null. */ - c->dwarf.loc[UNW_PPC64_FRAME_POINTER] = DWARF_NULL_LOC; + /* TODO: Is there a way of obtaining the value of the + pseudo frame pointer (which is sp + some fixed offset, I + assume), based on the contents of the ucontext record + structure? For now, set this loc to null. */ + c->dwarf.loc[UNW_PPC64_FRAME_POINTER] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_F0] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0); - c->dwarf.loc[UNW_PPC64_F1] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0); - c->dwarf.loc[UNW_PPC64_F2] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0); - c->dwarf.loc[UNW_PPC64_F3] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0); - c->dwarf.loc[UNW_PPC64_F4] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0); - c->dwarf.loc[UNW_PPC64_F5] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0); - c->dwarf.loc[UNW_PPC64_F6] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0); - c->dwarf.loc[UNW_PPC64_F7] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0); - c->dwarf.loc[UNW_PPC64_F8] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0); - c->dwarf.loc[UNW_PPC64_F9] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0); - c->dwarf.loc[UNW_PPC64_F10] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0); - c->dwarf.loc[UNW_PPC64_F11] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0); - c->dwarf.loc[UNW_PPC64_F12] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0); - c->dwarf.loc[UNW_PPC64_F13] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0); - c->dwarf.loc[UNW_PPC64_F14] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0); - c->dwarf.loc[UNW_PPC64_F15] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0); - c->dwarf.loc[UNW_PPC64_F16] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0); - c->dwarf.loc[UNW_PPC64_F17] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0); - c->dwarf.loc[UNW_PPC64_F18] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0); - c->dwarf.loc[UNW_PPC64_F19] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0); - c->dwarf.loc[UNW_PPC64_F20] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0); - c->dwarf.loc[UNW_PPC64_F21] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0); - c->dwarf.loc[UNW_PPC64_F22] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0); - c->dwarf.loc[UNW_PPC64_F23] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0); - c->dwarf.loc[UNW_PPC64_F24] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0); - c->dwarf.loc[UNW_PPC64_F25] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0); - c->dwarf.loc[UNW_PPC64_F26] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0); - c->dwarf.loc[UNW_PPC64_F27] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0); - c->dwarf.loc[UNW_PPC64_F28] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0); - c->dwarf.loc[UNW_PPC64_F29] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0); - c->dwarf.loc[UNW_PPC64_F30] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0); - c->dwarf.loc[UNW_PPC64_F31] = - DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0); - /* Note that there is no .eh_section register column for the - FPSCR register. I don't know why this is. */ + c->dwarf.loc[UNW_PPC64_F0] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R0, 0); + c->dwarf.loc[UNW_PPC64_F1] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R1, 0); + c->dwarf.loc[UNW_PPC64_F2] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R2, 0); + c->dwarf.loc[UNW_PPC64_F3] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R3, 0); + c->dwarf.loc[UNW_PPC64_F4] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R4, 0); + c->dwarf.loc[UNW_PPC64_F5] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R5, 0); + c->dwarf.loc[UNW_PPC64_F6] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R6, 0); + c->dwarf.loc[UNW_PPC64_F7] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R7, 0); + c->dwarf.loc[UNW_PPC64_F8] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R8, 0); + c->dwarf.loc[UNW_PPC64_F9] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R9, 0); + c->dwarf.loc[UNW_PPC64_F10] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R10, 0); + c->dwarf.loc[UNW_PPC64_F11] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R11, 0); + c->dwarf.loc[UNW_PPC64_F12] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R12, 0); + c->dwarf.loc[UNW_PPC64_F13] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R13, 0); + c->dwarf.loc[UNW_PPC64_F14] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R14, 0); + c->dwarf.loc[UNW_PPC64_F15] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R15, 0); + c->dwarf.loc[UNW_PPC64_F16] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R16, 0); + c->dwarf.loc[UNW_PPC64_F17] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R17, 0); + c->dwarf.loc[UNW_PPC64_F18] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R18, 0); + c->dwarf.loc[UNW_PPC64_F19] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R19, 0); + c->dwarf.loc[UNW_PPC64_F20] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R20, 0); + c->dwarf.loc[UNW_PPC64_F21] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R21, 0); + c->dwarf.loc[UNW_PPC64_F22] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R22, 0); + c->dwarf.loc[UNW_PPC64_F23] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R23, 0); + c->dwarf.loc[UNW_PPC64_F24] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R24, 0); + c->dwarf.loc[UNW_PPC64_F25] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R25, 0); + c->dwarf.loc[UNW_PPC64_F26] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R26, 0); + c->dwarf.loc[UNW_PPC64_F27] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R27, 0); + c->dwarf.loc[UNW_PPC64_F28] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R28, 0); + c->dwarf.loc[UNW_PPC64_F29] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R29, 0); + c->dwarf.loc[UNW_PPC64_F30] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R30, 0); + c->dwarf.loc[UNW_PPC64_F31] = + DWARF_LOC (ucontext + UC_MCONTEXT_FREGS_R31, 0); + /* Note that there is no .eh_section register column for the + FPSCR register. I don't know why this is. */ - v_regs_loc = DWARF_LOC (ucontext + UC_MCONTEXT_V_REGS, 0); - ret = dwarf_get (&c->dwarf, v_regs_loc, &v_regs_ptr); - if (ret < 0) - { - Debug (2, "returning %d\n", ret); - return ret; - } - if (v_regs_ptr != 0) - { - /* The v_regs_ptr is not null. Set all of the AltiVec locs */ + v_regs_loc = DWARF_LOC (ucontext + UC_MCONTEXT_V_REGS, 0); + ret = dwarf_get (&c->dwarf, v_regs_loc, &v_regs_ptr); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + if (v_regs_ptr != 0) + { + /* The v_regs_ptr is not null. Set all of the AltiVec locs */ - c->dwarf.loc[UNW_PPC64_V0] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R0, 0); - c->dwarf.loc[UNW_PPC64_V1] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R1, 0); - c->dwarf.loc[UNW_PPC64_V2] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R2, 0); - c->dwarf.loc[UNW_PPC64_V3] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R3, 0); - c->dwarf.loc[UNW_PPC64_V4] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R4, 0); - c->dwarf.loc[UNW_PPC64_V5] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R5, 0); - c->dwarf.loc[UNW_PPC64_V6] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R6, 0); - c->dwarf.loc[UNW_PPC64_V7] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R7, 0); - c->dwarf.loc[UNW_PPC64_V8] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R8, 0); - c->dwarf.loc[UNW_PPC64_V9] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R9, 0); - c->dwarf.loc[UNW_PPC64_V10] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R10, 0); - c->dwarf.loc[UNW_PPC64_V11] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R11, 0); - c->dwarf.loc[UNW_PPC64_V12] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R12, 0); - c->dwarf.loc[UNW_PPC64_V13] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R13, 0); - c->dwarf.loc[UNW_PPC64_V14] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R14, 0); - c->dwarf.loc[UNW_PPC64_V15] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R15, 0); - c->dwarf.loc[UNW_PPC64_V16] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R16, 0); - c->dwarf.loc[UNW_PPC64_V17] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R17, 0); - c->dwarf.loc[UNW_PPC64_V18] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R18, 0); - c->dwarf.loc[UNW_PPC64_V19] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R19, 0); - c->dwarf.loc[UNW_PPC64_V20] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R20, 0); - c->dwarf.loc[UNW_PPC64_V21] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R21, 0); - c->dwarf.loc[UNW_PPC64_V22] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R22, 0); - c->dwarf.loc[UNW_PPC64_V23] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R23, 0); - c->dwarf.loc[UNW_PPC64_V24] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R24, 0); - c->dwarf.loc[UNW_PPC64_V25] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R25, 0); - c->dwarf.loc[UNW_PPC64_V26] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R26, 0); - c->dwarf.loc[UNW_PPC64_V27] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R27, 0); - c->dwarf.loc[UNW_PPC64_V28] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R28, 0); - c->dwarf.loc[UNW_PPC64_V29] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R29, 0); - c->dwarf.loc[UNW_PPC64_V30] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R30, 0); - c->dwarf.loc[UNW_PPC64_V31] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R31, 0); - c->dwarf.loc[UNW_PPC64_VRSAVE] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VRSAVE, 0); - c->dwarf.loc[UNW_PPC64_VSCR] = - DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VSCR, 0); - } - else - { - c->dwarf.loc[UNW_PPC64_V0] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V1] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V2] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V3] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V4] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V5] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V6] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V7] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V8] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V9] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V10] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V11] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V12] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V13] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V14] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V15] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V16] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V17] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V18] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V19] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V20] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V21] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V22] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V23] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V24] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V25] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V26] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V27] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V28] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V29] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V30] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_V31] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_NULL_LOC; - c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_NULL_LOC; - } - ret = 1; - } + c->dwarf.loc[UNW_PPC64_V0] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R0, 0); + c->dwarf.loc[UNW_PPC64_V1] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R1, 0); + c->dwarf.loc[UNW_PPC64_V2] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R2, 0); + c->dwarf.loc[UNW_PPC64_V3] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R3, 0); + c->dwarf.loc[UNW_PPC64_V4] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R4, 0); + c->dwarf.loc[UNW_PPC64_V5] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R5, 0); + c->dwarf.loc[UNW_PPC64_V6] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R6, 0); + c->dwarf.loc[UNW_PPC64_V7] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R7, 0); + c->dwarf.loc[UNW_PPC64_V8] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R8, 0); + c->dwarf.loc[UNW_PPC64_V9] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R9, 0); + c->dwarf.loc[UNW_PPC64_V10] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R10, 0); + c->dwarf.loc[UNW_PPC64_V11] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R11, 0); + c->dwarf.loc[UNW_PPC64_V12] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R12, 0); + c->dwarf.loc[UNW_PPC64_V13] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R13, 0); + c->dwarf.loc[UNW_PPC64_V14] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R14, 0); + c->dwarf.loc[UNW_PPC64_V15] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R15, 0); + c->dwarf.loc[UNW_PPC64_V16] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R16, 0); + c->dwarf.loc[UNW_PPC64_V17] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R17, 0); + c->dwarf.loc[UNW_PPC64_V18] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R18, 0); + c->dwarf.loc[UNW_PPC64_V19] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R19, 0); + c->dwarf.loc[UNW_PPC64_V20] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R20, 0); + c->dwarf.loc[UNW_PPC64_V21] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R21, 0); + c->dwarf.loc[UNW_PPC64_V22] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R22, 0); + c->dwarf.loc[UNW_PPC64_V23] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R23, 0); + c->dwarf.loc[UNW_PPC64_V24] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R24, 0); + c->dwarf.loc[UNW_PPC64_V25] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R25, 0); + c->dwarf.loc[UNW_PPC64_V26] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R26, 0); + c->dwarf.loc[UNW_PPC64_V27] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R27, 0); + c->dwarf.loc[UNW_PPC64_V28] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R28, 0); + c->dwarf.loc[UNW_PPC64_V29] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R29, 0); + c->dwarf.loc[UNW_PPC64_V30] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R30, 0); + c->dwarf.loc[UNW_PPC64_V31] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_R31, 0); + c->dwarf.loc[UNW_PPC64_VRSAVE] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VRSAVE, 0); + c->dwarf.loc[UNW_PPC64_VSCR] = + DWARF_LOC (v_regs_ptr + UC_MCONTEXT_VREGS_VSCR, 0); + } + else + { + c->dwarf.loc[UNW_PPC64_V0] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V1] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V2] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V3] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V4] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V5] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V6] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V7] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V8] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V9] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V10] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V11] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V12] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V13] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V14] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V15] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V16] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V17] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V18] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V19] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V20] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V21] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V22] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V23] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V24] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V25] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V26] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V27] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V28] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V29] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V30] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_V31] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_VRSAVE] = DWARF_NULL_LOC; + c->dwarf.loc[UNW_PPC64_VSCR] = DWARF_NULL_LOC; + } + ret = 1; + } } return ret; } diff --git a/src/ppc64/get_func_addr.c b/src/ppc64/get_func_addr.c index 846ba4af..13abb7db 100644 --- a/src/ppc64/get_func_addr.c +++ b/src/ppc64/get_func_addr.c @@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ int tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr, - unw_word_t *entry_point) + unw_word_t *entry_point) { if (as->abi == UNW_PPC64_ABI_ELFv1) { @@ -42,7 +42,7 @@ tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr, below and read the word at addr + offset: */ ret = (*a->access_mem) (as, addr, entry_point, 0, NULL); if (ret < 0) - return ret; + return ret; } else *entry_point = addr; diff --git a/src/ppc64/init.h b/src/ppc64/init.h index 7503a7c7..22376e71 100644 --- a/src/ppc64/init.h +++ b/src/ppc64/init.h @@ -63,7 +63,7 @@ common_init_ppc64 (struct cursor *c, unsigned use_prev_instr) return ret; ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R1), - &c->dwarf.cfa); + &c->dwarf.cfa); if (ret < 0) return ret; diff --git a/src/ppc64/ucontext_i.h b/src/ppc64/ucontext_i.h index 245d6676..2ddfdb86 100644 --- a/src/ppc64/ucontext_i.h +++ b/src/ppc64/ucontext_i.h @@ -33,18 +33,18 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /usr/src/linux-2.6.18-1.8/arch/powerpc/kernel/ppc32.h */ -#define NIP_IDX 32 -#define MSR_IDX 33 -#define ORIG_GPR3_IDX 34 -#define CTR_IDX 35 -#define LINK_IDX 36 -#define XER_IDX 37 -#define CCR_IDX 38 -#define SOFTE_IDX 39 -#define TRAP_IDX 40 -#define DAR_IDX 41 -#define DSISR_IDX 42 -#define RESULT_IDX 43 +#define NIP_IDX 32 +#define MSR_IDX 33 +#define ORIG_GPR3_IDX 34 +#define CTR_IDX 35 +#define LINK_IDX 36 +#define XER_IDX 37 +#define CCR_IDX 38 +#define SOFTE_IDX 39 +#define TRAP_IDX 40 +#define DAR_IDX 41 +#define DSISR_IDX 42 +#define RESULT_IDX 43 #define VSCR_IDX 32 #define VRSAVE_IDX 33 diff --git a/src/ppc64/unwind_i.h b/src/ppc64/unwind_i.h index 206423e5..26bbc2df 100644 --- a/src/ppc64/unwind_i.h +++ b/src/ppc64/unwind_i.h @@ -35,16 +35,16 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include #include -#define ppc64_lock UNW_OBJ(lock) -#define ppc64_local_resume UNW_OBJ(local_resume) -#define ppc64_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define ppc64_lock UNW_OBJ(lock) +#define ppc64_local_resume UNW_OBJ(local_resume) +#define ppc64_local_addr_space_init UNW_OBJ(local_addr_space_init) #if 0 -#define ppc64_scratch_loc UNW_OBJ(scratch_loc) +#define ppc64_scratch_loc UNW_OBJ(scratch_loc) #endif extern void ppc64_local_addr_space_init (void); extern int ppc64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, - void *arg); + void *arg); #if 0 extern dwarf_loc_t ppc64_scratch_loc (struct cursor *c, unw_regnum_t reg); #endif diff --git a/src/ptrace/_UPT_access_fpreg.c b/src/ptrace/_UPT_access_fpreg.c index 40143775..e90ec47d 100644 --- a/src/ptrace/_UPT_access_fpreg.c +++ b/src/ptrace/_UPT_access_fpreg.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Copyright (C) 2010 Konstantin Belousov This file is part of libunwind. @@ -29,7 +29,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if HAVE_DECL_PTRACE_POKEUSER || HAVE_TTRACE int _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { unw_word_t *wp = (unw_word_t *) val; struct UPT_info *ui = arg; @@ -44,32 +44,32 @@ _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, for (i = 0; i < (int) (sizeof (*val) / sizeof (wp[i])); ++i) { #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg] + i * sizeof(wp[i]), - wp[i]); + ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg] + i * sizeof(wp[i]), + wp[i]); #endif - if (errno) - return -UNW_EBADREG; + if (errno) + return -UNW_EBADREG; } else for (i = 0; i < (int) (sizeof (*val) / sizeof (wp[i])); ++i) { #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - wp[i] = ptrace (PTRACE_PEEKUSER, pid, - _UPT_reg_offset[reg] + i * sizeof(wp[i]), 0); + wp[i] = ptrace (PTRACE_PEEKUSER, pid, + _UPT_reg_offset[reg] + i * sizeof(wp[i]), 0); #endif - if (errno) - return -UNW_EBADREG; + if (errno) + return -UNW_EBADREG; } return 0; } #elif HAVE_DECL_PT_GETFPREGS int _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { struct UPT_info *ui = arg; pid_t pid = ui->pid; @@ -79,22 +79,22 @@ _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, return -UNW_EBADREG; if (ptrace(PT_GETFPREGS, pid, (caddr_t)&fpreg, 0) == -1) - return -UNW_EBADREG; + return -UNW_EBADREG; if (write) { #if defined(__amd64__) - memcpy(&fpreg.fpr_xacc[reg], val, sizeof(unw_fpreg_t)); + memcpy(&fpreg.fpr_xacc[reg], val, sizeof(unw_fpreg_t)); #elif defined(__i386__) - memcpy(&fpreg.fpr_acc[reg], val, sizeof(unw_fpreg_t)); + memcpy(&fpreg.fpr_acc[reg], val, sizeof(unw_fpreg_t)); #else #error Fix me #endif - if (ptrace(PT_SETFPREGS, pid, (caddr_t)&fpreg, 0) == -1) - return -UNW_EBADREG; + if (ptrace(PT_SETFPREGS, pid, (caddr_t)&fpreg, 0) == -1) + return -UNW_EBADREG; } else #if defined(__amd64__) - memcpy(val, &fpreg.fpr_xacc[reg], sizeof(unw_fpreg_t)); + memcpy(val, &fpreg.fpr_xacc[reg], sizeof(unw_fpreg_t)); #elif defined(__i386__) - memcpy(val, &fpreg.fpr_acc[reg], sizeof(unw_fpreg_t)); + memcpy(val, &fpreg.fpr_acc[reg], sizeof(unw_fpreg_t)); #else #error Fix me #endif diff --git a/src/ptrace/_UPT_access_mem.c b/src/ptrace/_UPT_access_mem.c index 918a8f9e..ab93ce30 100644 --- a/src/ptrace/_UPT_access_mem.c +++ b/src/ptrace/_UPT_access_mem.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Copyright (C) 2010 Konstantin Belousov This file is part of libunwind. @@ -29,11 +29,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if HAVE_DECL_PTRACE_POKEDATA || HAVE_TTRACE int _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, - int write, void *arg) + int write, void *arg) { struct UPT_info *ui = arg; if (!ui) - return -UNW_EINVAL; + return -UNW_EINVAL; pid_t pid = ui->pid; @@ -42,21 +42,21 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, { Debug (16, "mem[%lx] <- %lx\n", (long) addr, (long) *val); #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else ptrace (PTRACE_POKEDATA, pid, addr, *val); if (errno) - return -UNW_EINVAL; + return -UNW_EINVAL; #endif } else { #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else *val = ptrace (PTRACE_PEEKDATA, pid, addr, 0); if (errno) - return -UNW_EINVAL; + return -UNW_EINVAL; #endif Debug (16, "mem[%lx] -> %lx\n", (long) addr, (long) *val); } @@ -65,11 +65,11 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, #elif HAVE_DECL_PT_IO int _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, - int write, void *arg) + int write, void *arg) { struct UPT_info *ui = arg; if (!ui) - return -UNW_EINVAL; + return -UNW_EINVAL; pid_t pid = ui->pid; struct ptrace_io_desc iod; diff --git a/src/ptrace/_UPT_access_reg.c b/src/ptrace/_UPT_access_reg.c index 782eeb70..ae71608b 100644 --- a/src/ptrace/_UPT_access_reg.c +++ b/src/ptrace/_UPT_access_reg.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Copyright (C) 2010 Konstantin Belousov This file is part of libunwind. @@ -37,7 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if HAVE_DECL_PTRACE_POKEUSER || HAVE_TTRACE int _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, - int write, void *arg) + int write, void *arg) { struct UPT_info *ui = arg; pid_t pid = ui->pid; @@ -58,170 +58,170 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, mask = ((unw_word_t) 1) << (reg - UNW_IA64_NAT); errno = 0; #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else nat_bits = ptrace (PTRACE_PEEKUSER, pid, PT_NAT_BITS, 0); if (errno) - goto badreg; + goto badreg; #endif if (write) - { - if (*val) - nat_bits |= mask; - else - nat_bits &= ~mask; + { + if (*val) + nat_bits |= mask; + else + nat_bits &= ~mask; #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - errno = 0; - ptrace (PTRACE_POKEUSER, pid, PT_NAT_BITS, nat_bits); - if (errno) - goto badreg; + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_NAT_BITS, nat_bits); + if (errno) + goto badreg; #endif - } + } goto out; } else switch (reg) { case UNW_IA64_GR + 0: - if (write) - goto badreg; - *val = 0; - return 0; + if (write) + goto badreg; + *val = 0; + return 0; case UNW_REG_IP: - { - unsigned long ip, psr; + { + unsigned long ip, psr; - /* distribute bundle-addr. & slot-number across PT_IIP & PT_IPSR. */ + /* distribute bundle-addr. & slot-number across PT_IIP & PT_IPSR. */ #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - errno = 0; - psr = ptrace (PTRACE_PEEKUSER, pid, PT_CR_IPSR, 0); - if (errno) - goto badreg; + errno = 0; + psr = ptrace (PTRACE_PEEKUSER, pid, PT_CR_IPSR, 0); + if (errno) + goto badreg; #endif - if (write) - { - ip = *val & ~0xfUL; - psr = (psr & ~0x3UL << 41) | (*val & 0x3); + if (write) + { + ip = *val & ~0xfUL; + psr = (psr & ~0x3UL << 41) | (*val & 0x3); #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - errno = 0; - ptrace (PTRACE_POKEUSER, pid, PT_CR_IIP, ip); - ptrace (PTRACE_POKEUSER, pid, PT_CR_IPSR, psr); - if (errno) - goto badreg; + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_CR_IIP, ip); + ptrace (PTRACE_POKEUSER, pid, PT_CR_IPSR, psr); + if (errno) + goto badreg; #endif - } - else - { + } + else + { #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - errno = 0; - ip = ptrace (PTRACE_PEEKUSER, pid, PT_CR_IIP, 0); - if (errno) - goto badreg; + errno = 0; + ip = ptrace (PTRACE_PEEKUSER, pid, PT_CR_IIP, 0); + if (errno) + goto badreg; #endif - *val = ip + ((psr >> 41) & 0x3); - } - goto out; - } + *val = ip + ((psr >> 41) & 0x3); + } + goto out; + } case UNW_IA64_AR_BSPSTORE: - reg = UNW_IA64_AR_BSP; - break; + reg = UNW_IA64_AR_BSP; + break; case UNW_IA64_AR_BSP: case UNW_IA64_BSP: - { - unsigned long sof, cfm, bsp; + { + unsigned long sof, cfm, bsp; #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - /* Account for the fact that ptrace() expects bsp to point - _after_ the current register frame. */ - errno = 0; - cfm = ptrace (PTRACE_PEEKUSER, pid, PT_CFM, 0); - if (errno) - goto badreg; + /* Account for the fact that ptrace() expects bsp to point + _after_ the current register frame. */ + errno = 0; + cfm = ptrace (PTRACE_PEEKUSER, pid, PT_CFM, 0); + if (errno) + goto badreg; #endif - sof = (cfm & 0x7f); + sof = (cfm & 0x7f); - if (write) - { - bsp = rse_skip_regs (*val, sof); + if (write) + { + bsp = rse_skip_regs (*val, sof); #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - errno = 0; - ptrace (PTRACE_POKEUSER, pid, PT_AR_BSP, bsp); - if (errno) - goto badreg; + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_AR_BSP, bsp); + if (errno) + goto badreg; #endif - } - else - { + } + else + { #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - errno = 0; - bsp = ptrace (PTRACE_PEEKUSER, pid, PT_AR_BSP, 0); - if (errno) - goto badreg; + errno = 0; + bsp = ptrace (PTRACE_PEEKUSER, pid, PT_AR_BSP, 0); + if (errno) + goto badreg; #endif - *val = rse_skip_regs (bsp, -sof); - } - goto out; - } + *val = rse_skip_regs (bsp, -sof); + } + goto out; + } case UNW_IA64_CFM: - /* If we change CFM, we need to adjust ptrace's notion of bsp - accordingly, so that the real bsp remains unchanged. */ - if (write) - { - unsigned long new_sof, old_sof, cfm, bsp; + /* If we change CFM, we need to adjust ptrace's notion of bsp + accordingly, so that the real bsp remains unchanged. */ + if (write) + { + unsigned long new_sof, old_sof, cfm, bsp; #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - errno = 0; - bsp = ptrace (PTRACE_PEEKUSER, pid, PT_AR_BSP, 0); - cfm = ptrace (PTRACE_PEEKUSER, pid, PT_CFM, 0); + errno = 0; + bsp = ptrace (PTRACE_PEEKUSER, pid, PT_AR_BSP, 0); + cfm = ptrace (PTRACE_PEEKUSER, pid, PT_CFM, 0); #endif - if (errno) - goto badreg; - old_sof = (cfm & 0x7f); - new_sof = (*val & 0x7f); - if (old_sof != new_sof) - { - bsp = rse_skip_regs (bsp, -old_sof + new_sof); + if (errno) + goto badreg; + old_sof = (cfm & 0x7f); + new_sof = (*val & 0x7f); + if (old_sof != new_sof) + { + bsp = rse_skip_regs (bsp, -old_sof + new_sof); #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - errno = 0; - ptrace (PTRACE_POKEUSER, pid, PT_AR_BSP, 0); - if (errno) - goto badreg; + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_AR_BSP, 0); + if (errno) + goto badreg; #endif - } + } #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else - errno = 0; - ptrace (PTRACE_POKEUSER, pid, PT_CFM, *val); - if (errno) - goto badreg; + errno = 0; + ptrace (PTRACE_POKEUSER, pid, PT_CFM, *val); + if (errno) + goto badreg; #endif - goto out; - } - break; + goto out; + } + break; } #endif /* End of IA64 */ @@ -235,7 +235,7 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, } #ifdef HAVE_TTRACE -# warning No support for ttrace() yet. +# warning No support for ttrace() yet. #else errno = 0; if (write) @@ -271,7 +271,7 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, #elif HAVE_DECL_PT_GETREGS int _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, - int write, void *arg) + int write, void *arg) { struct UPT_info *ui = arg; pid_t pid = ui->pid; diff --git a/src/ptrace/_UPT_accessors.c b/src/ptrace/_UPT_accessors.c index 3feb60bc..3190e789 100644 --- a/src/ptrace/_UPT_accessors.c +++ b/src/ptrace/_UPT_accessors.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,12 +27,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ PROTECTED unw_accessors_t _UPT_accessors = { - .find_proc_info = _UPT_find_proc_info, - .put_unwind_info = _UPT_put_unwind_info, - .get_dyn_info_list_addr = _UPT_get_dyn_info_list_addr, - .access_mem = _UPT_access_mem, - .access_reg = _UPT_access_reg, - .access_fpreg = _UPT_access_fpreg, - .resume = _UPT_resume, - .get_proc_name = _UPT_get_proc_name + .find_proc_info = _UPT_find_proc_info, + .put_unwind_info = _UPT_put_unwind_info, + .get_dyn_info_list_addr = _UPT_get_dyn_info_list_addr, + .access_mem = _UPT_access_mem, + .access_reg = _UPT_access_reg, + .access_fpreg = _UPT_access_fpreg, + .resume = _UPT_resume, + .get_proc_name = _UPT_get_proc_name }; diff --git a/src/ptrace/_UPT_create.c b/src/ptrace/_UPT_create.c index f6a41583..dd59e974 100644 --- a/src/ptrace/_UPT_create.c +++ b/src/ptrace/_UPT_create.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/ptrace/_UPT_destroy.c b/src/ptrace/_UPT_destroy.c index 04ea22d2..edb664ce 100644 --- a/src/ptrace/_UPT_destroy.c +++ b/src/ptrace/_UPT_destroy.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/ptrace/_UPT_elf.c b/src/ptrace/_UPT_elf.c index cf0480f2..efc43b57 100644 --- a/src/ptrace/_UPT_elf.c +++ b/src/ptrace/_UPT_elf.c @@ -1,5 +1,5 @@ /* We need to get a separate copy of the ELF-code into libunwind-ptrace since it cannot (and must not) have any ELF dependencies on libunwind. */ -#include "libunwind_i.h" /* get ELFCLASS defined */ +#include "libunwind_i.h" /* get ELFCLASS defined */ #include "../elfxx.c" diff --git a/src/ptrace/_UPT_find_proc_info.c b/src/ptrace/_UPT_find_proc_info.c index 53dd1e7f..d2a37eac 100644 --- a/src/ptrace/_UPT_find_proc_info.c +++ b/src/ptrace/_UPT_find_proc_info.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -91,7 +91,7 @@ get_unwind_info (struct elf_dyn_info *edi, pid_t pid, unw_addr_space_t as, unw_w int _UPT_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, - int need_unwind_info, void *arg) + int need_unwind_info, void *arg) { struct UPT_info *ui = arg; int ret = -UNW_ENOINFO; @@ -103,33 +103,33 @@ _UPT_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, if (ui->edi.ktab.format != -1) { /* The kernel unwind table resides in local memory, so we have - to use the local address space to search it. Since - _UPT_put_unwind_info() has no easy way of detecting this - case, we simply make a copy of the unwind-info, so - _UPT_put_unwind_info() can always free() the unwind-info - without ill effects. */ + to use the local address space to search it. Since + _UPT_put_unwind_info() has no easy way of detecting this + case, we simply make a copy of the unwind-info, so + _UPT_put_unwind_info() can always free() the unwind-info + without ill effects. */ ret = tdep_search_unwind_table (unw_local_addr_space, ip, &ui->edi.ktab, pi, - need_unwind_info, arg); + need_unwind_info, arg); if (ret >= 0) - { - if (!need_unwind_info) - pi->unwind_info = NULL; - else - { - void *mem = malloc (pi->unwind_info_size); + { + if (!need_unwind_info) + pi->unwind_info = NULL; + else + { + void *mem = malloc (pi->unwind_info_size); - if (!mem) - return -UNW_ENOMEM; - memcpy (mem, pi->unwind_info, pi->unwind_info_size); - pi->unwind_info = mem; - } - } + if (!mem) + return -UNW_ENOMEM; + memcpy (mem, pi->unwind_info, pi->unwind_info_size); + pi->unwind_info = mem; + } + } } #endif if (ret == -UNW_ENOINFO && ui->edi.di_cache.format != -1) ret = tdep_search_unwind_table (as, ip, &ui->edi.di_cache, - pi, need_unwind_info, arg); + pi, need_unwind_info, arg); #if UNW_TARGET_ARM if (ret == -UNW_ENOINFO && ui->edi.di_arm.format != -1) @@ -139,7 +139,7 @@ _UPT_find_proc_info (unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi, if (ret == -UNW_ENOINFO && ui->edi.di_debug.format != -1) ret = tdep_search_unwind_table (as, ip, &ui->edi.di_debug, pi, - need_unwind_info, arg); + need_unwind_info, arg); return ret; } diff --git a/src/ptrace/_UPT_get_dyn_info_list_addr.c b/src/ptrace/_UPT_get_dyn_info_list_addr.c index edc998fd..cc5ed044 100644 --- a/src/ptrace/_UPT_get_dyn_info_list_addr.c +++ b/src/ptrace/_UPT_get_dyn_info_list_addr.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -31,7 +31,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ static inline int get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, - int *countp) + int *countp) { unsigned long lo, hi, off; struct UPT_info *ui = arg; @@ -44,25 +44,25 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, while (maps_next (&mi, &lo, &hi, &off)) { if (off) - continue; + continue; invalidate_edi(&ui->edi); if (elf_map_image (&ui->edi.ei, path) < 0) - /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */ - continue; + /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */ + continue; Debug (16, "checking object %s\n", path); if (tdep_find_unwind_table (&ui->edi, as, path, lo, off, 0) > 0) - { - res = _Uia64_find_dyn_list (as, &ui->edi.di_cache, arg); - if (res && count++ == 0) - { - Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res); - *dil_addr = res; - } - } + { + res = _Uia64_find_dyn_list (as, &ui->edi.di_cache, arg); + if (res && count++ == 0) + { + Debug (12, "dyn_info_list_addr = 0x%lx\n", (long) res); + *dil_addr = res; + } + } } maps_close (&mi); *countp = count; @@ -73,7 +73,7 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, static inline int get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, - int *countp) + int *countp) { # warning Implement get_list_addr(), please. *countp = 0; @@ -84,7 +84,7 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg, int _UPT_get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, - void *arg) + void *arg) { int count, ret; diff --git a/src/ptrace/_UPT_get_proc_name.c b/src/ptrace/_UPT_get_proc_name.c index 6ac85a0a..79c1f38e 100644 --- a/src/ptrace/_UPT_get_proc_name.c +++ b/src/ptrace/_UPT_get_proc_name.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ int _UPT_get_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, void *arg) + char *buf, size_t buf_len, unw_word_t *offp, void *arg) { struct UPT_info *ui = arg; diff --git a/src/ptrace/_UPT_internal.h b/src/ptrace/_UPT_internal.h index 2283dc41..5cef2573 100644 --- a/src/ptrace/_UPT_internal.h +++ b/src/ptrace/_UPT_internal.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -50,7 +50,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ struct UPT_info { - pid_t pid; /* the process-id of the child we're unwinding */ + pid_t pid; /* the process-id of the child we're unwinding */ struct elf_dyn_info edi; }; diff --git a/src/ptrace/_UPT_put_unwind_info.c b/src/ptrace/_UPT_put_unwind_info.c index 852dd868..d4b84631 100644 --- a/src/ptrace/_UPT_put_unwind_info.c +++ b/src/ptrace/_UPT_put_unwind_info.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/ptrace/_UPT_reg_offset.c b/src/ptrace/_UPT_reg_offset.c index 88fcb9ca..68461a2f 100644 --- a/src/ptrace/_UPT_reg_offset.c +++ b/src/ptrace/_UPT_reg_offset.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Copyright (C) 2013 Linaro Limited This file is part of libunwind. @@ -36,223 +36,223 @@ const int _UPT_reg_offset[UNW_REG_LAST + 1] = { #ifdef HAVE_ASM_PTRACE_OFFSETS_H # ifndef PT_AR_CSD -# define PT_AR_CSD -1 /* this was introduced with rev 2.1 of ia64 */ +# define PT_AR_CSD -1 /* this was introduced with rev 2.1 of ia64 */ # endif - [UNW_IA64_GR + 0] = -1, [UNW_IA64_GR + 1] = PT_R1, - [UNW_IA64_GR + 2] = PT_R2, [UNW_IA64_GR + 3] = PT_R3, - [UNW_IA64_GR + 4] = PT_R4, [UNW_IA64_GR + 5] = PT_R5, - [UNW_IA64_GR + 6] = PT_R6, [UNW_IA64_GR + 7] = PT_R7, - [UNW_IA64_GR + 8] = PT_R8, [UNW_IA64_GR + 9] = PT_R9, - [UNW_IA64_GR + 10] = PT_R10, [UNW_IA64_GR + 11] = PT_R11, - [UNW_IA64_GR + 12] = PT_R12, [UNW_IA64_GR + 13] = PT_R13, - [UNW_IA64_GR + 14] = PT_R14, [UNW_IA64_GR + 15] = PT_R15, - [UNW_IA64_GR + 16] = PT_R16, [UNW_IA64_GR + 17] = PT_R17, - [UNW_IA64_GR + 18] = PT_R18, [UNW_IA64_GR + 19] = PT_R19, - [UNW_IA64_GR + 20] = PT_R20, [UNW_IA64_GR + 21] = PT_R21, - [UNW_IA64_GR + 22] = PT_R22, [UNW_IA64_GR + 23] = PT_R23, - [UNW_IA64_GR + 24] = PT_R24, [UNW_IA64_GR + 25] = PT_R25, - [UNW_IA64_GR + 26] = PT_R26, [UNW_IA64_GR + 27] = PT_R27, - [UNW_IA64_GR + 28] = PT_R28, [UNW_IA64_GR + 29] = PT_R29, - [UNW_IA64_GR + 30] = PT_R30, [UNW_IA64_GR + 31] = PT_R31, + [UNW_IA64_GR + 0] = -1, [UNW_IA64_GR + 1] = PT_R1, + [UNW_IA64_GR + 2] = PT_R2, [UNW_IA64_GR + 3] = PT_R3, + [UNW_IA64_GR + 4] = PT_R4, [UNW_IA64_GR + 5] = PT_R5, + [UNW_IA64_GR + 6] = PT_R6, [UNW_IA64_GR + 7] = PT_R7, + [UNW_IA64_GR + 8] = PT_R8, [UNW_IA64_GR + 9] = PT_R9, + [UNW_IA64_GR + 10] = PT_R10, [UNW_IA64_GR + 11] = PT_R11, + [UNW_IA64_GR + 12] = PT_R12, [UNW_IA64_GR + 13] = PT_R13, + [UNW_IA64_GR + 14] = PT_R14, [UNW_IA64_GR + 15] = PT_R15, + [UNW_IA64_GR + 16] = PT_R16, [UNW_IA64_GR + 17] = PT_R17, + [UNW_IA64_GR + 18] = PT_R18, [UNW_IA64_GR + 19] = PT_R19, + [UNW_IA64_GR + 20] = PT_R20, [UNW_IA64_GR + 21] = PT_R21, + [UNW_IA64_GR + 22] = PT_R22, [UNW_IA64_GR + 23] = PT_R23, + [UNW_IA64_GR + 24] = PT_R24, [UNW_IA64_GR + 25] = PT_R25, + [UNW_IA64_GR + 26] = PT_R26, [UNW_IA64_GR + 27] = PT_R27, + [UNW_IA64_GR + 28] = PT_R28, [UNW_IA64_GR + 29] = PT_R29, + [UNW_IA64_GR + 30] = PT_R30, [UNW_IA64_GR + 31] = PT_R31, - [UNW_IA64_NAT+ 0] = -1, [UNW_IA64_NAT+ 1] = PT_NAT_BITS, - [UNW_IA64_NAT+ 2] = PT_NAT_BITS, [UNW_IA64_NAT+ 3] = PT_NAT_BITS, - [UNW_IA64_NAT+ 4] = PT_NAT_BITS, [UNW_IA64_NAT+ 5] = PT_NAT_BITS, - [UNW_IA64_NAT+ 6] = PT_NAT_BITS, [UNW_IA64_NAT+ 7] = PT_NAT_BITS, - [UNW_IA64_NAT+ 8] = PT_NAT_BITS, [UNW_IA64_NAT+ 9] = PT_NAT_BITS, - [UNW_IA64_NAT+ 10] = PT_NAT_BITS, [UNW_IA64_NAT+ 11] = PT_NAT_BITS, - [UNW_IA64_NAT+ 12] = PT_NAT_BITS, [UNW_IA64_NAT+ 13] = PT_NAT_BITS, - [UNW_IA64_NAT+ 14] = PT_NAT_BITS, [UNW_IA64_NAT+ 15] = PT_NAT_BITS, - [UNW_IA64_NAT+ 16] = PT_NAT_BITS, [UNW_IA64_NAT+ 17] = PT_NAT_BITS, - [UNW_IA64_NAT+ 18] = PT_NAT_BITS, [UNW_IA64_NAT+ 19] = PT_NAT_BITS, - [UNW_IA64_NAT+ 20] = PT_NAT_BITS, [UNW_IA64_NAT+ 21] = PT_NAT_BITS, - [UNW_IA64_NAT+ 22] = PT_NAT_BITS, [UNW_IA64_NAT+ 23] = PT_NAT_BITS, - [UNW_IA64_NAT+ 24] = PT_NAT_BITS, [UNW_IA64_NAT+ 25] = PT_NAT_BITS, - [UNW_IA64_NAT+ 26] = PT_NAT_BITS, [UNW_IA64_NAT+ 27] = PT_NAT_BITS, - [UNW_IA64_NAT+ 28] = PT_NAT_BITS, [UNW_IA64_NAT+ 29] = PT_NAT_BITS, - [UNW_IA64_NAT+ 30] = PT_NAT_BITS, [UNW_IA64_NAT+ 31] = PT_NAT_BITS, + [UNW_IA64_NAT+ 0] = -1, [UNW_IA64_NAT+ 1] = PT_NAT_BITS, + [UNW_IA64_NAT+ 2] = PT_NAT_BITS, [UNW_IA64_NAT+ 3] = PT_NAT_BITS, + [UNW_IA64_NAT+ 4] = PT_NAT_BITS, [UNW_IA64_NAT+ 5] = PT_NAT_BITS, + [UNW_IA64_NAT+ 6] = PT_NAT_BITS, [UNW_IA64_NAT+ 7] = PT_NAT_BITS, + [UNW_IA64_NAT+ 8] = PT_NAT_BITS, [UNW_IA64_NAT+ 9] = PT_NAT_BITS, + [UNW_IA64_NAT+ 10] = PT_NAT_BITS, [UNW_IA64_NAT+ 11] = PT_NAT_BITS, + [UNW_IA64_NAT+ 12] = PT_NAT_BITS, [UNW_IA64_NAT+ 13] = PT_NAT_BITS, + [UNW_IA64_NAT+ 14] = PT_NAT_BITS, [UNW_IA64_NAT+ 15] = PT_NAT_BITS, + [UNW_IA64_NAT+ 16] = PT_NAT_BITS, [UNW_IA64_NAT+ 17] = PT_NAT_BITS, + [UNW_IA64_NAT+ 18] = PT_NAT_BITS, [UNW_IA64_NAT+ 19] = PT_NAT_BITS, + [UNW_IA64_NAT+ 20] = PT_NAT_BITS, [UNW_IA64_NAT+ 21] = PT_NAT_BITS, + [UNW_IA64_NAT+ 22] = PT_NAT_BITS, [UNW_IA64_NAT+ 23] = PT_NAT_BITS, + [UNW_IA64_NAT+ 24] = PT_NAT_BITS, [UNW_IA64_NAT+ 25] = PT_NAT_BITS, + [UNW_IA64_NAT+ 26] = PT_NAT_BITS, [UNW_IA64_NAT+ 27] = PT_NAT_BITS, + [UNW_IA64_NAT+ 28] = PT_NAT_BITS, [UNW_IA64_NAT+ 29] = PT_NAT_BITS, + [UNW_IA64_NAT+ 30] = PT_NAT_BITS, [UNW_IA64_NAT+ 31] = PT_NAT_BITS, - [UNW_IA64_FR + 0] = -1, [UNW_IA64_FR + 1] = -1, - [UNW_IA64_FR + 2] = PT_F2, [UNW_IA64_FR + 3] = PT_F3, - [UNW_IA64_FR + 4] = PT_F4, [UNW_IA64_FR + 5] = PT_F5, - [UNW_IA64_FR + 6] = PT_F6, [UNW_IA64_FR + 7] = PT_F7, - [UNW_IA64_FR + 8] = PT_F8, [UNW_IA64_FR + 9] = PT_F9, - [UNW_IA64_FR + 10] = PT_F10, [UNW_IA64_FR + 11] = PT_F11, - [UNW_IA64_FR + 12] = PT_F12, [UNW_IA64_FR + 13] = PT_F13, - [UNW_IA64_FR + 14] = PT_F14, [UNW_IA64_FR + 15] = PT_F15, - [UNW_IA64_FR + 16] = PT_F16, [UNW_IA64_FR + 17] = PT_F17, - [UNW_IA64_FR + 18] = PT_F18, [UNW_IA64_FR + 19] = PT_F19, - [UNW_IA64_FR + 20] = PT_F20, [UNW_IA64_FR + 21] = PT_F21, - [UNW_IA64_FR + 22] = PT_F22, [UNW_IA64_FR + 23] = PT_F23, - [UNW_IA64_FR + 24] = PT_F24, [UNW_IA64_FR + 25] = PT_F25, - [UNW_IA64_FR + 26] = PT_F26, [UNW_IA64_FR + 27] = PT_F27, - [UNW_IA64_FR + 28] = PT_F28, [UNW_IA64_FR + 29] = PT_F29, - [UNW_IA64_FR + 30] = PT_F30, [UNW_IA64_FR + 31] = PT_F31, - [UNW_IA64_FR + 32] = PT_F32, [UNW_IA64_FR + 33] = PT_F33, - [UNW_IA64_FR + 34] = PT_F34, [UNW_IA64_FR + 35] = PT_F35, - [UNW_IA64_FR + 36] = PT_F36, [UNW_IA64_FR + 37] = PT_F37, - [UNW_IA64_FR + 38] = PT_F38, [UNW_IA64_FR + 39] = PT_F39, - [UNW_IA64_FR + 40] = PT_F40, [UNW_IA64_FR + 41] = PT_F41, - [UNW_IA64_FR + 42] = PT_F42, [UNW_IA64_FR + 43] = PT_F43, - [UNW_IA64_FR + 44] = PT_F44, [UNW_IA64_FR + 45] = PT_F45, - [UNW_IA64_FR + 46] = PT_F46, [UNW_IA64_FR + 47] = PT_F47, - [UNW_IA64_FR + 48] = PT_F48, [UNW_IA64_FR + 49] = PT_F49, - [UNW_IA64_FR + 50] = PT_F50, [UNW_IA64_FR + 51] = PT_F51, - [UNW_IA64_FR + 52] = PT_F52, [UNW_IA64_FR + 53] = PT_F53, - [UNW_IA64_FR + 54] = PT_F54, [UNW_IA64_FR + 55] = PT_F55, - [UNW_IA64_FR + 56] = PT_F56, [UNW_IA64_FR + 57] = PT_F57, - [UNW_IA64_FR + 58] = PT_F58, [UNW_IA64_FR + 59] = PT_F59, - [UNW_IA64_FR + 60] = PT_F60, [UNW_IA64_FR + 61] = PT_F61, - [UNW_IA64_FR + 62] = PT_F62, [UNW_IA64_FR + 63] = PT_F63, - [UNW_IA64_FR + 64] = PT_F64, [UNW_IA64_FR + 65] = PT_F65, - [UNW_IA64_FR + 66] = PT_F66, [UNW_IA64_FR + 67] = PT_F67, - [UNW_IA64_FR + 68] = PT_F68, [UNW_IA64_FR + 69] = PT_F69, - [UNW_IA64_FR + 70] = PT_F70, [UNW_IA64_FR + 71] = PT_F71, - [UNW_IA64_FR + 72] = PT_F72, [UNW_IA64_FR + 73] = PT_F73, - [UNW_IA64_FR + 74] = PT_F74, [UNW_IA64_FR + 75] = PT_F75, - [UNW_IA64_FR + 76] = PT_F76, [UNW_IA64_FR + 77] = PT_F77, - [UNW_IA64_FR + 78] = PT_F78, [UNW_IA64_FR + 79] = PT_F79, - [UNW_IA64_FR + 80] = PT_F80, [UNW_IA64_FR + 81] = PT_F81, - [UNW_IA64_FR + 82] = PT_F82, [UNW_IA64_FR + 83] = PT_F83, - [UNW_IA64_FR + 84] = PT_F84, [UNW_IA64_FR + 85] = PT_F85, - [UNW_IA64_FR + 86] = PT_F86, [UNW_IA64_FR + 87] = PT_F87, - [UNW_IA64_FR + 88] = PT_F88, [UNW_IA64_FR + 89] = PT_F89, - [UNW_IA64_FR + 90] = PT_F90, [UNW_IA64_FR + 91] = PT_F91, - [UNW_IA64_FR + 92] = PT_F92, [UNW_IA64_FR + 93] = PT_F93, - [UNW_IA64_FR + 94] = PT_F94, [UNW_IA64_FR + 95] = PT_F95, - [UNW_IA64_FR + 96] = PT_F96, [UNW_IA64_FR + 97] = PT_F97, - [UNW_IA64_FR + 98] = PT_F98, [UNW_IA64_FR + 99] = PT_F99, - [UNW_IA64_FR +100] = PT_F100, [UNW_IA64_FR +101] = PT_F101, - [UNW_IA64_FR +102] = PT_F102, [UNW_IA64_FR +103] = PT_F103, - [UNW_IA64_FR +104] = PT_F104, [UNW_IA64_FR +105] = PT_F105, - [UNW_IA64_FR +106] = PT_F106, [UNW_IA64_FR +107] = PT_F107, - [UNW_IA64_FR +108] = PT_F108, [UNW_IA64_FR +109] = PT_F109, - [UNW_IA64_FR +110] = PT_F110, [UNW_IA64_FR +111] = PT_F111, - [UNW_IA64_FR +112] = PT_F112, [UNW_IA64_FR +113] = PT_F113, - [UNW_IA64_FR +114] = PT_F114, [UNW_IA64_FR +115] = PT_F115, - [UNW_IA64_FR +116] = PT_F116, [UNW_IA64_FR +117] = PT_F117, - [UNW_IA64_FR +118] = PT_F118, [UNW_IA64_FR +119] = PT_F119, - [UNW_IA64_FR +120] = PT_F120, [UNW_IA64_FR +121] = PT_F121, - [UNW_IA64_FR +122] = PT_F122, [UNW_IA64_FR +123] = PT_F123, - [UNW_IA64_FR +124] = PT_F124, [UNW_IA64_FR +125] = PT_F125, - [UNW_IA64_FR +126] = PT_F126, [UNW_IA64_FR +127] = PT_F127, + [UNW_IA64_FR + 0] = -1, [UNW_IA64_FR + 1] = -1, + [UNW_IA64_FR + 2] = PT_F2, [UNW_IA64_FR + 3] = PT_F3, + [UNW_IA64_FR + 4] = PT_F4, [UNW_IA64_FR + 5] = PT_F5, + [UNW_IA64_FR + 6] = PT_F6, [UNW_IA64_FR + 7] = PT_F7, + [UNW_IA64_FR + 8] = PT_F8, [UNW_IA64_FR + 9] = PT_F9, + [UNW_IA64_FR + 10] = PT_F10, [UNW_IA64_FR + 11] = PT_F11, + [UNW_IA64_FR + 12] = PT_F12, [UNW_IA64_FR + 13] = PT_F13, + [UNW_IA64_FR + 14] = PT_F14, [UNW_IA64_FR + 15] = PT_F15, + [UNW_IA64_FR + 16] = PT_F16, [UNW_IA64_FR + 17] = PT_F17, + [UNW_IA64_FR + 18] = PT_F18, [UNW_IA64_FR + 19] = PT_F19, + [UNW_IA64_FR + 20] = PT_F20, [UNW_IA64_FR + 21] = PT_F21, + [UNW_IA64_FR + 22] = PT_F22, [UNW_IA64_FR + 23] = PT_F23, + [UNW_IA64_FR + 24] = PT_F24, [UNW_IA64_FR + 25] = PT_F25, + [UNW_IA64_FR + 26] = PT_F26, [UNW_IA64_FR + 27] = PT_F27, + [UNW_IA64_FR + 28] = PT_F28, [UNW_IA64_FR + 29] = PT_F29, + [UNW_IA64_FR + 30] = PT_F30, [UNW_IA64_FR + 31] = PT_F31, + [UNW_IA64_FR + 32] = PT_F32, [UNW_IA64_FR + 33] = PT_F33, + [UNW_IA64_FR + 34] = PT_F34, [UNW_IA64_FR + 35] = PT_F35, + [UNW_IA64_FR + 36] = PT_F36, [UNW_IA64_FR + 37] = PT_F37, + [UNW_IA64_FR + 38] = PT_F38, [UNW_IA64_FR + 39] = PT_F39, + [UNW_IA64_FR + 40] = PT_F40, [UNW_IA64_FR + 41] = PT_F41, + [UNW_IA64_FR + 42] = PT_F42, [UNW_IA64_FR + 43] = PT_F43, + [UNW_IA64_FR + 44] = PT_F44, [UNW_IA64_FR + 45] = PT_F45, + [UNW_IA64_FR + 46] = PT_F46, [UNW_IA64_FR + 47] = PT_F47, + [UNW_IA64_FR + 48] = PT_F48, [UNW_IA64_FR + 49] = PT_F49, + [UNW_IA64_FR + 50] = PT_F50, [UNW_IA64_FR + 51] = PT_F51, + [UNW_IA64_FR + 52] = PT_F52, [UNW_IA64_FR + 53] = PT_F53, + [UNW_IA64_FR + 54] = PT_F54, [UNW_IA64_FR + 55] = PT_F55, + [UNW_IA64_FR + 56] = PT_F56, [UNW_IA64_FR + 57] = PT_F57, + [UNW_IA64_FR + 58] = PT_F58, [UNW_IA64_FR + 59] = PT_F59, + [UNW_IA64_FR + 60] = PT_F60, [UNW_IA64_FR + 61] = PT_F61, + [UNW_IA64_FR + 62] = PT_F62, [UNW_IA64_FR + 63] = PT_F63, + [UNW_IA64_FR + 64] = PT_F64, [UNW_IA64_FR + 65] = PT_F65, + [UNW_IA64_FR + 66] = PT_F66, [UNW_IA64_FR + 67] = PT_F67, + [UNW_IA64_FR + 68] = PT_F68, [UNW_IA64_FR + 69] = PT_F69, + [UNW_IA64_FR + 70] = PT_F70, [UNW_IA64_FR + 71] = PT_F71, + [UNW_IA64_FR + 72] = PT_F72, [UNW_IA64_FR + 73] = PT_F73, + [UNW_IA64_FR + 74] = PT_F74, [UNW_IA64_FR + 75] = PT_F75, + [UNW_IA64_FR + 76] = PT_F76, [UNW_IA64_FR + 77] = PT_F77, + [UNW_IA64_FR + 78] = PT_F78, [UNW_IA64_FR + 79] = PT_F79, + [UNW_IA64_FR + 80] = PT_F80, [UNW_IA64_FR + 81] = PT_F81, + [UNW_IA64_FR + 82] = PT_F82, [UNW_IA64_FR + 83] = PT_F83, + [UNW_IA64_FR + 84] = PT_F84, [UNW_IA64_FR + 85] = PT_F85, + [UNW_IA64_FR + 86] = PT_F86, [UNW_IA64_FR + 87] = PT_F87, + [UNW_IA64_FR + 88] = PT_F88, [UNW_IA64_FR + 89] = PT_F89, + [UNW_IA64_FR + 90] = PT_F90, [UNW_IA64_FR + 91] = PT_F91, + [UNW_IA64_FR + 92] = PT_F92, [UNW_IA64_FR + 93] = PT_F93, + [UNW_IA64_FR + 94] = PT_F94, [UNW_IA64_FR + 95] = PT_F95, + [UNW_IA64_FR + 96] = PT_F96, [UNW_IA64_FR + 97] = PT_F97, + [UNW_IA64_FR + 98] = PT_F98, [UNW_IA64_FR + 99] = PT_F99, + [UNW_IA64_FR +100] = PT_F100, [UNW_IA64_FR +101] = PT_F101, + [UNW_IA64_FR +102] = PT_F102, [UNW_IA64_FR +103] = PT_F103, + [UNW_IA64_FR +104] = PT_F104, [UNW_IA64_FR +105] = PT_F105, + [UNW_IA64_FR +106] = PT_F106, [UNW_IA64_FR +107] = PT_F107, + [UNW_IA64_FR +108] = PT_F108, [UNW_IA64_FR +109] = PT_F109, + [UNW_IA64_FR +110] = PT_F110, [UNW_IA64_FR +111] = PT_F111, + [UNW_IA64_FR +112] = PT_F112, [UNW_IA64_FR +113] = PT_F113, + [UNW_IA64_FR +114] = PT_F114, [UNW_IA64_FR +115] = PT_F115, + [UNW_IA64_FR +116] = PT_F116, [UNW_IA64_FR +117] = PT_F117, + [UNW_IA64_FR +118] = PT_F118, [UNW_IA64_FR +119] = PT_F119, + [UNW_IA64_FR +120] = PT_F120, [UNW_IA64_FR +121] = PT_F121, + [UNW_IA64_FR +122] = PT_F122, [UNW_IA64_FR +123] = PT_F123, + [UNW_IA64_FR +124] = PT_F124, [UNW_IA64_FR +125] = PT_F125, + [UNW_IA64_FR +126] = PT_F126, [UNW_IA64_FR +127] = PT_F127, - [UNW_IA64_AR + 0] = -1, [UNW_IA64_AR + 1] = -1, - [UNW_IA64_AR + 2] = -1, [UNW_IA64_AR + 3] = -1, - [UNW_IA64_AR + 4] = -1, [UNW_IA64_AR + 5] = -1, - [UNW_IA64_AR + 6] = -1, [UNW_IA64_AR + 7] = -1, - [UNW_IA64_AR + 8] = -1, [UNW_IA64_AR + 9] = -1, - [UNW_IA64_AR + 10] = -1, [UNW_IA64_AR + 11] = -1, - [UNW_IA64_AR + 12] = -1, [UNW_IA64_AR + 13] = -1, - [UNW_IA64_AR + 14] = -1, [UNW_IA64_AR + 15] = -1, - [UNW_IA64_AR + 16] = PT_AR_RSC, [UNW_IA64_AR + 17] = PT_AR_BSP, - [UNW_IA64_AR + 18] = PT_AR_BSPSTORE,[UNW_IA64_AR + 19] = PT_AR_RNAT, - [UNW_IA64_AR + 20] = -1, [UNW_IA64_AR + 21] = -1, - [UNW_IA64_AR + 22] = -1, [UNW_IA64_AR + 23] = -1, - [UNW_IA64_AR + 24] = -1, [UNW_IA64_AR + 25] = PT_AR_CSD, - [UNW_IA64_AR + 26] = -1, [UNW_IA64_AR + 27] = -1, - [UNW_IA64_AR + 28] = -1, [UNW_IA64_AR + 29] = -1, - [UNW_IA64_AR + 30] = -1, [UNW_IA64_AR + 31] = -1, - [UNW_IA64_AR + 32] = PT_AR_CCV, [UNW_IA64_AR + 33] = -1, - [UNW_IA64_AR + 34] = -1, [UNW_IA64_AR + 35] = -1, - [UNW_IA64_AR + 36] = PT_AR_UNAT, [UNW_IA64_AR + 37] = -1, - [UNW_IA64_AR + 38] = -1, [UNW_IA64_AR + 39] = -1, - [UNW_IA64_AR + 40] = PT_AR_FPSR, [UNW_IA64_AR + 41] = -1, - [UNW_IA64_AR + 42] = -1, [UNW_IA64_AR + 43] = -1, - [UNW_IA64_AR + 44] = -1, [UNW_IA64_AR + 45] = -1, - [UNW_IA64_AR + 46] = -1, [UNW_IA64_AR + 47] = -1, - [UNW_IA64_AR + 48] = -1, [UNW_IA64_AR + 49] = -1, - [UNW_IA64_AR + 50] = -1, [UNW_IA64_AR + 51] = -1, - [UNW_IA64_AR + 52] = -1, [UNW_IA64_AR + 53] = -1, - [UNW_IA64_AR + 54] = -1, [UNW_IA64_AR + 55] = -1, - [UNW_IA64_AR + 56] = -1, [UNW_IA64_AR + 57] = -1, - [UNW_IA64_AR + 58] = -1, [UNW_IA64_AR + 59] = -1, - [UNW_IA64_AR + 60] = -1, [UNW_IA64_AR + 61] = -1, - [UNW_IA64_AR + 62] = -1, [UNW_IA64_AR + 63] = -1, - [UNW_IA64_AR + 64] = PT_AR_PFS, [UNW_IA64_AR + 65] = PT_AR_LC, - [UNW_IA64_AR + 66] = PT_AR_EC, [UNW_IA64_AR + 67] = -1, - [UNW_IA64_AR + 68] = -1, [UNW_IA64_AR + 69] = -1, - [UNW_IA64_AR + 70] = -1, [UNW_IA64_AR + 71] = -1, - [UNW_IA64_AR + 72] = -1, [UNW_IA64_AR + 73] = -1, - [UNW_IA64_AR + 74] = -1, [UNW_IA64_AR + 75] = -1, - [UNW_IA64_AR + 76] = -1, [UNW_IA64_AR + 77] = -1, - [UNW_IA64_AR + 78] = -1, [UNW_IA64_AR + 79] = -1, - [UNW_IA64_AR + 80] = -1, [UNW_IA64_AR + 81] = -1, - [UNW_IA64_AR + 82] = -1, [UNW_IA64_AR + 83] = -1, - [UNW_IA64_AR + 84] = -1, [UNW_IA64_AR + 85] = -1, - [UNW_IA64_AR + 86] = -1, [UNW_IA64_AR + 87] = -1, - [UNW_IA64_AR + 88] = -1, [UNW_IA64_AR + 89] = -1, - [UNW_IA64_AR + 90] = -1, [UNW_IA64_AR + 91] = -1, - [UNW_IA64_AR + 92] = -1, [UNW_IA64_AR + 93] = -1, - [UNW_IA64_AR + 94] = -1, [UNW_IA64_AR + 95] = -1, - [UNW_IA64_AR + 96] = -1, [UNW_IA64_AR + 97] = -1, - [UNW_IA64_AR + 98] = -1, [UNW_IA64_AR + 99] = -1, - [UNW_IA64_AR +100] = -1, [UNW_IA64_AR +101] = -1, - [UNW_IA64_AR +102] = -1, [UNW_IA64_AR +103] = -1, - [UNW_IA64_AR +104] = -1, [UNW_IA64_AR +105] = -1, - [UNW_IA64_AR +106] = -1, [UNW_IA64_AR +107] = -1, - [UNW_IA64_AR +108] = -1, [UNW_IA64_AR +109] = -1, - [UNW_IA64_AR +110] = -1, [UNW_IA64_AR +111] = -1, - [UNW_IA64_AR +112] = -1, [UNW_IA64_AR +113] = -1, - [UNW_IA64_AR +114] = -1, [UNW_IA64_AR +115] = -1, - [UNW_IA64_AR +116] = -1, [UNW_IA64_AR +117] = -1, - [UNW_IA64_AR +118] = -1, [UNW_IA64_AR +119] = -1, - [UNW_IA64_AR +120] = -1, [UNW_IA64_AR +121] = -1, - [UNW_IA64_AR +122] = -1, [UNW_IA64_AR +123] = -1, - [UNW_IA64_AR +124] = -1, [UNW_IA64_AR +125] = -1, - [UNW_IA64_AR +126] = -1, [UNW_IA64_AR +127] = -1, + [UNW_IA64_AR + 0] = -1, [UNW_IA64_AR + 1] = -1, + [UNW_IA64_AR + 2] = -1, [UNW_IA64_AR + 3] = -1, + [UNW_IA64_AR + 4] = -1, [UNW_IA64_AR + 5] = -1, + [UNW_IA64_AR + 6] = -1, [UNW_IA64_AR + 7] = -1, + [UNW_IA64_AR + 8] = -1, [UNW_IA64_AR + 9] = -1, + [UNW_IA64_AR + 10] = -1, [UNW_IA64_AR + 11] = -1, + [UNW_IA64_AR + 12] = -1, [UNW_IA64_AR + 13] = -1, + [UNW_IA64_AR + 14] = -1, [UNW_IA64_AR + 15] = -1, + [UNW_IA64_AR + 16] = PT_AR_RSC, [UNW_IA64_AR + 17] = PT_AR_BSP, + [UNW_IA64_AR + 18] = PT_AR_BSPSTORE,[UNW_IA64_AR + 19] = PT_AR_RNAT, + [UNW_IA64_AR + 20] = -1, [UNW_IA64_AR + 21] = -1, + [UNW_IA64_AR + 22] = -1, [UNW_IA64_AR + 23] = -1, + [UNW_IA64_AR + 24] = -1, [UNW_IA64_AR + 25] = PT_AR_CSD, + [UNW_IA64_AR + 26] = -1, [UNW_IA64_AR + 27] = -1, + [UNW_IA64_AR + 28] = -1, [UNW_IA64_AR + 29] = -1, + [UNW_IA64_AR + 30] = -1, [UNW_IA64_AR + 31] = -1, + [UNW_IA64_AR + 32] = PT_AR_CCV, [UNW_IA64_AR + 33] = -1, + [UNW_IA64_AR + 34] = -1, [UNW_IA64_AR + 35] = -1, + [UNW_IA64_AR + 36] = PT_AR_UNAT, [UNW_IA64_AR + 37] = -1, + [UNW_IA64_AR + 38] = -1, [UNW_IA64_AR + 39] = -1, + [UNW_IA64_AR + 40] = PT_AR_FPSR, [UNW_IA64_AR + 41] = -1, + [UNW_IA64_AR + 42] = -1, [UNW_IA64_AR + 43] = -1, + [UNW_IA64_AR + 44] = -1, [UNW_IA64_AR + 45] = -1, + [UNW_IA64_AR + 46] = -1, [UNW_IA64_AR + 47] = -1, + [UNW_IA64_AR + 48] = -1, [UNW_IA64_AR + 49] = -1, + [UNW_IA64_AR + 50] = -1, [UNW_IA64_AR + 51] = -1, + [UNW_IA64_AR + 52] = -1, [UNW_IA64_AR + 53] = -1, + [UNW_IA64_AR + 54] = -1, [UNW_IA64_AR + 55] = -1, + [UNW_IA64_AR + 56] = -1, [UNW_IA64_AR + 57] = -1, + [UNW_IA64_AR + 58] = -1, [UNW_IA64_AR + 59] = -1, + [UNW_IA64_AR + 60] = -1, [UNW_IA64_AR + 61] = -1, + [UNW_IA64_AR + 62] = -1, [UNW_IA64_AR + 63] = -1, + [UNW_IA64_AR + 64] = PT_AR_PFS, [UNW_IA64_AR + 65] = PT_AR_LC, + [UNW_IA64_AR + 66] = PT_AR_EC, [UNW_IA64_AR + 67] = -1, + [UNW_IA64_AR + 68] = -1, [UNW_IA64_AR + 69] = -1, + [UNW_IA64_AR + 70] = -1, [UNW_IA64_AR + 71] = -1, + [UNW_IA64_AR + 72] = -1, [UNW_IA64_AR + 73] = -1, + [UNW_IA64_AR + 74] = -1, [UNW_IA64_AR + 75] = -1, + [UNW_IA64_AR + 76] = -1, [UNW_IA64_AR + 77] = -1, + [UNW_IA64_AR + 78] = -1, [UNW_IA64_AR + 79] = -1, + [UNW_IA64_AR + 80] = -1, [UNW_IA64_AR + 81] = -1, + [UNW_IA64_AR + 82] = -1, [UNW_IA64_AR + 83] = -1, + [UNW_IA64_AR + 84] = -1, [UNW_IA64_AR + 85] = -1, + [UNW_IA64_AR + 86] = -1, [UNW_IA64_AR + 87] = -1, + [UNW_IA64_AR + 88] = -1, [UNW_IA64_AR + 89] = -1, + [UNW_IA64_AR + 90] = -1, [UNW_IA64_AR + 91] = -1, + [UNW_IA64_AR + 92] = -1, [UNW_IA64_AR + 93] = -1, + [UNW_IA64_AR + 94] = -1, [UNW_IA64_AR + 95] = -1, + [UNW_IA64_AR + 96] = -1, [UNW_IA64_AR + 97] = -1, + [UNW_IA64_AR + 98] = -1, [UNW_IA64_AR + 99] = -1, + [UNW_IA64_AR +100] = -1, [UNW_IA64_AR +101] = -1, + [UNW_IA64_AR +102] = -1, [UNW_IA64_AR +103] = -1, + [UNW_IA64_AR +104] = -1, [UNW_IA64_AR +105] = -1, + [UNW_IA64_AR +106] = -1, [UNW_IA64_AR +107] = -1, + [UNW_IA64_AR +108] = -1, [UNW_IA64_AR +109] = -1, + [UNW_IA64_AR +110] = -1, [UNW_IA64_AR +111] = -1, + [UNW_IA64_AR +112] = -1, [UNW_IA64_AR +113] = -1, + [UNW_IA64_AR +114] = -1, [UNW_IA64_AR +115] = -1, + [UNW_IA64_AR +116] = -1, [UNW_IA64_AR +117] = -1, + [UNW_IA64_AR +118] = -1, [UNW_IA64_AR +119] = -1, + [UNW_IA64_AR +120] = -1, [UNW_IA64_AR +121] = -1, + [UNW_IA64_AR +122] = -1, [UNW_IA64_AR +123] = -1, + [UNW_IA64_AR +124] = -1, [UNW_IA64_AR +125] = -1, + [UNW_IA64_AR +126] = -1, [UNW_IA64_AR +127] = -1, - [UNW_IA64_BR + 0] = PT_B0, [UNW_IA64_BR + 1] = PT_B1, - [UNW_IA64_BR + 2] = PT_B2, [UNW_IA64_BR + 3] = PT_B3, - [UNW_IA64_BR + 4] = PT_B4, [UNW_IA64_BR + 5] = PT_B5, - [UNW_IA64_BR + 6] = PT_B6, [UNW_IA64_BR + 7] = PT_B7, + [UNW_IA64_BR + 0] = PT_B0, [UNW_IA64_BR + 1] = PT_B1, + [UNW_IA64_BR + 2] = PT_B2, [UNW_IA64_BR + 3] = PT_B3, + [UNW_IA64_BR + 4] = PT_B4, [UNW_IA64_BR + 5] = PT_B5, + [UNW_IA64_BR + 6] = PT_B6, [UNW_IA64_BR + 7] = PT_B7, - [UNW_IA64_PR] = PT_PR, - [UNW_IA64_CFM] = PT_CFM, - [UNW_IA64_IP] = PT_CR_IIP + [UNW_IA64_PR] = PT_PR, + [UNW_IA64_CFM] = PT_CFM, + [UNW_IA64_IP] = PT_CR_IIP #elif defined(HAVE_TTRACE) # warning No support for ttrace() yet. #elif defined(UNW_TARGET_HPPA) - [UNW_HPPA_GR + 0] = 0x000, [UNW_HPPA_GR + 1] = 0x004, - [UNW_HPPA_GR + 2] = 0x008, [UNW_HPPA_GR + 3] = 0x00c, - [UNW_HPPA_GR + 4] = 0x010, [UNW_HPPA_GR + 5] = 0x014, - [UNW_HPPA_GR + 6] = 0x018, [UNW_HPPA_GR + 7] = 0x01c, - [UNW_HPPA_GR + 8] = 0x020, [UNW_HPPA_GR + 9] = 0x024, - [UNW_HPPA_GR + 10] = 0x028, [UNW_HPPA_GR + 11] = 0x02c, - [UNW_HPPA_GR + 12] = 0x030, [UNW_HPPA_GR + 13] = 0x034, - [UNW_HPPA_GR + 14] = 0x038, [UNW_HPPA_GR + 15] = 0x03c, - [UNW_HPPA_GR + 16] = 0x040, [UNW_HPPA_GR + 17] = 0x044, - [UNW_HPPA_GR + 18] = 0x048, [UNW_HPPA_GR + 19] = 0x04c, - [UNW_HPPA_GR + 20] = 0x050, [UNW_HPPA_GR + 21] = 0x054, - [UNW_HPPA_GR + 22] = 0x058, [UNW_HPPA_GR + 23] = 0x05c, - [UNW_HPPA_GR + 24] = 0x060, [UNW_HPPA_GR + 25] = 0x064, - [UNW_HPPA_GR + 26] = 0x068, [UNW_HPPA_GR + 27] = 0x06c, - [UNW_HPPA_GR + 28] = 0x070, [UNW_HPPA_GR + 29] = 0x074, - [UNW_HPPA_GR + 30] = 0x078, [UNW_HPPA_GR + 31] = 0x07c, + [UNW_HPPA_GR + 0] = 0x000, [UNW_HPPA_GR + 1] = 0x004, + [UNW_HPPA_GR + 2] = 0x008, [UNW_HPPA_GR + 3] = 0x00c, + [UNW_HPPA_GR + 4] = 0x010, [UNW_HPPA_GR + 5] = 0x014, + [UNW_HPPA_GR + 6] = 0x018, [UNW_HPPA_GR + 7] = 0x01c, + [UNW_HPPA_GR + 8] = 0x020, [UNW_HPPA_GR + 9] = 0x024, + [UNW_HPPA_GR + 10] = 0x028, [UNW_HPPA_GR + 11] = 0x02c, + [UNW_HPPA_GR + 12] = 0x030, [UNW_HPPA_GR + 13] = 0x034, + [UNW_HPPA_GR + 14] = 0x038, [UNW_HPPA_GR + 15] = 0x03c, + [UNW_HPPA_GR + 16] = 0x040, [UNW_HPPA_GR + 17] = 0x044, + [UNW_HPPA_GR + 18] = 0x048, [UNW_HPPA_GR + 19] = 0x04c, + [UNW_HPPA_GR + 20] = 0x050, [UNW_HPPA_GR + 21] = 0x054, + [UNW_HPPA_GR + 22] = 0x058, [UNW_HPPA_GR + 23] = 0x05c, + [UNW_HPPA_GR + 24] = 0x060, [UNW_HPPA_GR + 25] = 0x064, + [UNW_HPPA_GR + 26] = 0x068, [UNW_HPPA_GR + 27] = 0x06c, + [UNW_HPPA_GR + 28] = 0x070, [UNW_HPPA_GR + 29] = 0x074, + [UNW_HPPA_GR + 30] = 0x078, [UNW_HPPA_GR + 31] = 0x07c, - [UNW_HPPA_FR + 0] = 0x080, [UNW_HPPA_FR + 1] = 0x088, - [UNW_HPPA_FR + 2] = 0x090, [UNW_HPPA_FR + 3] = 0x098, - [UNW_HPPA_FR + 4] = 0x0a0, [UNW_HPPA_FR + 5] = 0x0a8, - [UNW_HPPA_FR + 6] = 0x0b0, [UNW_HPPA_FR + 7] = 0x0b8, - [UNW_HPPA_FR + 8] = 0x0c0, [UNW_HPPA_FR + 9] = 0x0c8, - [UNW_HPPA_FR + 10] = 0x0d0, [UNW_HPPA_FR + 11] = 0x0d8, - [UNW_HPPA_FR + 12] = 0x0e0, [UNW_HPPA_FR + 13] = 0x0e8, - [UNW_HPPA_FR + 14] = 0x0f0, [UNW_HPPA_FR + 15] = 0x0f8, - [UNW_HPPA_FR + 16] = 0x100, [UNW_HPPA_FR + 17] = 0x108, - [UNW_HPPA_FR + 18] = 0x110, [UNW_HPPA_FR + 19] = 0x118, - [UNW_HPPA_FR + 20] = 0x120, [UNW_HPPA_FR + 21] = 0x128, - [UNW_HPPA_FR + 22] = 0x130, [UNW_HPPA_FR + 23] = 0x138, - [UNW_HPPA_FR + 24] = 0x140, [UNW_HPPA_FR + 25] = 0x148, - [UNW_HPPA_FR + 26] = 0x150, [UNW_HPPA_FR + 27] = 0x158, - [UNW_HPPA_FR + 28] = 0x160, [UNW_HPPA_FR + 29] = 0x168, - [UNW_HPPA_FR + 30] = 0x170, [UNW_HPPA_FR + 31] = 0x178, + [UNW_HPPA_FR + 0] = 0x080, [UNW_HPPA_FR + 1] = 0x088, + [UNW_HPPA_FR + 2] = 0x090, [UNW_HPPA_FR + 3] = 0x098, + [UNW_HPPA_FR + 4] = 0x0a0, [UNW_HPPA_FR + 5] = 0x0a8, + [UNW_HPPA_FR + 6] = 0x0b0, [UNW_HPPA_FR + 7] = 0x0b8, + [UNW_HPPA_FR + 8] = 0x0c0, [UNW_HPPA_FR + 9] = 0x0c8, + [UNW_HPPA_FR + 10] = 0x0d0, [UNW_HPPA_FR + 11] = 0x0d8, + [UNW_HPPA_FR + 12] = 0x0e0, [UNW_HPPA_FR + 13] = 0x0e8, + [UNW_HPPA_FR + 14] = 0x0f0, [UNW_HPPA_FR + 15] = 0x0f8, + [UNW_HPPA_FR + 16] = 0x100, [UNW_HPPA_FR + 17] = 0x108, + [UNW_HPPA_FR + 18] = 0x110, [UNW_HPPA_FR + 19] = 0x118, + [UNW_HPPA_FR + 20] = 0x120, [UNW_HPPA_FR + 21] = 0x128, + [UNW_HPPA_FR + 22] = 0x130, [UNW_HPPA_FR + 23] = 0x138, + [UNW_HPPA_FR + 24] = 0x140, [UNW_HPPA_FR + 25] = 0x148, + [UNW_HPPA_FR + 26] = 0x150, [UNW_HPPA_FR + 27] = 0x158, + [UNW_HPPA_FR + 28] = 0x160, [UNW_HPPA_FR + 29] = 0x168, + [UNW_HPPA_FR + 30] = 0x170, [UNW_HPPA_FR + 31] = 0x178, - [UNW_HPPA_IP] = 0x1a8 /* IAOQ[0] */ + [UNW_HPPA_IP] = 0x1a8 /* IAOQ[0] */ #elif defined(UNW_TARGET_X86) #if defined __FreeBSD__ #define UNW_R_OFF(R, r) \ - [UNW_X86_##R] = offsetof(gregset_t, r_##r), + [UNW_X86_##R] = offsetof(gregset_t, r_##r), UNW_R_OFF(EAX, eax) UNW_R_OFF(EDX, edx) UNW_R_OFF(ECX, ecx) @@ -266,30 +266,30 @@ const int _UPT_reg_offset[UNW_REG_LAST + 1] = // UNW_R_OFF(EFLAGS, eflags) // UNW_R_OFF(SS, ss) #elif defined __linux__ - [UNW_X86_EAX] = 0x18, - [UNW_X86_EBX] = 0x00, - [UNW_X86_ECX] = 0x04, - [UNW_X86_EDX] = 0x08, - [UNW_X86_ESI] = 0x0c, - [UNW_X86_EDI] = 0x10, - [UNW_X86_EBP] = 0x14, - [UNW_X86_EIP] = 0x30, - [UNW_X86_ESP] = 0x3c -/* CS = 0x34, */ -/* DS = 0x1c, */ -/* ES = 0x20, */ -/* FS = 0x24, */ -/* GS = 0x28, */ -/* ORIG_EAX = 0x2c, */ -/* EFLAGS = 0x38, */ -/* SS = 0x40 */ + [UNW_X86_EAX] = 0x18, + [UNW_X86_EBX] = 0x00, + [UNW_X86_ECX] = 0x04, + [UNW_X86_EDX] = 0x08, + [UNW_X86_ESI] = 0x0c, + [UNW_X86_EDI] = 0x10, + [UNW_X86_EBP] = 0x14, + [UNW_X86_EIP] = 0x30, + [UNW_X86_ESP] = 0x3c +/* CS = 0x34, */ +/* DS = 0x1c, */ +/* ES = 0x20, */ +/* FS = 0x24, */ +/* GS = 0x28, */ +/* ORIG_EAX = 0x2c, */ +/* EFLAGS = 0x38, */ +/* SS = 0x40 */ #else #error Port me #endif #elif defined(UNW_TARGET_X86_64) #if defined __FreeBSD__ #define UNW_R_OFF(R, r) \ - [UNW_X86_64_##R] = offsetof(gregset_t, r_##r), + [UNW_X86_64_##R] = offsetof(gregset_t, r_##r), UNW_R_OFF(RAX, rax) UNW_R_OFF(RDX, rdx) UNW_R_OFF(RCX, rcx) @@ -312,27 +312,27 @@ const int _UPT_reg_offset[UNW_REG_LAST + 1] = // UNW_R_OFF(SS, ss) #undef UNW_R_OFF #elif defined __linux__ - [UNW_X86_64_RAX] = 0x50, - [UNW_X86_64_RDX] = 0x60, - [UNW_X86_64_RCX] = 0x58, - [UNW_X86_64_RBX] = 0x28, - [UNW_X86_64_RSI] = 0x68, - [UNW_X86_64_RDI] = 0x70, - [UNW_X86_64_RBP] = 0x20, - [UNW_X86_64_RSP] = 0x98, - [UNW_X86_64_R8] = 0x48, - [UNW_X86_64_R9] = 0x40, - [UNW_X86_64_R10] = 0x38, - [UNW_X86_64_R11] = 0x30, - [UNW_X86_64_R12] = 0x18, - [UNW_X86_64_R13] = 0x10, - [UNW_X86_64_R14] = 0x08, - [UNW_X86_64_R15] = 0x00, - [UNW_X86_64_RIP] = 0x80 -// [UNW_X86_64_CS] = 0x88, -// [UNW_X86_64_EFLAGS] = 0x90, -// [UNW_X86_64_RSP] = 0x98, -// [UNW_X86_64_SS] = 0xa0 + [UNW_X86_64_RAX] = 0x50, + [UNW_X86_64_RDX] = 0x60, + [UNW_X86_64_RCX] = 0x58, + [UNW_X86_64_RBX] = 0x28, + [UNW_X86_64_RSI] = 0x68, + [UNW_X86_64_RDI] = 0x70, + [UNW_X86_64_RBP] = 0x20, + [UNW_X86_64_RSP] = 0x98, + [UNW_X86_64_R8] = 0x48, + [UNW_X86_64_R9] = 0x40, + [UNW_X86_64_R10] = 0x38, + [UNW_X86_64_R11] = 0x30, + [UNW_X86_64_R12] = 0x18, + [UNW_X86_64_R13] = 0x10, + [UNW_X86_64_R14] = 0x08, + [UNW_X86_64_R15] = 0x00, + [UNW_X86_64_RIP] = 0x80 +// [UNW_X86_64_CS] = 0x88, +// [UNW_X86_64_EFLAGS] = 0x90, +// [UNW_X86_64_RSP] = 0x98, +// [UNW_X86_64_SS] = 0xa0 #else #error Port me #endif @@ -349,38 +349,38 @@ const int _UPT_reg_offset[UNW_REG_LAST + 1] = [UNW_PPC##b##_R##i] = UNW_PPC_R(PT_R##i) #define UNW_PPC_REGS(b) \ - UNW_R_OFF(b, 0), \ - UNW_R_OFF(b, 1), \ - UNW_R_OFF(b, 2), \ - UNW_R_OFF(b, 3), \ - UNW_R_OFF(b, 4), \ - UNW_R_OFF(b, 5), \ - UNW_R_OFF(b, 6), \ - UNW_R_OFF(b, 7), \ - UNW_R_OFF(b, 8), \ - UNW_R_OFF(b, 9), \ - UNW_R_OFF(b, 10), \ - UNW_R_OFF(b, 11), \ - UNW_R_OFF(b, 12), \ - UNW_R_OFF(b, 13), \ - UNW_R_OFF(b, 14), \ - UNW_R_OFF(b, 15), \ - UNW_R_OFF(b, 16), \ - UNW_R_OFF(b, 17), \ - UNW_R_OFF(b, 18), \ - UNW_R_OFF(b, 19), \ - UNW_R_OFF(b, 20), \ - UNW_R_OFF(b, 21), \ - UNW_R_OFF(b, 22), \ - UNW_R_OFF(b, 23), \ - UNW_R_OFF(b, 24), \ - UNW_R_OFF(b, 25), \ - UNW_R_OFF(b, 26), \ - UNW_R_OFF(b, 27), \ - UNW_R_OFF(b, 28), \ - UNW_R_OFF(b, 29), \ - UNW_R_OFF(b, 30), \ - UNW_R_OFF(b, 31), \ + UNW_R_OFF(b, 0), \ + UNW_R_OFF(b, 1), \ + UNW_R_OFF(b, 2), \ + UNW_R_OFF(b, 3), \ + UNW_R_OFF(b, 4), \ + UNW_R_OFF(b, 5), \ + UNW_R_OFF(b, 6), \ + UNW_R_OFF(b, 7), \ + UNW_R_OFF(b, 8), \ + UNW_R_OFF(b, 9), \ + UNW_R_OFF(b, 10), \ + UNW_R_OFF(b, 11), \ + UNW_R_OFF(b, 12), \ + UNW_R_OFF(b, 13), \ + UNW_R_OFF(b, 14), \ + UNW_R_OFF(b, 15), \ + UNW_R_OFF(b, 16), \ + UNW_R_OFF(b, 17), \ + UNW_R_OFF(b, 18), \ + UNW_R_OFF(b, 19), \ + UNW_R_OFF(b, 20), \ + UNW_R_OFF(b, 21), \ + UNW_R_OFF(b, 22), \ + UNW_R_OFF(b, 23), \ + UNW_R_OFF(b, 24), \ + UNW_R_OFF(b, 25), \ + UNW_R_OFF(b, 26), \ + UNW_R_OFF(b, 27), \ + UNW_R_OFF(b, 28), \ + UNW_R_OFF(b, 29), \ + UNW_R_OFF(b, 30), \ + UNW_R_OFF(b, 31), \ \ [UNW_PPC##b##_CTR] = UNW_PPC_PT(CTR), \ [UNW_PPC##b##_XER] = UNW_PPC_PT(XER), \ @@ -423,7 +423,7 @@ const int _UPT_reg_offset[UNW_REG_LAST + 1] = [UNW_PPC32_FPSCR] = UNW_PPC_PT(FPSCR), \ [UNW_PPC32_CCR] = UNW_PPC_PT(CCR) -#define UNW_VR_OFF(i) \ +#define UNW_VR_OFF(i) \ [UNW_PPC64_V##i] = UNW_PPC_R(PT_VR0 + i * 2) #define UNW_PPC64_REGS \ diff --git a/src/ptrace/_UPT_resume.c b/src/ptrace/_UPT_resume.c index f419fed3..d70a0d48 100644 --- a/src/ptrace/_UPT_resume.c +++ b/src/ptrace/_UPT_resume.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/setjmp/longjmp.c b/src/setjmp/longjmp.c index 97dcdff0..8295a9b8 100644 --- a/src/setjmp/longjmp.c +++ b/src/setjmp/longjmp.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -69,26 +69,26 @@ _longjmp (jmp_buf env, int val) do { if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0) - abort (); + abort (); #ifdef __FreeBSD__ if (sp != wp[JB_SP] + sizeof(unw_word_t)) #else if (sp != wp[JB_SP]) #endif - continue; + continue; if (!bsp_match (&c, wp)) - continue; + continue; /* found the right frame: */ assert (UNW_NUM_EH_REGS >= 2); if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0 - || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 - || unw_set_reg (&c, UNW_REG_IP, - (unw_word_t) (uintptr_t) &_UI_longjmp_cont)) - abort (); + || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 + || unw_set_reg (&c, UNW_REG_IP, + (unw_word_t) (uintptr_t) &_UI_longjmp_cont)) + abort (); unw_resume (&c); diff --git a/src/setjmp/setjmp.c b/src/setjmp/setjmp.c index feb83f77..bec9fc7d 100644 --- a/src/setjmp/setjmp.c +++ b/src/setjmp/setjmp.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/setjmp/setjmp_i.h b/src/setjmp/setjmp_i.h index 1d7ca158..4d913969 100644 --- a/src/setjmp/setjmp_i.h +++ b/src/setjmp/setjmp_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -50,20 +50,20 @@ bsp_match (unw_cursor_t *c, unw_word_t *wp) unw_cursor_t tmp = *c; /* The caller of {sig,}setjmp() cannot have a NULL-frame. If we - see a NULL-frame, we haven't reached the right target yet. - To have a NULL-frame, the number of locals must be zero and - the stack-frame must also be empty. */ + see a NULL-frame, we haven't reached the right target yet. + To have a NULL-frame, the number of locals must be zero and + the stack-frame must also be empty. */ if (unw_step (&tmp) < 0) - abort (); + abort (); if (unw_get_reg (&tmp, UNW_REG_SP, &sp) < 0 - || unw_get_reg (&tmp, UNW_REG_SP, &prev_sp) < 0) - abort (); + || unw_get_reg (&tmp, UNW_REG_SP, &prev_sp) < 0) + abort (); if (sp == prev_sp) - /* got a NULL-frame; keep looking... */ - return 0; + /* got a NULL-frame; keep looking... */ + return 0; } return 1; } @@ -93,7 +93,7 @@ resume_restores_sigmask (unw_cursor_t *c, unw_word_t *wp) else { if (sigprocmask (SIG_BLOCK, NULL, ¤t_mask) < 0) - abort (); + abort (); mp = ¤t_mask; } memcpy (&sc->sc_mask, mp, sizeof (sc->sc_mask)); diff --git a/src/setjmp/siglongjmp.c b/src/setjmp/siglongjmp.c index 55c20035..0e286f6f 100644 --- a/src/setjmp/siglongjmp.c +++ b/src/setjmp/siglongjmp.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -70,16 +70,16 @@ siglongjmp (sigjmp_buf env, int val) do { if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0) - abort (); + abort (); #ifdef __FreeBSD__ if (sp != wp[JB_SP] + sizeof(unw_word_t)) #else if (sp != wp[JB_SP]) #endif - continue; + continue; if (!bsp_match (&c, wp)) - continue; + continue; /* found the right frame: */ @@ -87,35 +87,35 @@ siglongjmp (sigjmp_buf env, int val) cont = &_UI_longjmp_cont; /* Order of evaluation is important here: if unw_resume() - restores signal mask, we must set it up appropriately, even - if wp[JB_MASK_SAVED] is FALSE. */ + restores signal mask, we must set it up appropriately, even + if wp[JB_MASK_SAVED] is FALSE. */ if (!resume_restores_sigmask (&c, wp) && wp[JB_MASK_SAVED]) - { - /* sigmask was saved */ + { + /* sigmask was saved */ #if defined(__linux__) - if (UNW_NUM_EH_REGS < 4 || _NSIG > 16 * sizeof (unw_word_t)) - /* signal mask doesn't fit into EH arguments and we can't - put it on the stack without overwriting something - else... */ - abort (); - else - if (unw_set_reg (&c, UNW_REG_EH + 2, wp[JB_MASK]) < 0 - || (_NSIG > 8 * sizeof (unw_word_t) - && unw_set_reg (&c, UNW_REG_EH + 3, wp[JB_MASK + 1]) < 0)) - abort (); + if (UNW_NUM_EH_REGS < 4 || _NSIG > 16 * sizeof (unw_word_t)) + /* signal mask doesn't fit into EH arguments and we can't + put it on the stack without overwriting something + else... */ + abort (); + else + if (unw_set_reg (&c, UNW_REG_EH + 2, wp[JB_MASK]) < 0 + || (_NSIG > 8 * sizeof (unw_word_t) + && unw_set_reg (&c, UNW_REG_EH + 3, wp[JB_MASK + 1]) < 0)) + abort (); #elif defined(__FreeBSD__) - if (unw_set_reg (&c, UNW_REG_EH + 2, &wp[JB_MASK]) < 0) - abort(); + if (unw_set_reg (&c, UNW_REG_EH + 2, &wp[JB_MASK]) < 0) + abort(); #else #error Port me #endif - cont = &_UI_siglongjmp_cont; - } + cont = &_UI_siglongjmp_cont; + } if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0 - || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 - || unw_set_reg (&c, UNW_REG_IP, (unw_word_t) (uintptr_t) cont)) - abort (); + || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0 + || unw_set_reg (&c, UNW_REG_IP, (unw_word_t) (uintptr_t) cont)) + abort (); unw_resume (&c); diff --git a/src/setjmp/sigsetjmp.c b/src/setjmp/sigsetjmp.c index 87df5ed8..f84935d6 100644 --- a/src/setjmp/sigsetjmp.c +++ b/src/setjmp/sigsetjmp.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/sh/Gget_save_loc.c b/src/sh/Gget_save_loc.c index 8b83c6f6..7690a808 100644 --- a/src/sh/Gget_save_loc.c +++ b/src/sh/Gget_save_loc.c @@ -55,7 +55,7 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) break; default: - loc = DWARF_NULL_LOC; /* default to "not saved" */ + loc = DWARF_NULL_LOC; /* default to "not saved" */ break; } diff --git a/src/sh/Gglobal.c b/src/sh/Gglobal.c index 4776d22a..ed273339 100644 --- a/src/sh/Gglobal.c +++ b/src/sh/Gglobal.c @@ -49,7 +49,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY sh_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&sh_lock, saved_mask); diff --git a/src/sh/Ginit.c b/src/sh/Ginit.c index d65bff6b..b380db1d 100644 --- a/src/sh/Ginit.c +++ b/src/sh/Ginit.c @@ -73,7 +73,7 @@ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; return 0; @@ -81,7 +81,7 @@ get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (write) { @@ -98,7 +98,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, - void *arg) + void *arg) { unw_word_t *addr; ucontext_t *uc = arg; @@ -128,7 +128,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = arg; unw_fpreg_t *addr; @@ -142,14 +142,14 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, if (write) { Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); *(unw_fpreg_t *) addr = *val; } else { *val = *(unw_fpreg_t *) addr; Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); } return 0; @@ -161,8 +161,8 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); } diff --git a/src/sh/Gregs.c b/src/sh/Gregs.c index cd86a2da..fb4ca740 100644 --- a/src/sh/Gregs.c +++ b/src/sh/Gregs.c @@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { dwarf_loc_t loc = DWARF_NULL_LOC; @@ -72,7 +72,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, - int write) + int write) { Debug (1, "bad register number %u\n", reg); return -UNW_EBADREG; diff --git a/src/sh/Gresume.c b/src/sh/Gresume.c index 536670ff..b14e419b 100644 --- a/src/sh/Gresume.c +++ b/src/sh/Gresume.c @@ -39,7 +39,7 @@ sh_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) if (c->sigcontext_format == SH_SCF_NONE) { /* Since there are no signals involved here we restore the non scratch - registers only. */ + registers only. */ unsigned long regs[8]; regs[0] = uc->uc_mcontext.gregs[8]; regs[1] = uc->uc_mcontext.gregs[9]; @@ -52,31 +52,31 @@ sh_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) unsigned long pc = uc->uc_mcontext.pr; struct regs_overlay { - char x[sizeof(regs)]; + char x[sizeof(regs)]; }; asm volatile ( - "mov.l @%0+, r8\n" - "mov.l @%0+, r9\n" - "mov.l @%0+, r10\n" - "mov.l @%0+, r11\n" - "mov.l @%0+, r12\n" - "mov.l @%0+, r13\n" - "mov.l @%0+, r14\n" - "mov.l @%0, r15\n" - "lds %1, pr\n" - "rts\n" - "nop\n" - : - : "r" (regs), - "r" (pc), - "m" (*(struct regs_overlay *)regs) + "mov.l @%0+, r8\n" + "mov.l @%0+, r9\n" + "mov.l @%0+, r10\n" + "mov.l @%0+, r11\n" + "mov.l @%0+, r12\n" + "mov.l @%0+, r13\n" + "mov.l @%0+, r14\n" + "mov.l @%0, r15\n" + "lds %1, pr\n" + "rts\n" + "nop\n" + : + : "r" (regs), + "r" (pc), + "m" (*(struct regs_overlay *)regs) ); } else { /* In case a signal frame is involved, we're using its trampoline which - calls sigreturn. */ + calls sigreturn. */ struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; sc->sc_regs[0] = uc->uc_mcontext.gregs[0]; sc->sc_regs[1] = uc->uc_mcontext.gregs[1]; @@ -98,15 +98,15 @@ sh_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) sc->sc_pr = uc->uc_mcontext.pr; /* Set the SP and the PC in order to continue execution at the modified - trampoline which restores the signal mask and the registers. */ + trampoline which restores the signal mask and the registers. */ asm __volatile__ ( - "mov %0, r15\n" - "lds %1, pr\n" - "rts\n" - "nop\n" - : - : "r" (c->sigcontext_sp), - "r" (c->sigcontext_pc) + "mov %0, r15\n" + "lds %1, pr\n" + "rts\n" + "nop\n" + : + : "r" (c->sigcontext_sp), + "r" (c->sigcontext_pc) ); } unreachable(); @@ -131,15 +131,15 @@ establish_machine_state (struct cursor *c) { Debug (16, "copying %s %d\n", unw_regname (reg), reg); if (unw_is_fpreg (reg)) - { - if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) - as->acc.access_fpreg (as, reg, &fpval, 1, arg); - } + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + as->acc.access_fpreg (as, reg, &fpval, 1, arg); + } else - { - if (tdep_access_reg (c, reg, &val, 0) >= 0) - as->acc.access_reg (as, reg, &val, 1, arg); - } + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + as->acc.access_reg (as, reg, &val, 1, arg); + } } } @@ -153,7 +153,7 @@ unw_resume (unw_cursor_t *cursor) if (!c->dwarf.ip) { /* This can happen easily when the frame-chain gets truncated - due to bad or missing unwind-info. */ + due to bad or missing unwind-info. */ Debug (1, "refusing to resume execution at address 0\n"); return -UNW_EINVAL; } @@ -161,5 +161,5 @@ unw_resume (unw_cursor_t *cursor) establish_machine_state (c); return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, - c->dwarf.as_arg); + c->dwarf.as_arg); } diff --git a/src/sh/offsets.h b/src/sh/offsets.h index 75c86ca2..b02d8aee 100644 --- a/src/sh/offsets.h +++ b/src/sh/offsets.h @@ -4,29 +4,29 @@ /* Offsets for SH Linux "ucontext_t": */ -#define LINUX_UC_FLAGS_OFF 0x0 -#define LINUX_UC_LINK_OFF 0x4 -#define LINUX_UC_STACK_OFF 0x8 -#define LINUX_UC_MCONTEXT_OFF 0x14 -#define LINUX_UC_SIGMASK_OFF 0xFC +#define LINUX_UC_FLAGS_OFF 0x0 +#define LINUX_UC_LINK_OFF 0x4 +#define LINUX_UC_STACK_OFF 0x8 +#define LINUX_UC_MCONTEXT_OFF 0x14 +#define LINUX_UC_SIGMASK_OFF 0xFC /* Offsets for SH Linux "struct sigcontext": */ -#define LINUX_SC_R0_OFF 0x4 -#define LINUX_SC_R1_OFF 0x8 -#define LINUX_SC_R2_OFF 0xC -#define LINUX_SC_R3_OFF 0x10 -#define LINUX_SC_R4_OFF 0x14 -#define LINUX_SC_R5_OFF 0x18 -#define LINUX_SC_R6_OFF 0x1C -#define LINUX_SC_R7_OFF 0x20 -#define LINUX_SC_R8_OFF 0x24 -#define LINUX_SC_R9_OFF 0x28 -#define LINUX_SC_R10_OFF 0x2C -#define LINUX_SC_R11_OFF 0x30 -#define LINUX_SC_R12_OFF 0x34 -#define LINUX_SC_R13_OFF 0x38 -#define LINUX_SC_R14_OFF 0x3C -#define LINUX_SC_R15_OFF 0x40 -#define LINUX_SC_PC_OFF 0x44 -#define LINUX_SC_PR_OFF 0x48 +#define LINUX_SC_R0_OFF 0x4 +#define LINUX_SC_R1_OFF 0x8 +#define LINUX_SC_R2_OFF 0xC +#define LINUX_SC_R3_OFF 0x10 +#define LINUX_SC_R4_OFF 0x14 +#define LINUX_SC_R5_OFF 0x18 +#define LINUX_SC_R6_OFF 0x1C +#define LINUX_SC_R7_OFF 0x20 +#define LINUX_SC_R8_OFF 0x24 +#define LINUX_SC_R9_OFF 0x28 +#define LINUX_SC_R10_OFF 0x2C +#define LINUX_SC_R11_OFF 0x30 +#define LINUX_SC_R12_OFF 0x34 +#define LINUX_SC_R13_OFF 0x38 +#define LINUX_SC_R14_OFF 0x3C +#define LINUX_SC_R15_OFF 0x40 +#define LINUX_SC_PC_OFF 0x44 +#define LINUX_SC_PR_OFF 0x48 diff --git a/src/sh/unwind_i.h b/src/sh/unwind_i.h index 5de0bea7..3066d846 100644 --- a/src/sh/unwind_i.h +++ b/src/sh/unwind_i.h @@ -29,9 +29,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" -#define sh_lock UNW_OBJ(lock) -#define sh_local_resume UNW_OBJ(local_resume) -#define sh_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define sh_lock UNW_OBJ(lock) +#define sh_local_resume UNW_OBJ(local_resume) +#define sh_local_addr_space_init UNW_OBJ(local_addr_space_init) extern void sh_local_addr_space_init (void); extern int sh_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, diff --git a/src/unwind/Backtrace.c b/src/unwind/Backtrace.c index 99c20fcc..50f1fb61 100644 --- a/src/unwind/Backtrace.c +++ b/src/unwind/Backtrace.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -40,15 +40,15 @@ _Unwind_Backtrace (_Unwind_Trace_Fn trace, void *trace_parameter) while (1) { if ((ret = unw_step (&context.cursor)) <= 0) - { - if (ret == 0) - return _URC_END_OF_STACK; - else - return _URC_FATAL_PHASE1_ERROR; - } + { + if (ret == 0) + return _URC_END_OF_STACK; + else + return _URC_FATAL_PHASE1_ERROR; + } if ((*trace) (&context, trace_parameter) != _URC_NO_REASON) - return _URC_FATAL_PHASE1_ERROR; + return _URC_FATAL_PHASE1_ERROR; } } diff --git a/src/unwind/DeleteException.c b/src/unwind/DeleteException.c index 5104b73b..79be65e4 100644 --- a/src/unwind/DeleteException.c +++ b/src/unwind/DeleteException.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/FindEnclosingFunction.c b/src/unwind/FindEnclosingFunction.c index e639894c..b9873da5 100644 --- a/src/unwind/FindEnclosingFunction.c +++ b/src/unwind/FindEnclosingFunction.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -31,7 +31,7 @@ _Unwind_FindEnclosingFunction (void *ip) unw_proc_info_t pi; if (unw_get_proc_info_by_ip (unw_local_addr_space, - (unw_word_t) (uintptr_t) ip, &pi, 0) + (unw_word_t) (uintptr_t) ip, &pi, 0) < 0) return NULL; diff --git a/src/unwind/ForcedUnwind.c b/src/unwind/ForcedUnwind.c index bd334d35..da8a60e2 100644 --- a/src/unwind/ForcedUnwind.c +++ b/src/unwind/ForcedUnwind.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -27,7 +27,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ PROTECTED _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *exception_object, - _Unwind_Stop_Fn stop, void *stop_parameter) + _Unwind_Stop_Fn stop, void *stop_parameter) { struct _Unwind_Context context; unw_context_t uc; @@ -48,5 +48,5 @@ _Unwind_ForcedUnwind (struct _Unwind_Exception *exception_object, } _Unwind_Reason_Code __libunwind_Unwind_ForcedUnwind (struct _Unwind_Exception*, - _Unwind_Stop_Fn, void *) + _Unwind_Stop_Fn, void *) ALIAS (_Unwind_ForcedUnwind); diff --git a/src/unwind/GetBSP.c b/src/unwind/GetBSP.c index d53e4011..253fde05 100644 --- a/src/unwind/GetBSP.c +++ b/src/unwind/GetBSP.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/GetCFA.c b/src/unwind/GetCFA.c index bd8559b8..7975b1d3 100644 --- a/src/unwind/GetCFA.c +++ b/src/unwind/GetCFA.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/GetDataRelBase.c b/src/unwind/GetDataRelBase.c index cb604766..9bdd4cb0 100644 --- a/src/unwind/GetDataRelBase.c +++ b/src/unwind/GetDataRelBase.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/GetGR.c b/src/unwind/GetGR.c index 3a875e80..b7ab05c4 100644 --- a/src/unwind/GetGR.c +++ b/src/unwind/GetGR.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/GetIP.c b/src/unwind/GetIP.c index 6fd48a2e..e93853d0 100644 --- a/src/unwind/GetIP.c +++ b/src/unwind/GetIP.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/GetIPInfo.c b/src/unwind/GetIPInfo.c index b885ede2..9105396a 100644 --- a/src/unwind/GetIPInfo.c +++ b/src/unwind/GetIPInfo.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2009 Red Hat - Contributed by Jan Kratochvil + Contributed by Jan Kratochvil This file is part of libunwind. diff --git a/src/unwind/GetLanguageSpecificData.c b/src/unwind/GetLanguageSpecificData.c index eefcec75..df52c929 100644 --- a/src/unwind/GetLanguageSpecificData.c +++ b/src/unwind/GetLanguageSpecificData.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/GetRegionStart.c b/src/unwind/GetRegionStart.c index 11c34605..f0da3449 100644 --- a/src/unwind/GetRegionStart.c +++ b/src/unwind/GetRegionStart.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/GetTextRelBase.c b/src/unwind/GetTextRelBase.c index a53ca9b1..d0826e7f 100644 --- a/src/unwind/GetTextRelBase.c +++ b/src/unwind/GetTextRelBase.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/RaiseException.c b/src/unwind/RaiseException.c index 66a681db..cdf134a9 100644 --- a/src/unwind/RaiseException.c +++ b/src/unwind/RaiseException.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -47,36 +47,36 @@ _Unwind_RaiseException (struct _Unwind_Exception *exception_object) while (1) { if ((ret = unw_step (&context.cursor)) <= 0) - { - if (ret == 0) - { - Debug (1, "no handler found\n"); - return _URC_END_OF_STACK; - } - else - return _URC_FATAL_PHASE1_ERROR; - } + { + if (ret == 0) + { + Debug (1, "no handler found\n"); + return _URC_END_OF_STACK; + } + else + return _URC_FATAL_PHASE1_ERROR; + } if (unw_get_proc_info (&context.cursor, &pi) < 0) - return _URC_FATAL_PHASE1_ERROR; + return _URC_FATAL_PHASE1_ERROR; personality = (_Unwind_Personality_Fn) (uintptr_t) pi.handler; if (personality) - { - reason = (*personality) (_U_VERSION, _UA_SEARCH_PHASE, - exception_class, exception_object, - &context); - if (reason != _URC_CONTINUE_UNWIND) - { - if (reason == _URC_HANDLER_FOUND) - break; - else - { - Debug (1, "personality returned %d\n", reason); - return _URC_FATAL_PHASE1_ERROR; - } - } - } + { + reason = (*personality) (_U_VERSION, _UA_SEARCH_PHASE, + exception_class, exception_object, + &context); + if (reason != _URC_CONTINUE_UNWIND) + { + if (reason == _URC_HANDLER_FOUND) + break; + else + { + Debug (1, "personality returned %d\n", reason); + return _URC_FATAL_PHASE1_ERROR; + } + } + } } /* Exceptions are associated with IP-ranges. If a given exception @@ -86,8 +86,8 @@ _Unwind_RaiseException (struct _Unwind_Exception *exception_object) the exception. */ if (unw_get_reg (&context.cursor, UNW_REG_IP, &ip) < 0) return _URC_FATAL_PHASE1_ERROR; - exception_object->private_1 = 0; /* clear "stop" pointer */ - exception_object->private_2 = ip; /* save frame marker */ + exception_object->private_1 = 0; /* clear "stop" pointer */ + exception_object->private_2 = ip; /* save frame marker */ Debug (1, "found handler for IP=%lx; entering cleanup phase\n", (long) ip); diff --git a/src/unwind/Resume.c b/src/unwind/Resume.c index ddf9d2cc..dd0a44bc 100644 --- a/src/unwind/Resume.c +++ b/src/unwind/Resume.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/Resume_or_Rethrow.c b/src/unwind/Resume_or_Rethrow.c index ece0ced3..d60e0383 100644 --- a/src/unwind/Resume_or_Rethrow.c +++ b/src/unwind/Resume_or_Rethrow.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -34,7 +34,7 @@ _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exception_object) if (exception_object->private_1) { if (_Unwind_InitContext (&context, &uc) < 0) - return _URC_FATAL_PHASE2_ERROR; + return _URC_FATAL_PHASE2_ERROR; return _Unwind_Phase2 (exception_object, &context); } diff --git a/src/unwind/SetGR.c b/src/unwind/SetGR.c index 96533643..143b3549 100644 --- a/src/unwind/SetGR.c +++ b/src/unwind/SetGR.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -30,7 +30,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ PROTECTED void _Unwind_SetGR (struct _Unwind_Context *context, int index, - unsigned long new_value) + unsigned long new_value) { #ifdef UNW_TARGET_X86 index = dwarf_to_unw_regnum(index); diff --git a/src/unwind/SetIP.c b/src/unwind/SetIP.c index 0652a14a..c55ab971 100644 --- a/src/unwind/SetIP.c +++ b/src/unwind/SetIP.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/unwind/unwind-internal.h b/src/unwind/unwind-internal.h index 130cb81a..c68fc3c5 100644 --- a/src/unwind/unwind-internal.h +++ b/src/unwind/unwind-internal.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -35,28 +35,28 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" /* The version of the _Unwind_*() interface implemented by this code. */ -#define _U_VERSION 1 +#define _U_VERSION 1 typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) - (int, _Unwind_Action, uint64_t, struct _Unwind_Exception *, - struct _Unwind_Context *); + (int, _Unwind_Action, uint64_t, struct _Unwind_Exception *, + struct _Unwind_Context *); struct _Unwind_Context { unw_cursor_t cursor; - int end_of_stack; /* set to 1 if the end of stack was reached */ + int end_of_stack; /* set to 1 if the end of stack was reached */ }; /* This must be a macro because unw_getcontext() must be invoked from the callee, even if optimization (and hence inlining) is turned off. The macro arguments MUST NOT have any side-effects. */ -#define _Unwind_InitContext(context, uc) \ - ((context)->end_of_stack = 0, \ +#define _Unwind_InitContext(context, uc) \ + ((context)->end_of_stack = 0, \ ((unw_getcontext (uc) < 0 || unw_init_local (&(context)->cursor, uc) < 0) \ ? -1 : 0)) static _Unwind_Reason_Code ALWAYS_INLINE _Unwind_Phase2 (struct _Unwind_Exception *exception_object, - struct _Unwind_Context *context) + struct _Unwind_Context *context) { _Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) exception_object->private_1; uint64_t exception_class = exception_object->exception_class; @@ -76,65 +76,65 @@ _Unwind_Phase2 (struct _Unwind_Exception *exception_object, { ret = unw_step (&context->cursor); if (ret <= 0) - { - if (ret == 0) - { - actions |= _UA_END_OF_STACK; - context->end_of_stack = 1; - } - else - return _URC_FATAL_PHASE2_ERROR; - } + { + if (ret == 0) + { + actions |= _UA_END_OF_STACK; + context->end_of_stack = 1; + } + else + return _URC_FATAL_PHASE2_ERROR; + } if (stop) - { - reason = (*stop) (_U_VERSION, actions, exception_class, - exception_object, context, stop_parameter); - if (reason != _URC_NO_REASON) - /* Stop function may return _URC_FATAL_PHASE2_ERROR if - it's unable to handle end-of-stack condition or - _URC_FATAL_PHASE2_ERROR if something is wrong. Not - that it matters: the resulting state is indeterminate - anyhow so we must return _URC_FATAL_PHASE2_ERROR... */ - return _URC_FATAL_PHASE2_ERROR; - } + { + reason = (*stop) (_U_VERSION, actions, exception_class, + exception_object, context, stop_parameter); + if (reason != _URC_NO_REASON) + /* Stop function may return _URC_FATAL_PHASE2_ERROR if + it's unable to handle end-of-stack condition or + _URC_FATAL_PHASE2_ERROR if something is wrong. Not + that it matters: the resulting state is indeterminate + anyhow so we must return _URC_FATAL_PHASE2_ERROR... */ + return _URC_FATAL_PHASE2_ERROR; + } if (context->end_of_stack - || unw_get_proc_info (&context->cursor, &pi) < 0) - return _URC_FATAL_PHASE2_ERROR; + || unw_get_proc_info (&context->cursor, &pi) < 0) + return _URC_FATAL_PHASE2_ERROR; personality = (_Unwind_Personality_Fn) (uintptr_t) pi.handler; if (personality) - { - if (!stop) - { - if (unw_get_reg (&context->cursor, UNW_REG_IP, &ip) < 0) - return _URC_FATAL_PHASE2_ERROR; + { + if (!stop) + { + if (unw_get_reg (&context->cursor, UNW_REG_IP, &ip) < 0) + return _URC_FATAL_PHASE2_ERROR; - if ((unsigned long) stop_parameter == ip) - actions |= _UA_HANDLER_FRAME; - } + if ((unsigned long) stop_parameter == ip) + actions |= _UA_HANDLER_FRAME; + } - reason = (*personality) (_U_VERSION, actions, exception_class, - exception_object, context); - if (reason != _URC_CONTINUE_UNWIND) - { - if (reason == _URC_INSTALL_CONTEXT) - { - /* we may regain control via _Unwind_Resume() */ - unw_resume (&context->cursor); - abort (); - } - else - return _URC_FATAL_PHASE2_ERROR; - } - if (actions & _UA_HANDLER_FRAME) - /* The personality routine for the handler-frame changed - it's mind; that's a no-no... */ - abort (); - } + reason = (*personality) (_U_VERSION, actions, exception_class, + exception_object, context); + if (reason != _URC_CONTINUE_UNWIND) + { + if (reason == _URC_INSTALL_CONTEXT) + { + /* we may regain control via _Unwind_Resume() */ + unw_resume (&context->cursor); + abort (); + } + else + return _URC_FATAL_PHASE2_ERROR; + } + if (actions & _UA_HANDLER_FRAME) + /* The personality routine for the handler-frame changed + it's mind; that's a no-no... */ + abort (); + } } - return _URC_FATAL_PHASE2_ERROR; /* shouldn't be reached */ + return _URC_FATAL_PHASE2_ERROR; /* shouldn't be reached */ } #endif /* unwind_internal_h */ diff --git a/src/x86/Gcreate_addr_space.c b/src/x86/Gcreate_addr_space.c index 5b07940d..45fec6da 100644 --- a/src/x86/Gcreate_addr_space.c +++ b/src/x86/Gcreate_addr_space.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/x86/Gget_proc_info.c b/src/x86/Gget_proc_info.c index a5334830..45b4cd5b 100644 --- a/src/x86/Gget_proc_info.c +++ b/src/x86/Gget_proc_info.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -33,8 +33,8 @@ unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) if (dwarf_make_proc_info (&c->dwarf) < 0) { /* On x86, it's relatively common to be missing DWARF unwind - info. We don't want to fail in that case, because the - frame-chain still would let us do a backtrace at least. */ + info. We don't want to fail in that case, because the + frame-chain still would let us do a backtrace at least. */ memset (pi, 0, sizeof (*pi)); pi->start_ip = c->dwarf.ip; pi->end_ip = c->dwarf.ip + 1; diff --git a/src/x86/Gget_save_loc.c b/src/x86/Gget_save_loc.c index e8cc79ee..d440f9ec 100644 --- a/src/x86/Gget_save_loc.c +++ b/src/x86/Gget_save_loc.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -31,7 +31,7 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) struct cursor *c = (struct cursor *) cursor; dwarf_loc_t loc; - loc = DWARF_NULL_LOC; /* default to "not saved" */ + loc = DWARF_NULL_LOC; /* default to "not saved" */ switch (reg) { diff --git a/src/x86/Gglobal.c b/src/x86/Gglobal.c index 033a788b..132b8249 100644 --- a/src/x86/Gglobal.c +++ b/src/x86/Gglobal.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -60,7 +60,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY x86_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&x86_lock, saved_mask); diff --git a/src/x86/Ginit.c b/src/x86/Ginit.c index b8890a3c..b05a08ed 100644 --- a/src/x86/Ginit.c +++ b/src/x86/Ginit.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -69,14 +69,14 @@ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; return 0; } #define PAGE_SIZE 4096 -#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1)) +#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1)) /* Cache of already validated addresses */ #define NLGA 4 @@ -105,7 +105,7 @@ validate_mem (unw_word_t addr) for (i = 0; i < NLGA; i++) { if (last_good_addr[i] && (addr == last_good_addr[i])) - return 0; + return 0; } #ifdef HAVE_MINCORE @@ -134,7 +134,7 @@ validate_mem (unw_word_t addr) static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (write) { @@ -155,7 +155,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, - void *arg) + void *arg) { unw_word_t *addr; ucontext_t *uc = ((struct cursor *)arg)->uc; @@ -185,7 +185,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = ((struct cursor *)arg)->uc; unw_fpreg_t *addr; @@ -199,14 +199,14 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, if (write) { Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); *(unw_fpreg_t *) addr = *val; } else { *val = *(unw_fpreg_t *) addr; Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); } return 0; @@ -218,8 +218,8 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return _Uelf32_get_proc_name (as, getpid (), ip, buf, buf_len, offp); } diff --git a/src/x86/Ginit_local.c b/src/x86/Ginit_local.c index 412663be..02fb994e 100644 --- a/src/x86/Ginit_local.c +++ b/src/x86/Ginit_local.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/x86/Ginit_remote.c b/src/x86/Ginit_remote.c index c8899054..16b63954 100644 --- a/src/x86/Ginit_remote.c +++ b/src/x86/Ginit_remote.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. diff --git a/src/x86/Gos-freebsd.c b/src/x86/Gos-freebsd.c index 284148c2..cf05f078 100644 --- a/src/x86/Gos-freebsd.c +++ b/src/x86/Gos-freebsd.c @@ -51,21 +51,21 @@ unw_is_signal_frame (unw_cursor_t *cursor) /* Check if EIP points at sigreturn() sequence. It can be: sigcode+4: from amd64 freebsd32 environment -8d 44 24 20 lea 0x20(%esp),%eax -50 push %eax -b8 a1 01 00 00 mov $0x1a1,%eax -50 push %eax -cd 80 int $0x80 +8d 44 24 20 lea 0x20(%esp),%eax +50 push %eax +b8 a1 01 00 00 mov $0x1a1,%eax +50 push %eax +cd 80 int $0x80 sigcode+4: from real i386 -8d 44 24 20 lea 0x20(%esp),%eax -50 push %eax -f7 40 54 00 02 00 testl $0x20000,0x54(%eax) -75 03 jne sigcode+21 -8e 68 14 mov 0x14(%eax),%gs -b8 a1 01 00 00 mov $0x1a1,%eax -50 push %eax -cd 80 int $0x80 +8d 44 24 20 lea 0x20(%esp),%eax +50 push %eax +f7 40 54 00 02 00 testl $0x20000,0x54(%eax) +75 03 jne sigcode+21 +8e 68 14 mov 0x14(%eax),%gs +b8 a1 01 00 00 mov $0x1a1,%eax +50 push %eax +cd 80 int $0x80 freebsd4_sigcode+4: XXX @@ -85,10 +85,10 @@ XXX ret = X86_SCF_FREEBSD_SIGFRAME; else { if ((*a->access_mem) (as, ip + 16, &w4, 0, arg) < 0 || - (*a->access_mem) (as, ip + 20, &w5, 0, arg) < 0) + (*a->access_mem) (as, ip + 20, &w5, 0, arg) < 0) return ret; if (w0 == 0x2024448d && w1 == 0x5440f750 && w2 == 0x75000200 && - w3 == 0x14688e03 && w4 == 0x0001a1b8 && w5 == 0x80cd5000) + w3 == 0x14688e03 && w4 == 0x0001a1b8 && w5 == 0x80cd5000) ret = X86_SCF_FREEBSD_SIGFRAME; } @@ -120,8 +120,8 @@ unw_handle_signal_frame (unw_cursor_t *cursor) ret = dwarf_get (&c->dwarf, esp_loc, &c->dwarf.cfa); if (ret < 0) { - Debug (2, "returning 0\n"); - return 0; + Debug (2, "returning 0\n"); + return 0; } c->dwarf.loc[EIP] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EIP_OFF, 0); @@ -290,20 +290,20 @@ x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg) if (is_fpstate) { if ((ret = dwarf_get (&c->dwarf, - DWARF_MEM_LOC (&c->dwarf, addr + FREEBSD_UC_MCONTEXT_FPSTATE_OFF), - &fpstate)) < 0) - return DWARF_NULL_LOC; + DWARF_MEM_LOC (&c->dwarf, addr + FREEBSD_UC_MCONTEXT_FPSTATE_OFF), + &fpstate)) < 0) + return DWARF_NULL_LOC; if (fpstate == FREEBSD_UC_MCONTEXT_FPOWNED_NONE) - return DWARF_NULL_LOC; + return DWARF_NULL_LOC; if ((ret = dwarf_get (&c->dwarf, - DWARF_MEM_LOC (&c->dwarf, addr + FREEBSD_UC_MCONTEXT_FPFORMAT_OFF), - &fpformat)) < 0) - return DWARF_NULL_LOC; + DWARF_MEM_LOC (&c->dwarf, addr + FREEBSD_UC_MCONTEXT_FPFORMAT_OFF), + &fpformat)) < 0) + return DWARF_NULL_LOC; if (fpformat == FREEBSD_UC_MCONTEXT_FPFMT_NODEV || - (is_xmmstate && fpformat != FREEBSD_UC_MCONTEXT_FPFMT_XMM)) - return DWARF_NULL_LOC; + (is_xmmstate && fpformat != FREEBSD_UC_MCONTEXT_FPFMT_XMM)) + return DWARF_NULL_LOC; if (is_xmmstate) - off = xmm_off; + off = xmm_off; } return DWARF_MEM_LOC (c, addr + off); diff --git a/src/x86/Gos-linux.c b/src/x86/Gos-linux.c index 8bc24a8c..17aebc29 100644 --- a/src/x86/Gos-linux.c +++ b/src/x86/Gos-linux.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -43,9 +43,9 @@ unw_is_signal_frame (unw_cursor_t *cursor) /* Check if EIP points at sigreturn() sequence. On Linux, this is: __restore: - 0x58 pop %eax - 0xb8 0x77 0x00 0x00 0x00 movl 0x77,%eax - 0xcd 0x80 int 0x80 + 0x58 pop %eax + 0xb8 0x77 0x00 0x00 0x00 movl 0x77,%eax + 0xcd 0x80 int 0x80 without SA_SIGINFO, and @@ -62,7 +62,7 @@ unw_is_signal_frame (unw_cursor_t *cursor) ret = 0; else ret = ((w0 == 0x0077b858 && w1 == 0x80cd0000) - || (w0 == 0x0000adb8 && (w1 & 0xffffff) == 0x80cd00)); + || (w0 == 0x0000adb8 && (w1 & 0xffffff) == 0x80cd00)); Debug (16, "returning %d\n", ret); return ret; } @@ -87,7 +87,7 @@ unw_handle_signal_frame (unw_cursor_t *cursor) siginfo_ptr_loc = DWARF_LOC (siginfo_ptr_addr, 0); sigcontext_ptr_loc = DWARF_LOC (sigcontext_ptr_addr, 0); ret = (dwarf_get (&c->dwarf, siginfo_ptr_loc, &siginfo_ptr) - | dwarf_get (&c->dwarf, sigcontext_ptr_loc, &sigcontext_ptr)); + | dwarf_get (&c->dwarf, sigcontext_ptr_loc, &sigcontext_ptr)); if (ret < 0) { Debug (2, "returning 0\n"); @@ -105,10 +105,10 @@ unw_handle_signal_frame (unw_cursor_t *cursor) else { /* If SA_SIGINFO were not specified, we actually read - various segment pointers instead. We believe that at - least fs and _fsh are always zero for linux, so it is - not just unlikely, but impossible that we would end - up here. */ + various segment pointers instead. We believe that at + least fs and _fsh are always zero for linux, so it is + not just unlikely, but impossible that we would end + up here. */ c->sigcontext_format = X86_SCF_LINUX_RT_SIGFRAME; c->sigcontext_addr = sigcontext_ptr; sc_addr = sigcontext_ptr + LINUX_UC_MCONTEXT_OFF; @@ -180,8 +180,8 @@ x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg) case UNW_X86_SS: off = LINUX_SC_SS_OFF; break; /* The following is probably not correct for all possible cases. - Somebody who understands this better should review this for - correctness. */ + Somebody who understands this better should review this for + correctness. */ case UNW_X86_FCW: is_fpstate = 1; off = LINUX_FPSTATE_CW_OFF; break; case UNW_X86_FSW: is_fpstate = 1; off = LINUX_FPSTATE_SW_OFF; break; @@ -233,13 +233,13 @@ x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg) if (is_fpstate) { if ((ret = dwarf_get (&c->dwarf, - DWARF_MEM_LOC (&c->dwarf, - addr + LINUX_SC_FPSTATE_OFF), - &fpstate_addr)) < 0) - return DWARF_NULL_LOC; + DWARF_MEM_LOC (&c->dwarf, + addr + LINUX_SC_FPSTATE_OFF), + &fpstate_addr)) < 0) + return DWARF_NULL_LOC; if (!fpstate_addr) - return DWARF_NULL_LOC; + return DWARF_NULL_LOC; return DWARF_MEM_LOC (c, fpstate_addr + off); } diff --git a/src/x86/Gregs.c b/src/x86/Gregs.c index 05bc1a30..4a959261 100644 --- a/src/x86/Gregs.c +++ b/src/x86/Gregs.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -37,7 +37,7 @@ x86_scratch_loc (struct cursor *c, unw_regnum_t reg) HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { dwarf_loc_t loc = DWARF_NULL_LOC; unsigned int mask; @@ -48,14 +48,14 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, case UNW_X86_EIP: if (write) - c->dwarf.ip = *valp; /* also update the EIP cache */ + c->dwarf.ip = *valp; /* also update the EIP cache */ loc = c->dwarf.loc[EIP]; break; case UNW_X86_CFA: case UNW_X86_ESP: if (write) - return -UNW_EREADONLYREG; + return -UNW_EREADONLYREG; *valp = c->dwarf.cfa; return 0; @@ -64,18 +64,18 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, arg_num = reg - UNW_X86_EAX; mask = (1 << arg_num); if (write) - { - c->dwarf.eh_args[arg_num] = *valp; - c->dwarf.eh_valid_mask |= mask; - return 0; - } + { + c->dwarf.eh_args[arg_num] = *valp; + c->dwarf.eh_valid_mask |= mask; + return 0; + } else if ((c->dwarf.eh_valid_mask & mask) != 0) - { - *valp = c->dwarf.eh_args[arg_num]; - return 0; - } + { + *valp = c->dwarf.eh_args[arg_num]; + return 0; + } else - loc = c->dwarf.loc[(reg == UNW_X86_EAX) ? EAX : EDX]; + loc = c->dwarf.loc[(reg == UNW_X86_EAX) ? EAX : EDX]; break; case UNW_X86_ECX: loc = c->dwarf.loc[ECX]; break; @@ -120,7 +120,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, - int write) + int write) { struct dwarf_loc loc = DWARF_NULL_LOC; diff --git a/src/x86/Gresume.c b/src/x86/Gresume.c index c39c5884..cb3fb31e 100644 --- a/src/x86/Gresume.c +++ b/src/x86/Gresume.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -35,9 +35,9 @@ static inline int establish_machine_state (struct cursor *c) { int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, - int write, void *); + int write, void *); int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, - int write, void *); + int write, void *); unw_addr_space_t as = c->dwarf.as; void *arg = c->dwarf.as_arg; unw_fpreg_t fpval; @@ -53,15 +53,15 @@ establish_machine_state (struct cursor *c) { Debug (16, "copying %s %d\n", unw_regname (reg), reg); if (unw_is_fpreg (reg)) - { - if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) - (*access_fpreg) (as, reg, &fpval, 1, arg); - } + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + (*access_fpreg) (as, reg, &fpval, 1, arg); + } else - { - if (tdep_access_reg (c, reg, &val, 0) >= 0) - (*access_reg) (as, reg, &val, 1, arg); - } + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + (*access_reg) (as, reg, &val, 1, arg); + } } return 0; } @@ -78,5 +78,5 @@ unw_resume (unw_cursor_t *cursor) return ret; return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, - c->dwarf.as_arg); + c->dwarf.as_arg); } diff --git a/src/x86/Gstep.c b/src/x86/Gstep.c index fb1d6a26..10e2cbc8 100644 --- a/src/x86/Gstep.c +++ b/src/x86/Gstep.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -46,7 +46,7 @@ unw_step (unw_cursor_t *cursor) if (unlikely (ret < 0)) { /* DWARF failed, let's see if we can follow the frame-chain - or skip over the signal trampoline. */ + or skip over the signal trampoline. */ struct dwarf_loc ebp_loc, eip_loc; /* We could get here because of missing/bad unwind information. @@ -58,57 +58,57 @@ unw_step (unw_cursor_t *cursor) if (unw_is_signal_frame (cursor)) { ret = unw_handle_signal_frame(cursor); - if (ret < 0) - { - Debug (2, "returning 0\n"); - return 0; - } + if (ret < 0) + { + Debug (2, "returning 0\n"); + return 0; + } } else - { - ret = dwarf_get (&c->dwarf, c->dwarf.loc[EBP], &c->dwarf.cfa); - if (ret < 0) - { - Debug (2, "returning %d\n", ret); - return ret; - } + { + ret = dwarf_get (&c->dwarf, c->dwarf.loc[EBP], &c->dwarf.cfa); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } - Debug (13, "[EBP=0x%x] = 0x%x\n", DWARF_GET_LOC (c->dwarf.loc[EBP]), - c->dwarf.cfa); + Debug (13, "[EBP=0x%x] = 0x%x\n", DWARF_GET_LOC (c->dwarf.loc[EBP]), + c->dwarf.cfa); - ebp_loc = DWARF_LOC (c->dwarf.cfa, 0); - eip_loc = DWARF_LOC (c->dwarf.cfa + 4, 0); - c->dwarf.cfa += 8; + ebp_loc = DWARF_LOC (c->dwarf.cfa, 0); + eip_loc = DWARF_LOC (c->dwarf.cfa + 4, 0); + c->dwarf.cfa += 8; - /* Mark all registers unsaved, since we don't know where - they are saved (if at all), except for the EBP and - EIP. */ - for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) - c->dwarf.loc[i] = DWARF_NULL_LOC; + /* Mark all registers unsaved, since we don't know where + they are saved (if at all), except for the EBP and + EIP. */ + for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; c->dwarf.loc[EBP] = ebp_loc; c->dwarf.loc[EIP] = eip_loc; c->dwarf.use_prev_instr = 1; - } + } c->dwarf.ret_addr_column = EIP; if (!DWARF_IS_NULL_LOC (c->dwarf.loc[EBP])) - { - ret = dwarf_get (&c->dwarf, c->dwarf.loc[EIP], &c->dwarf.ip); - if (ret < 0) - { - Debug (13, "dwarf_get([EIP=0x%x]) failed\n", DWARF_GET_LOC (c->dwarf.loc[EIP])); - Debug (2, "returning %d\n", ret); - return ret; - } - else - { - Debug (13, "[EIP=0x%x] = 0x%x\n", DWARF_GET_LOC (c->dwarf.loc[EIP]), - c->dwarf.ip); - } - } + { + ret = dwarf_get (&c->dwarf, c->dwarf.loc[EIP], &c->dwarf.ip); + if (ret < 0) + { + Debug (13, "dwarf_get([EIP=0x%x]) failed\n", DWARF_GET_LOC (c->dwarf.loc[EIP])); + Debug (2, "returning %d\n", ret); + return ret; + } + else + { + Debug (13, "[EIP=0x%x] = 0x%x\n", DWARF_GET_LOC (c->dwarf.loc[EIP]), + c->dwarf.ip); + } + } else - c->dwarf.ip = 0; + c->dwarf.ip = 0; } ret = (c->dwarf.ip == 0) ? 0 : 1; Debug (2, "returning %d\n", ret); diff --git a/src/x86/init.h b/src/x86/init.h index f35387d4..027aedc3 100644 --- a/src/x86/init.h +++ b/src/x86/init.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -50,7 +50,7 @@ common_init (struct cursor *c, unsigned use_prev_instr) return ret; ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_X86_ESP), - &c->dwarf.cfa); + &c->dwarf.cfa); if (ret < 0) return ret; diff --git a/src/x86/is_fpreg.c b/src/x86/is_fpreg.c index 8f1536d1..addf9bca 100644 --- a/src/x86/is_fpreg.c +++ b/src/x86/is_fpreg.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -29,6 +29,6 @@ PROTECTED int unw_is_fpreg (int regnum) { return ((regnum >= UNW_X86_ST0 && regnum <= UNW_X86_ST7) - || (regnum >= UNW_X86_XMM0_lo && regnum <= UNW_X86_XMM7_hi) - || (regnum >= UNW_X86_XMM0 && regnum <= UNW_X86_XMM7)); + || (regnum >= UNW_X86_XMM0_lo && regnum <= UNW_X86_XMM7_hi) + || (regnum >= UNW_X86_XMM0 && regnum <= UNW_X86_XMM7)); } diff --git a/src/x86/offsets.h b/src/x86/offsets.h index e8a255cd..e5aec7f5 100644 --- a/src/x86/offsets.h +++ b/src/x86/offsets.h @@ -4,137 +4,137 @@ /* Offsets for x86 Linux "ucontext_t": */ -#define LINUX_UC_FLAGS_OFF 0x00 -#define LINUX_UC_LINK_OFF 0x04 -#define LINUX_UC_STACK_OFF 0x08 -#define LINUX_UC_MCONTEXT_OFF 0x14 -#define LINUX_UC_SIGMASK_OFF 0x6c -#define LINUX_UC_FPREGS_MEM_OFF 0xec +#define LINUX_UC_FLAGS_OFF 0x00 +#define LINUX_UC_LINK_OFF 0x04 +#define LINUX_UC_STACK_OFF 0x08 +#define LINUX_UC_MCONTEXT_OFF 0x14 +#define LINUX_UC_SIGMASK_OFF 0x6c +#define LINUX_UC_FPREGS_MEM_OFF 0xec /* The struct sigcontext is located at an offset of 4 from the stack pointer in the signal frame. */ /* Offsets for x86 Linux "struct sigcontext": */ -#define LINUX_SC_GS_OFF 0x00 -#define LINUX_SC_GSH_OFF 0x02 -#define LINUX_SC_FS_OFF 0x04 -#define LINUX_SC_FSH_OFF 0x06 -#define LINUX_SC_ES_OFF 0x08 -#define LINUX_SC_ESH_OFF 0x0a -#define LINUX_SC_DS_OFF 0x0c -#define LINUX_SC_DSH_OFF 0x0e -#define LINUX_SC_EDI_OFF 0x10 -#define LINUX_SC_ESI_OFF 0x14 -#define LINUX_SC_EBP_OFF 0x18 -#define LINUX_SC_ESP_OFF 0x1c -#define LINUX_SC_EBX_OFF 0x20 -#define LINUX_SC_EDX_OFF 0x24 -#define LINUX_SC_ECX_OFF 0x28 -#define LINUX_SC_EAX_OFF 0x2c -#define LINUX_SC_TRAPNO_OFF 0x30 -#define LINUX_SC_ERR_OFF 0x34 -#define LINUX_SC_EIP_OFF 0x38 -#define LINUX_SC_CS_OFF 0x3c -#define LINUX_SC_CSH_OFF 0x3e -#define LINUX_SC_EFLAGS_OFF 0x40 -#define LINUX_SC_ESP_AT_SIGNAL_OFF 0x44 -#define LINUX_SC_SS_OFF 0x48 -#define LINUX_SC_SSH_OFF 0x4a -#define LINUX_SC_FPSTATE_OFF 0x4c -#define LINUX_SC_OLDMASK_OFF 0x50 -#define LINUX_SC_CR2_OFF 0x54 +#define LINUX_SC_GS_OFF 0x00 +#define LINUX_SC_GSH_OFF 0x02 +#define LINUX_SC_FS_OFF 0x04 +#define LINUX_SC_FSH_OFF 0x06 +#define LINUX_SC_ES_OFF 0x08 +#define LINUX_SC_ESH_OFF 0x0a +#define LINUX_SC_DS_OFF 0x0c +#define LINUX_SC_DSH_OFF 0x0e +#define LINUX_SC_EDI_OFF 0x10 +#define LINUX_SC_ESI_OFF 0x14 +#define LINUX_SC_EBP_OFF 0x18 +#define LINUX_SC_ESP_OFF 0x1c +#define LINUX_SC_EBX_OFF 0x20 +#define LINUX_SC_EDX_OFF 0x24 +#define LINUX_SC_ECX_OFF 0x28 +#define LINUX_SC_EAX_OFF 0x2c +#define LINUX_SC_TRAPNO_OFF 0x30 +#define LINUX_SC_ERR_OFF 0x34 +#define LINUX_SC_EIP_OFF 0x38 +#define LINUX_SC_CS_OFF 0x3c +#define LINUX_SC_CSH_OFF 0x3e +#define LINUX_SC_EFLAGS_OFF 0x40 +#define LINUX_SC_ESP_AT_SIGNAL_OFF 0x44 +#define LINUX_SC_SS_OFF 0x48 +#define LINUX_SC_SSH_OFF 0x4a +#define LINUX_SC_FPSTATE_OFF 0x4c +#define LINUX_SC_OLDMASK_OFF 0x50 +#define LINUX_SC_CR2_OFF 0x54 /* Offsets for x86 Linux "struct _fpstate": */ -#define LINUX_FPSTATE_CW_OFF 0x000 -#define LINUX_FPSTATE_SW_OFF 0x004 -#define LINUX_FPSTATE_TAG_OFF 0x008 -#define LINUX_FPSTATE_IPOFF_OFF 0x00c -#define LINUX_FPSTATE_CSSEL_OFF 0x010 -#define LINUX_FPSTATE_DATAOFF_OFF 0x014 -#define LINUX_FPSTATE_DATASEL_OFF 0x018 -#define LINUX_FPSTATE_ST0_OFF 0x01c -#define LINUX_FPSTATE_ST1_OFF 0x026 -#define LINUX_FPSTATE_ST2_OFF 0x030 -#define LINUX_FPSTATE_ST3_OFF 0x03a -#define LINUX_FPSTATE_ST4_OFF 0x044 -#define LINUX_FPSTATE_ST5_OFF 0x04e -#define LINUX_FPSTATE_ST6_OFF 0x058 -#define LINUX_FPSTATE_ST7_OFF 0x062 -#define LINUX_FPSTATE_STATUS_OFF 0x06c -#define LINUX_FPSTATE_MAGIC_OFF 0x06e -#define LINUX_FPSTATE_FXSR_ENV_OFF 0x070 -#define LINUX_FPSTATE_MXCSR_OFF 0x088 -#define LINUX_FPSTATE_FXSR_ST0_OFF 0x090 -#define LINUX_FPSTATE_FXSR_ST1_OFF 0x0a0 -#define LINUX_FPSTATE_FXSR_ST2_OFF 0x0b0 -#define LINUX_FPSTATE_FXSR_ST3_OFF 0x0c0 -#define LINUX_FPSTATE_FXSR_ST4_OFF 0x0d0 -#define LINUX_FPSTATE_FXSR_ST5_OFF 0x0e0 -#define LINUX_FPSTATE_FXSR_ST6_OFF 0x0f0 -#define LINUX_FPSTATE_FXSR_ST7_OFF 0x100 -#define LINUX_FPSTATE_XMM0_OFF 0x110 -#define LINUX_FPSTATE_XMM1_OFF 0x120 -#define LINUX_FPSTATE_XMM2_OFF 0x130 -#define LINUX_FPSTATE_XMM3_OFF 0x140 -#define LINUX_FPSTATE_XMM4_OFF 0x150 -#define LINUX_FPSTATE_XMM5_OFF 0x160 -#define LINUX_FPSTATE_XMM6_OFF 0x170 -#define LINUX_FPSTATE_XMM7_OFF 0x180 +#define LINUX_FPSTATE_CW_OFF 0x000 +#define LINUX_FPSTATE_SW_OFF 0x004 +#define LINUX_FPSTATE_TAG_OFF 0x008 +#define LINUX_FPSTATE_IPOFF_OFF 0x00c +#define LINUX_FPSTATE_CSSEL_OFF 0x010 +#define LINUX_FPSTATE_DATAOFF_OFF 0x014 +#define LINUX_FPSTATE_DATASEL_OFF 0x018 +#define LINUX_FPSTATE_ST0_OFF 0x01c +#define LINUX_FPSTATE_ST1_OFF 0x026 +#define LINUX_FPSTATE_ST2_OFF 0x030 +#define LINUX_FPSTATE_ST3_OFF 0x03a +#define LINUX_FPSTATE_ST4_OFF 0x044 +#define LINUX_FPSTATE_ST5_OFF 0x04e +#define LINUX_FPSTATE_ST6_OFF 0x058 +#define LINUX_FPSTATE_ST7_OFF 0x062 +#define LINUX_FPSTATE_STATUS_OFF 0x06c +#define LINUX_FPSTATE_MAGIC_OFF 0x06e +#define LINUX_FPSTATE_FXSR_ENV_OFF 0x070 +#define LINUX_FPSTATE_MXCSR_OFF 0x088 +#define LINUX_FPSTATE_FXSR_ST0_OFF 0x090 +#define LINUX_FPSTATE_FXSR_ST1_OFF 0x0a0 +#define LINUX_FPSTATE_FXSR_ST2_OFF 0x0b0 +#define LINUX_FPSTATE_FXSR_ST3_OFF 0x0c0 +#define LINUX_FPSTATE_FXSR_ST4_OFF 0x0d0 +#define LINUX_FPSTATE_FXSR_ST5_OFF 0x0e0 +#define LINUX_FPSTATE_FXSR_ST6_OFF 0x0f0 +#define LINUX_FPSTATE_FXSR_ST7_OFF 0x100 +#define LINUX_FPSTATE_XMM0_OFF 0x110 +#define LINUX_FPSTATE_XMM1_OFF 0x120 +#define LINUX_FPSTATE_XMM2_OFF 0x130 +#define LINUX_FPSTATE_XMM3_OFF 0x140 +#define LINUX_FPSTATE_XMM4_OFF 0x150 +#define LINUX_FPSTATE_XMM5_OFF 0x160 +#define LINUX_FPSTATE_XMM6_OFF 0x170 +#define LINUX_FPSTATE_XMM7_OFF 0x180 /* FreeBSD-specific definitions: */ -#define FREEBSD_SC_UCONTEXT_OFF 0x20 -#define FREEBSD_UC_MCONTEXT_OFF 0x10 +#define FREEBSD_SC_UCONTEXT_OFF 0x20 +#define FREEBSD_UC_MCONTEXT_OFF 0x10 -#define FREEBSD_UC_MCONTEXT_GS_OFF 0x14 -#define FREEBSD_UC_MCONTEXT_FS_OFF 0x18 -#define FREEBSD_UC_MCONTEXT_ES_OFF 0x1c -#define FREEBSD_UC_MCONTEXT_DS_OFF 0x20 -#define FREEBSD_UC_MCONTEXT_EDI_OFF 0x24 -#define FREEBSD_UC_MCONTEXT_ESI_OFF 0x28 -#define FREEBSD_UC_MCONTEXT_EBP_OFF 0x2c -#define FREEBSD_UC_MCONTEXT_EBX_OFF 0x34 -#define FREEBSD_UC_MCONTEXT_EDX_OFF 0x38 -#define FREEBSD_UC_MCONTEXT_ECX_OFF 0x3c -#define FREEBSD_UC_MCONTEXT_EAX_OFF 0x40 -#define FREEBSD_UC_MCONTEXT_TRAPNO_OFF 0x44 -#define FREEBSD_UC_MCONTEXT_EIP_OFF 0x4c -#define FREEBSD_UC_MCONTEXT_ESP_OFF 0x58 -#define FREEBSD_UC_MCONTEXT_CS_OFF 0x50 -#define FREEBSD_UC_MCONTEXT_EFLAGS_OFF 0x54 -#define FREEBSD_UC_MCONTEXT_SS_OFF 0x5c -#define FREEBSD_UC_MCONTEXT_MC_LEN_OFF 0x60 +#define FREEBSD_UC_MCONTEXT_GS_OFF 0x14 +#define FREEBSD_UC_MCONTEXT_FS_OFF 0x18 +#define FREEBSD_UC_MCONTEXT_ES_OFF 0x1c +#define FREEBSD_UC_MCONTEXT_DS_OFF 0x20 +#define FREEBSD_UC_MCONTEXT_EDI_OFF 0x24 +#define FREEBSD_UC_MCONTEXT_ESI_OFF 0x28 +#define FREEBSD_UC_MCONTEXT_EBP_OFF 0x2c +#define FREEBSD_UC_MCONTEXT_EBX_OFF 0x34 +#define FREEBSD_UC_MCONTEXT_EDX_OFF 0x38 +#define FREEBSD_UC_MCONTEXT_ECX_OFF 0x3c +#define FREEBSD_UC_MCONTEXT_EAX_OFF 0x40 +#define FREEBSD_UC_MCONTEXT_TRAPNO_OFF 0x44 +#define FREEBSD_UC_MCONTEXT_EIP_OFF 0x4c +#define FREEBSD_UC_MCONTEXT_ESP_OFF 0x58 +#define FREEBSD_UC_MCONTEXT_CS_OFF 0x50 +#define FREEBSD_UC_MCONTEXT_EFLAGS_OFF 0x54 +#define FREEBSD_UC_MCONTEXT_SS_OFF 0x5c +#define FREEBSD_UC_MCONTEXT_MC_LEN_OFF 0x60 #define FREEBSD_UC_MCONTEXT_FPFORMAT_OFF 0x64 -#define FREEBSD_UC_MCONTEXT_OWNEDFP_OFF 0x68 -#define FREEBSD_UC_MCONTEXT_FPSTATE_OFF 0x70 +#define FREEBSD_UC_MCONTEXT_OWNEDFP_OFF 0x68 +#define FREEBSD_UC_MCONTEXT_FPSTATE_OFF 0x70 -#define FREEBSD_UC_MCONTEXT_CW_OFF 0x70 -#define FREEBSD_UC_MCONTEXT_SW_OFF 0x74 -#define FREEBSD_UC_MCONTEXT_TAG_OFF 0x78 -#define FREEBSD_UC_MCONTEXT_IPOFF_OFF 0x7c -#define FREEBSD_UC_MCONTEXT_CSSEL_OFF 0x80 -#define FREEBSD_UC_MCONTEXT_DATAOFF_OFF 0x84 -#define FREEBSD_US_MCONTEXT_DATASEL_OFF 0x88 -#define FREEBSD_UC_MCONTEXT_ST0_OFF 0x8c +#define FREEBSD_UC_MCONTEXT_CW_OFF 0x70 +#define FREEBSD_UC_MCONTEXT_SW_OFF 0x74 +#define FREEBSD_UC_MCONTEXT_TAG_OFF 0x78 +#define FREEBSD_UC_MCONTEXT_IPOFF_OFF 0x7c +#define FREEBSD_UC_MCONTEXT_CSSEL_OFF 0x80 +#define FREEBSD_UC_MCONTEXT_DATAOFF_OFF 0x84 +#define FREEBSD_US_MCONTEXT_DATASEL_OFF 0x88 +#define FREEBSD_UC_MCONTEXT_ST0_OFF 0x8c -#define FREEBSD_UC_MCONTEXT_CW_XMM_OFF 0x70 -#define FREEBSD_UC_MCONTEXT_SW_XMM_OFF 0x72 -#define FREEBSD_UC_MCONTEXT_TAG_XMM_OFF 0x74 -#define FREEBSD_UC_MCONTEXT_IPOFF_XMM_OFF 0x78 -#define FREEBSD_UC_MCONTEXT_CSSEL_XMM_OFF 0x7c -#define FREEBSD_UC_MCONTEXT_DATAOFF_XMM_OFF 0x80 -#define FREEBSD_US_MCONTEXT_DATASEL_XMM_OFF 0x84 -#define FREEBSD_UC_MCONTEXT_MXCSR_XMM_OFF 0x88 -#define FREEBSD_UC_MCONTEXT_ST0_XMM_OFF 0x90 -#define FREEBSD_UC_MCONTEXT_XMM0_OFF 0x110 +#define FREEBSD_UC_MCONTEXT_CW_XMM_OFF 0x70 +#define FREEBSD_UC_MCONTEXT_SW_XMM_OFF 0x72 +#define FREEBSD_UC_MCONTEXT_TAG_XMM_OFF 0x74 +#define FREEBSD_UC_MCONTEXT_IPOFF_XMM_OFF 0x78 +#define FREEBSD_UC_MCONTEXT_CSSEL_XMM_OFF 0x7c +#define FREEBSD_UC_MCONTEXT_DATAOFF_XMM_OFF 0x80 +#define FREEBSD_US_MCONTEXT_DATASEL_XMM_OFF 0x84 +#define FREEBSD_UC_MCONTEXT_MXCSR_XMM_OFF 0x88 +#define FREEBSD_UC_MCONTEXT_ST0_XMM_OFF 0x90 +#define FREEBSD_UC_MCONTEXT_XMM0_OFF 0x110 -#define FREEBSD_UC_MCONTEXT_MC_LEN_VAL 0x280 -#define FREEBSD_UC_MCONTEXT_FPFMT_NODEV 0x10000 -#define FREEBSD_UC_MCONTEXT_FPFMT_387 0x10001 -#define FREEBSD_UC_MCONTEXT_FPFMT_XMM 0x10002 -#define FREEBSD_UC_MCONTEXT_FPOWNED_NONE 0x20000 -#define FREEBSD_UC_MCONTEXT_FPOWNED_FPU 0x20001 -#define FREEBSD_UC_MCONTEXT_FPOWNED_PCB 0x20002 +#define FREEBSD_UC_MCONTEXT_MC_LEN_VAL 0x280 +#define FREEBSD_UC_MCONTEXT_FPFMT_NODEV 0x10000 +#define FREEBSD_UC_MCONTEXT_FPFMT_387 0x10001 +#define FREEBSD_UC_MCONTEXT_FPFMT_XMM 0x10002 +#define FREEBSD_UC_MCONTEXT_FPOWNED_NONE 0x20000 +#define FREEBSD_UC_MCONTEXT_FPOWNED_FPU 0x20001 +#define FREEBSD_UC_MCONTEXT_FPOWNED_PCB 0x20002 diff --git a/src/x86/unwind_i.h b/src/x86/unwind_i.h index 1db2e98d..cd528242 100644 --- a/src/x86/unwind_i.h +++ b/src/x86/unwind_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang This file is part of libunwind. @@ -33,29 +33,29 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "libunwind_i.h" /* DWARF column numbers: */ -#define EAX 0 -#define ECX 1 -#define EDX 2 -#define EBX 3 -#define ESP 4 -#define EBP 5 -#define ESI 6 -#define EDI 7 -#define EIP 8 -#define EFLAGS 9 -#define TRAPNO 10 -#define ST0 11 +#define EAX 0 +#define ECX 1 +#define EDX 2 +#define EBX 3 +#define ESP 4 +#define EBP 5 +#define ESI 6 +#define EDI 7 +#define EIP 8 +#define EFLAGS 9 +#define TRAPNO 10 +#define ST0 11 -#define x86_lock UNW_OBJ(lock) -#define x86_local_resume UNW_OBJ(local_resume) -#define x86_local_addr_space_init UNW_OBJ(local_addr_space_init) -#define x86_scratch_loc UNW_OBJ(scratch_loc) -#define x86_get_scratch_loc UNW_OBJ(get_scratch_loc) -#define x86_r_uc_addr UNW_OBJ(r_uc_addr) +#define x86_lock UNW_OBJ(lock) +#define x86_local_resume UNW_OBJ(local_resume) +#define x86_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define x86_scratch_loc UNW_OBJ(scratch_loc) +#define x86_get_scratch_loc UNW_OBJ(get_scratch_loc) +#define x86_r_uc_addr UNW_OBJ(r_uc_addr) extern void x86_local_addr_space_init (void); extern int x86_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, - void *arg); + void *arg); extern dwarf_loc_t x86_scratch_loc (struct cursor *c, unw_regnum_t reg); extern dwarf_loc_t x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg); extern void *x86_r_uc_addr (ucontext_t *uc, int reg); diff --git a/src/x86_64/Gcreate_addr_space.c b/src/x86_64/Gcreate_addr_space.c index aab126a4..38ee5afb 100644 --- a/src/x86_64/Gcreate_addr_space.c +++ b/src/x86_64/Gcreate_addr_space.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock Copyright (C) 2012 Tommi Rantala diff --git a/src/x86_64/Gget_proc_info.c b/src/x86_64/Gget_proc_info.c index 213666e0..8def62d2 100644 --- a/src/x86_64/Gget_proc_info.c +++ b/src/x86_64/Gget_proc_info.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -35,9 +35,9 @@ unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) if (dwarf_make_proc_info (&c->dwarf) < 0) { /* On x86-64, some key routines such as _start() and _dl_start() - are missing DWARF unwind info. We don't want to fail in that - case, because those frames are uninteresting and just mark - the end of the frame-chain anyhow. */ + are missing DWARF unwind info. We don't want to fail in that + case, because those frames are uninteresting and just mark + the end of the frame-chain anyhow. */ memset (pi, 0, sizeof (*pi)); pi->start_ip = c->dwarf.ip; pi->end_ip = c->dwarf.ip + 1; diff --git a/src/x86_64/Gget_save_loc.c b/src/x86_64/Gget_save_loc.c index 20b14a5b..b48fa918 100644 --- a/src/x86_64/Gget_save_loc.c +++ b/src/x86_64/Gget_save_loc.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -33,7 +33,7 @@ unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) struct cursor *c = (struct cursor *) cursor; dwarf_loc_t loc; - loc = DWARF_NULL_LOC; /* default to "not saved" */ + loc = DWARF_NULL_LOC; /* default to "not saved" */ switch (reg) { diff --git a/src/x86_64/Gglobal.c b/src/x86_64/Gglobal.c index cf1e3746..8d1fbb4b 100644 --- a/src/x86_64/Gglobal.c +++ b/src/x86_64/Gglobal.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -95,7 +95,7 @@ tdep_init (void) #ifndef UNW_REMOTE_ONLY x86_64_local_addr_space_init (); #endif - tdep_init_done = 1; /* signal that we're initialized... */ + tdep_init_done = 1; /* signal that we're initialized... */ } out: lock_release (&x86_64_lock, saved_mask); diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c index daea0780..480d470b 100644 --- a/src/x86_64/Ginit.c +++ b/src/x86_64/Ginit.c @@ -1,7 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002 Hewlett-Packard Co Copyright (C) 2007 David Mosberger-Tang - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -62,14 +62,14 @@ put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) static int get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, - void *arg) + void *arg) { *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; return 0; } #define PAGE_SIZE 4096 -#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1)) +#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1)) static int (*mem_validate_func) (void *addr, size_t len); static int msync_validate (void *addr, size_t len) @@ -131,7 +131,7 @@ validate_mem (unw_word_t addr) for (i = 0; i < NLGA; i++) { if (last_good_addr[i] && (addr == last_good_addr[i])) - return 0; + return 0; } if (mem_validate_func ((void *) addr, len) == -1) @@ -156,7 +156,7 @@ validate_mem (unw_word_t addr) static int access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, - void *arg) + void *arg) { if (unlikely (write)) { @@ -178,7 +178,7 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, static int access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, - void *arg) + void *arg) { unw_word_t *addr; ucontext_t *uc = ((struct cursor *)arg)->uc; @@ -208,7 +208,7 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, static int access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, - int write, void *arg) + int write, void *arg) { ucontext_t *uc = ((struct cursor *)arg)->uc; unw_fpreg_t *addr; @@ -222,14 +222,14 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, if (write) { Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); *(unw_fpreg_t *) addr = *val; } else { *val = *(unw_fpreg_t *) addr; Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), - ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); } return 0; @@ -241,8 +241,8 @@ access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, static int get_static_proc_name (unw_addr_space_t as, unw_word_t ip, - char *buf, size_t buf_len, unw_word_t *offp, - void *arg) + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) { return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); } diff --git a/src/x86_64/Ginit_local.c b/src/x86_64/Ginit_local.c index 8c3f0606..07993896 100644 --- a/src/x86_64/Ginit_local.c +++ b/src/x86_64/Ginit_local.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock diff --git a/src/x86_64/Ginit_remote.c b/src/x86_64/Ginit_remote.c index 4fd2092e..f3b7bb97 100644 --- a/src/x86_64/Ginit_remote.c +++ b/src/x86_64/Ginit_remote.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2003 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock diff --git a/src/x86_64/Gos-freebsd.c b/src/x86_64/Gos-freebsd.c index 776c54b9..e7e8da13 100644 --- a/src/x86_64/Gos-freebsd.c +++ b/src/x86_64/Gos-freebsd.c @@ -49,12 +49,12 @@ unw_is_signal_frame (unw_cursor_t *cursor) arg = c->dwarf.as_arg; /* Check if RIP points at sigreturn sequence. -48 8d 7c 24 10 lea SIGF_UC(%rsp),%rdi -6a 00 pushq $0 -48 c7 c0 a1 01 00 00 movq $SYS_sigreturn,%rax -0f 05 syscall -f4 0: hlt -eb fd jmp 0b +48 8d 7c 24 10 lea SIGF_UC(%rsp),%rdi +6a 00 pushq $0 +48 c7 c0 a1 01 00 00 movq $SYS_sigreturn,%rax +0f 05 syscall +f4 0: hlt +eb fd jmp 0b */ ip = c->dwarf.ip; @@ -72,8 +72,8 @@ eb fd jmp 0b return (c->sigcontext_format); } /* Check if RIP points at standard syscall sequence. -49 89 ca mov %rcx,%r10 -0f 05 syscall +49 89 ca mov %rcx,%r10 +0f 05 syscall */ if ((ret = (*a->access_mem) (as, ip - 5, &b0, 0, arg)) < 0) return (0); @@ -131,13 +131,13 @@ unw_handle_signal_frame (unw_cursor_t *cursor) else if (c->sigcontext_format == X86_64_SCF_FREEBSD_SYSCALL) { c->dwarf.loc[RCX] = c->dwarf.loc[R10]; - /* rsp_loc = DWARF_LOC(c->dwarf.cfa - 8, 0); */ - /* rbp_loc = c->dwarf.loc[RBP]; */ + /* rsp_loc = DWARF_LOC(c->dwarf.cfa - 8, 0); */ + /* rbp_loc = c->dwarf.loc[RBP]; */ c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0); ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip); Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n", - (unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]), - (unsigned long long) c->dwarf.ip); + (unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]), + (unsigned long long) c->dwarf.ip); if (ret < 0) { Debug (2, "returning %d\n", ret); @@ -193,7 +193,7 @@ x86_64_sigreturn (unw_cursor_t *cursor) offsetof(struct sigframe, sf_uc)); Debug (8, "resuming at ip=%llx via sigreturn(%p)\n", - (unsigned long long) c->dwarf.ip, uc); + (unsigned long long) c->dwarf.ip, uc); sigreturn(uc); abort(); } diff --git a/src/x86_64/Gos-linux.c b/src/x86_64/Gos-linux.c index a0ecce22..9e1acfcf 100644 --- a/src/x86_64/Gos-linux.c +++ b/src/x86_64/Gos-linux.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -74,8 +74,8 @@ tdep_reuse_frame (struct dwarf_cursor *dw, struct dwarf_reg_state *rs) Debug(5, "reuse frame ip=0x%lx cfa=0x%lx format=%d addr=0x%lx offset=%+d\n", dw->ip, dw->cfa, c->sigcontext_format, c->sigcontext_addr, - (c->sigcontext_format == X86_64_SCF_LINUX_RT_SIGFRAME - ? c->frame_info.cfa_reg_offset : 0)); + (c->sigcontext_format == X86_64_SCF_LINUX_RT_SIGFRAME + ? c->frame_info.cfa_reg_offset : 0)); } PROTECTED int @@ -96,7 +96,7 @@ unw_handle_signal_frame (unw_cursor_t *cursor) gating on unw_is_signal_frame() needs to be removed. */ struct cursor *c = (struct cursor *) cursor; Debug(1, "old format signal frame? format=%d addr=0x%lx cfa=0x%lx\n", - c->sigcontext_format, c->sigcontext_addr, c->dwarf.cfa); + c->sigcontext_format, c->sigcontext_addr, c->dwarf.cfa); #endif return -UNW_EBADFRAME; } @@ -142,12 +142,12 @@ x86_64_sigreturn (unw_cursor_t *cursor) struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; Debug (8, "resuming at ip=%llx via sigreturn(%p)\n", - (unsigned long long) c->dwarf.ip, sc); + (unsigned long long) c->dwarf.ip, sc); __asm__ __volatile__ ("mov %0, %%rsp;" - "mov %1, %%rax;" - "syscall" - :: "r"(sc), "i"(SYS_rt_sigreturn) - : "memory"); + "mov %1, %%rax;" + "syscall" + :: "r"(sc), "i"(SYS_rt_sigreturn) + : "memory"); abort(); } diff --git a/src/x86_64/Gregs.c b/src/x86_64/Gregs.c index 5dd7b0b6..baf8a24f 100644 --- a/src/x86_64/Gregs.c +++ b/src/x86_64/Gregs.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -63,7 +63,7 @@ x86_64_scratch_loc (struct cursor *c, unw_regnum_t reg) HIDDEN int tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, - int write) + int write) { dwarf_loc_t loc = DWARF_NULL_LOC; unsigned int mask; @@ -74,14 +74,14 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, case UNW_X86_64_RIP: if (write) - c->dwarf.ip = *valp; /* also update the RIP cache */ + c->dwarf.ip = *valp; /* also update the RIP cache */ loc = c->dwarf.loc[RIP]; break; case UNW_X86_64_CFA: case UNW_X86_64_RSP: if (write) - return -UNW_EREADONLYREG; + return -UNW_EREADONLYREG; *valp = c->dwarf.cfa; return 0; @@ -90,18 +90,18 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, arg_num = reg - UNW_X86_64_RAX; mask = (1 << arg_num); if (write) - { - c->dwarf.eh_args[arg_num] = *valp; - c->dwarf.eh_valid_mask |= mask; - return 0; - } + { + c->dwarf.eh_args[arg_num] = *valp; + c->dwarf.eh_valid_mask |= mask; + return 0; + } else if ((c->dwarf.eh_valid_mask & mask) != 0) - { - *valp = c->dwarf.eh_args[arg_num]; - return 0; - } + { + *valp = c->dwarf.eh_args[arg_num]; + return 0; + } else - loc = c->dwarf.loc[(reg == UNW_X86_64_RAX) ? RAX : RDX]; + loc = c->dwarf.loc[(reg == UNW_X86_64_RAX) ? RAX : RDX]; break; case UNW_X86_64_RCX: loc = c->dwarf.loc[RCX]; break; @@ -132,7 +132,7 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, HIDDEN int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, - int write) + int write) { return -UNW_EBADREG; } diff --git a/src/x86_64/Gresume.c b/src/x86_64/Gresume.c index d5239fc1..6880d94a 100644 --- a/src/x86_64/Gresume.c +++ b/src/x86_64/Gresume.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -52,7 +52,7 @@ x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) else { Debug (8, "resuming at ip=%llx via setcontext()\n", - (unsigned long long) c->dwarf.ip); + (unsigned long long) c->dwarf.ip); setcontext (uc); } return -UNW_EINVAL; @@ -67,9 +67,9 @@ static inline int establish_machine_state (struct cursor *c) { int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, - int write, void *); + int write, void *); int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, - int write, void *); + int write, void *); unw_addr_space_t as = c->dwarf.as; void *arg = c->dwarf.as_arg; unw_fpreg_t fpval; @@ -85,15 +85,15 @@ establish_machine_state (struct cursor *c) { Debug (16, "copying %s %d\n", unw_regname (reg), reg); if (unw_is_fpreg (reg)) - { - if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) - (*access_fpreg) (as, reg, &fpval, 1, arg); - } + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + (*access_fpreg) (as, reg, &fpval, 1, arg); + } else - { - if (tdep_access_reg (c, reg, &val, 0) >= 0) - (*access_reg) (as, reg, &val, 1, arg); - } + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + (*access_reg) (as, reg, &val, 1, arg); + } } return 0; } @@ -110,5 +110,5 @@ unw_resume (unw_cursor_t *cursor) return ret; return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, - c->dwarf.as_arg); + c->dwarf.as_arg); } diff --git a/src/x86_64/Gstash_frame.c b/src/x86_64/Gstash_frame.c index b9a53a33..33a44ec7 100644 --- a/src/x86_64/Gstash_frame.c +++ b/src/x86_64/Gstash_frame.c @@ -32,14 +32,14 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs) unw_tdep_frame_t *f = &c->frame_info; Debug (4, "ip=0x%lx cfa=0x%lx type %d cfa [where=%d val=%ld] cfaoff=%ld" - " ra=0x%lx rbp [where=%d val=%ld @0x%lx] rsp [where=%d val=%ld @0x%lx]\n", - d->ip, d->cfa, f->frame_type, - rs->reg[DWARF_CFA_REG_COLUMN].where, - rs->reg[DWARF_CFA_REG_COLUMN].val, - rs->reg[DWARF_CFA_OFF_COLUMN].val, - DWARF_GET_LOC(d->loc[d->ret_addr_column]), - rs->reg[RBP].where, rs->reg[RBP].val, DWARF_GET_LOC(d->loc[RBP]), - rs->reg[RSP].where, rs->reg[RSP].val, DWARF_GET_LOC(d->loc[RSP])); + " ra=0x%lx rbp [where=%d val=%ld @0x%lx] rsp [where=%d val=%ld @0x%lx]\n", + d->ip, d->cfa, f->frame_type, + rs->reg[DWARF_CFA_REG_COLUMN].where, + rs->reg[DWARF_CFA_REG_COLUMN].val, + rs->reg[DWARF_CFA_OFF_COLUMN].val, + DWARF_GET_LOC(d->loc[d->ret_addr_column]), + rs->reg[RBP].where, rs->reg[RBP].val, DWARF_GET_LOC(d->loc[RBP]), + rs->reg[RSP].where, rs->reg[RSP].val, DWARF_GET_LOC(d->loc[RSP])); /* A standard frame is defined as: - CFA is register-relative offset off RBP or RSP; @@ -49,19 +49,19 @@ tdep_stash_frame (struct dwarf_cursor *d, struct dwarf_reg_state *rs) if (f->frame_type == UNW_X86_64_FRAME_OTHER && (rs->reg[DWARF_CFA_REG_COLUMN].where == DWARF_WHERE_REG) && (rs->reg[DWARF_CFA_REG_COLUMN].val == RBP - || rs->reg[DWARF_CFA_REG_COLUMN].val == RSP) + || rs->reg[DWARF_CFA_REG_COLUMN].val == RSP) && rs->reg[DWARF_CFA_OFF_COLUMN].val < (1 << 29) && DWARF_GET_LOC(d->loc[d->ret_addr_column]) == d->cfa-8 && (rs->reg[RBP].where == DWARF_WHERE_UNDEF - || rs->reg[RBP].where == DWARF_WHERE_SAME - || (rs->reg[RBP].where == DWARF_WHERE_CFAREL - && rs->reg[RBP].val < (1 << 14) - && rs->reg[RBP].val+1 != 0)) + || rs->reg[RBP].where == DWARF_WHERE_SAME + || (rs->reg[RBP].where == DWARF_WHERE_CFAREL + && rs->reg[RBP].val < (1 << 14) + && rs->reg[RBP].val+1 != 0)) && (rs->reg[RSP].where == DWARF_WHERE_UNDEF - || rs->reg[RSP].where == DWARF_WHERE_SAME - || (rs->reg[RSP].where == DWARF_WHERE_CFAREL - && rs->reg[RSP].val < (1 << 14) - && rs->reg[RSP].val+1 != 0))) + || rs->reg[RSP].where == DWARF_WHERE_SAME + || (rs->reg[RSP].where == DWARF_WHERE_CFAREL + && rs->reg[RSP].val < (1 << 14) + && rs->reg[RSP].val+1 != 0))) { /* Save information for a standard frame. */ f->frame_type = UNW_X86_64_FRAME_STANDARD; diff --git a/src/x86_64/Gstep.c b/src/x86_64/Gstep.c index 5b24de42..84b37280 100644 --- a/src/x86_64/Gstep.c +++ b/src/x86_64/Gstep.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -45,8 +45,8 @@ is_plt_entry (struct dwarf_cursor *c) return 0; ret = (((w0 & 0xffff) == 0x25ff) - && (((w0 >> 48) & 0xff) == 0x68) - && (((w1 >> 24) & 0xff) == 0xe9)); + && (((w0 >> 48) & 0xff) == 0x68) + && (((w1 >> 24) & 0xff) == 0xe9)); Debug (14, "ip=0x%lx => 0x%016lx 0x%016lx, ret = %d\n", c->ip, w0, w1, ret); return ret; @@ -64,7 +64,7 @@ unw_step (unw_cursor_t *cursor) #endif Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx)\n", - c, c->dwarf.ip, c->dwarf.cfa); + c, c->dwarf.ip, c->dwarf.cfa); /* Try DWARF-based unwinding... */ c->sigcontext_format = X86_64_SCF_NONE; @@ -83,27 +83,27 @@ unw_step (unw_cursor_t *cursor) if (likely (ret >= 0)) { /* x86_64 ABI specifies that end of call-chain is marked with a - NULL RBP or undefined return address */ + NULL RBP or undefined return address */ if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP]) || DWARF_IS_NULL_LOC(c->dwarf.loc[c->dwarf.ret_addr_column])) - { - c->dwarf.ip = 0; - ret = 0; - } + { + c->dwarf.ip = 0; + ret = 0; + } } else { /* DWARF failed. There isn't much of a usable frame-chain on x86-64, - but we do need to handle two special-cases: + but we do need to handle two special-cases: - (i) signal trampoline: Old kernels and older libcs don't - export the vDSO needed to get proper unwind info for the - trampoline. Recognize that case by looking at the code - and filling in things by hand. + (i) signal trampoline: Old kernels and older libcs don't + export the vDSO needed to get proper unwind info for the + trampoline. Recognize that case by looking at the code + and filling in things by hand. - (ii) PLT (shared-library) call-stubs: PLT stubs are invoked - via CALLQ. Try this for all non-signal trampoline - code. */ + (ii) PLT (shared-library) call-stubs: PLT stubs are invoked + via CALLQ. Try this for all non-signal trampoline + code. */ unw_word_t prev_ip = c->dwarf.ip, prev_cfa = c->dwarf.cfa; struct dwarf_loc rbp_loc, rsp_loc, rip_loc; @@ -115,115 +115,115 @@ unw_step (unw_cursor_t *cursor) Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret); if (unw_is_signal_frame (cursor)) - { + { ret = unw_handle_signal_frame(cursor); - if (ret < 0) - { - Debug (2, "returning 0\n"); - return 0; - } - } + if (ret < 0) + { + Debug (2, "returning 0\n"); + return 0; + } + } else if (is_plt_entry (&c->dwarf)) - { + { /* Like regular frame, CFA = RSP+8, RA = [CFA-8], no regs saved. */ - Debug (2, "found plt entry\n"); + Debug (2, "found plt entry\n"); c->frame_info.cfa_reg_offset = 8; c->frame_info.cfa_reg_rsp = -1; c->frame_info.frame_type = UNW_X86_64_FRAME_STANDARD; c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0); c->dwarf.cfa += 8; - } + } else if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP])) { - for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) - c->dwarf.loc[i] = DWARF_NULL_LOC; - } + for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; + } else - { - unw_word_t rbp; + { + unw_word_t rbp; - ret = dwarf_get (&c->dwarf, c->dwarf.loc[RBP], &rbp); - if (ret < 0) - { - Debug (2, "returning %d [RBP=0x%lx]\n", ret, - DWARF_GET_LOC (c->dwarf.loc[RBP])); - return ret; - } + ret = dwarf_get (&c->dwarf, c->dwarf.loc[RBP], &rbp); + if (ret < 0) + { + Debug (2, "returning %d [RBP=0x%lx]\n", ret, + DWARF_GET_LOC (c->dwarf.loc[RBP])); + return ret; + } - if (!rbp) - { - /* Looks like we may have reached the end of the call-chain. */ - rbp_loc = DWARF_NULL_LOC; - rsp_loc = DWARF_NULL_LOC; - rip_loc = DWARF_NULL_LOC; - } - else - { - unw_word_t rbp1 = 0; - rbp_loc = DWARF_LOC(rbp, 0); - rsp_loc = DWARF_NULL_LOC; - rip_loc = DWARF_LOC (rbp + 8, 0); - ret = dwarf_get (&c->dwarf, rbp_loc, &rbp1); - Debug (1, "[RBP=0x%lx] = 0x%lx (cfa = 0x%lx) -> 0x%lx\n", - (unsigned long) DWARF_GET_LOC (c->dwarf.loc[RBP]), - rbp, c->dwarf.cfa, rbp1); + if (!rbp) + { + /* Looks like we may have reached the end of the call-chain. */ + rbp_loc = DWARF_NULL_LOC; + rsp_loc = DWARF_NULL_LOC; + rip_loc = DWARF_NULL_LOC; + } + else + { + unw_word_t rbp1 = 0; + rbp_loc = DWARF_LOC(rbp, 0); + rsp_loc = DWARF_NULL_LOC; + rip_loc = DWARF_LOC (rbp + 8, 0); + ret = dwarf_get (&c->dwarf, rbp_loc, &rbp1); + Debug (1, "[RBP=0x%lx] = 0x%lx (cfa = 0x%lx) -> 0x%lx\n", + (unsigned long) DWARF_GET_LOC (c->dwarf.loc[RBP]), + rbp, c->dwarf.cfa, rbp1); - /* Heuristic to determine incorrect guess. For RBP to be a - valid frame it needs to be above current CFA, but don't - let it go more than a little. Note that we can't deduce - anything about new RBP (rbp1) since it may not be a frame - pointer in the frame above. Just check we get the value. */ + /* Heuristic to determine incorrect guess. For RBP to be a + valid frame it needs to be above current CFA, but don't + let it go more than a little. Note that we can't deduce + anything about new RBP (rbp1) since it may not be a frame + pointer in the frame above. Just check we get the value. */ if (ret < 0 - || rbp < c->dwarf.cfa - || (rbp - c->dwarf.cfa) > 0x4000) - { + || rbp < c->dwarf.cfa + || (rbp - c->dwarf.cfa) > 0x4000) + { rip_loc = DWARF_NULL_LOC; rbp_loc = DWARF_NULL_LOC; - } + } c->frame_info.frame_type = UNW_X86_64_FRAME_GUESSED; c->frame_info.cfa_reg_rsp = 0; c->frame_info.cfa_reg_offset = 16; c->frame_info.rbp_cfa_offset = -16; - c->dwarf.cfa += 16; - } + c->dwarf.cfa += 16; + } - /* Mark all registers unsaved */ - for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) - c->dwarf.loc[i] = DWARF_NULL_LOC; + /* Mark all registers unsaved */ + for (i = 0; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; c->dwarf.loc[RBP] = rbp_loc; c->dwarf.loc[RSP] = rsp_loc; c->dwarf.loc[RIP] = rip_loc; c->dwarf.use_prev_instr = 1; - } + } c->dwarf.ret_addr_column = RIP; if (DWARF_IS_NULL_LOC (c->dwarf.loc[RBP])) { - ret = 0; - Debug (2, "NULL %%rbp loc, returning %d\n", ret); - return ret; + ret = 0; + Debug (2, "NULL %%rbp loc, returning %d\n", ret); + return ret; } if (!DWARF_IS_NULL_LOC (c->dwarf.loc[RIP])) - { - ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip); - Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n", - (unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]), - (unsigned long long) c->dwarf.ip); - if (ret < 0) - { - Debug (2, "returning %d\n", ret); - return ret; - } - ret = 1; - } + { + ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip); + Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n", + (unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]), + (unsigned long long) c->dwarf.ip); + if (ret < 0) + { + Debug (2, "returning %d\n", ret); + return ret; + } + ret = 1; + } else - c->dwarf.ip = 0; + c->dwarf.ip = 0; if (c->dwarf.ip == prev_ip && c->dwarf.cfa == prev_cfa) - return -UNW_EBADFRAME; + return -UNW_EBADFRAME; } Debug (2, "returning %d\n", ret); return ret; diff --git a/src/x86_64/Gtrace.c b/src/x86_64/Gtrace.c index 9a86a06c..833d7a78 100644 --- a/src/x86_64/Gtrace.c +++ b/src/x86_64/Gtrace.c @@ -41,7 +41,7 @@ typedef struct size_t log_size; size_t used; size_t dtor_count; /* Counts how many times our destructor has already - been called. */ + been called. */ } unw_trace_cache_t; static const unw_tdep_frame_t empty_frame = { 0, UNW_X86_64_FRAME_OTHER, -1, -1, 0, -1, -1 }; @@ -63,7 +63,7 @@ trace_cache_free (void *arg) /* Not yet our turn to get destroyed. Re-install ourselves into the key. */ pthread_setspecific(trace_cache_key, cache); Debug(5, "delayed freeing cache %p (%zx to go)\n", cache, - PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count); + PTHREAD_DESTRUCTOR_ITERATIONS - cache->dtor_count); return; } tls_cache_destroyed = 1; @@ -109,7 +109,7 @@ trace_cache_create (void) /* The current thread is in the process of exiting. Don't recreate cache, as we wouldn't have another chance to free it. */ Debug(5, "refusing to reallocate cache: " - "thread-locals are being deallocated\n"); + "thread-locals are being deallocated\n"); return NULL; } @@ -212,11 +212,11 @@ trace_cache_get (void) highly unusual unwind info which uses these creatively. */ static unw_tdep_frame_t * trace_init_addr (unw_tdep_frame_t *f, - unw_cursor_t *cursor, - unw_word_t cfa, - unw_word_t rip, - unw_word_t rbp, - unw_word_t rsp) + unw_cursor_t *cursor, + unw_word_t cfa, + unw_word_t rip, + unw_word_t rbp, + unw_word_t rsp) { struct cursor *c = (struct cursor *) cursor; struct dwarf_cursor *d = &c->dwarf; @@ -258,9 +258,9 @@ trace_init_addr (unw_tdep_frame_t *f, f->last_frame = -1; Debug (3, "frame va %lx type %d last %d cfa %s+%d rbp @ cfa%+d rsp @ cfa%+d\n", - f->virtual_address, f->frame_type, f->last_frame, - f->cfa_reg_rsp ? "rsp" : "rbp", f->cfa_reg_offset, - f->rbp_cfa_offset, f->rsp_cfa_offset); + f->virtual_address, f->frame_type, f->last_frame, + f->cfa_reg_rsp ? "rsp" : "rbp", f->cfa_reg_offset, + f->rbp_cfa_offset, f->rsp_cfa_offset); return f; } @@ -271,11 +271,11 @@ trace_init_addr (unw_tdep_frame_t *f, frame cache slot which describes RIP. */ static unw_tdep_frame_t * trace_lookup (unw_cursor_t *cursor, - unw_trace_cache_t *cache, - unw_word_t cfa, - unw_word_t rip, - unw_word_t rbp, - unw_word_t rsp) + unw_trace_cache_t *cache, + unw_word_t cfa, + unw_word_t rip, + unw_word_t rbp, + unw_word_t rsp) { /* First look up for previously cached information using cache as linear probing hash table with probe step of 1. Majority of @@ -437,7 +437,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) { rip -= d->use_prev_instr; Debug (2, "depth %d cfa 0x%lx rip 0x%lx rsp 0x%lx rbp 0x%lx\n", - depth, cfa, rip, rsp, rbp); + depth, cfa, rip, rsp, rbp); /* See if we have this address cached. If not, evaluate enough of the dwarf unwind information to fill the cache line data, or to @@ -480,7 +480,7 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) cfa = (f->cfa_reg_rsp ? rsp : rbp) + f->cfa_reg_offset; ACCESS_MEM_FAST(ret, c->validate, d, cfa - 8, rip); if (likely(ret >= 0) && likely(f->rbp_cfa_offset != -1)) - ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->rbp_cfa_offset, rbp); + ACCESS_MEM_FAST(ret, c->validate, d, cfa + f->rbp_cfa_offset, rbp); /* Don't bother reading RSP from DWARF, CFA becomes new RSP. */ rsp = cfa; @@ -508,14 +508,14 @@ tdep_trace (unw_cursor_t *cursor, void **buffer, int *size) default: /* We cannot trace through this frame, give up and tell the - caller we had to stop. Data collected so far may still be - useful to the caller, so let it know how far we got. */ + caller we had to stop. Data collected so far may still be + useful to the caller, so let it know how far we got. */ ret = -UNW_ESTOPUNWIND; break; } Debug (4, "new cfa 0x%lx rip 0x%lx rsp 0x%lx rbp 0x%lx\n", - cfa, rip, rsp, rbp); + cfa, rip, rsp, rbp); /* If we failed or ended up somewhere bogus, stop. */ if (unlikely(ret < 0 || rip < 0x4000)) diff --git a/src/x86_64/init.h b/src/x86_64/init.h index e80e5533..442b2bf7 100644 --- a/src/x86_64/init.h +++ b/src/x86_64/init.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -69,7 +69,7 @@ common_init (struct cursor *c, unsigned use_prev_instr) return ret; ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_X86_64_RSP), - &c->dwarf.cfa); + &c->dwarf.cfa); if (ret < 0) return ret; diff --git a/src/x86_64/is_fpreg.c b/src/x86_64/is_fpreg.c index 030dd712..1188a616 100644 --- a/src/x86_64/is_fpreg.c +++ b/src/x86_64/is_fpreg.c @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P. - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -32,7 +32,7 @@ unw_is_fpreg (int regnum) { #if 0 return ((regnum >= UNW_X86_ST0 && regnum <= UNW_X86_ST7) - || (regnum >= UNW_X86_XMM0_lo && regnum <= UNW_X86_XMM7_hi)); + || (regnum >= UNW_X86_XMM0_lo && regnum <= UNW_X86_XMM7_hi)); #endif return 0; } diff --git a/src/x86_64/offsets.h b/src/x86_64/offsets.h index 80cfe361..0807960f 100644 --- a/src/x86_64/offsets.h +++ b/src/x86_64/offsets.h @@ -1,3 +1,3 @@ /* FreeBSD specific definitions */ -#define FREEBSD_UC_MCONTEXT_OFF 0x10 +#define FREEBSD_UC_MCONTEXT_OFF 0x10 diff --git a/src/x86_64/ucontext_i.h b/src/x86_64/ucontext_i.h index c1249bf6..aded941d 100644 --- a/src/x86_64/ucontext_i.h +++ b/src/x86_64/ucontext_i.h @@ -23,60 +23,60 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #if defined __linux__ -#define UC_MCONTEXT_GREGS_R8 0x28 -#define UC_MCONTEXT_GREGS_R9 0x30 -#define UC_MCONTEXT_GREGS_R10 0x38 -#define UC_MCONTEXT_GREGS_R11 0x40 -#define UC_MCONTEXT_GREGS_R12 0x48 -#define UC_MCONTEXT_GREGS_R13 0x50 -#define UC_MCONTEXT_GREGS_R14 0x58 -#define UC_MCONTEXT_GREGS_R15 0x60 -#define UC_MCONTEXT_GREGS_RDI 0x68 -#define UC_MCONTEXT_GREGS_RSI 0x70 -#define UC_MCONTEXT_GREGS_RBP 0x78 -#define UC_MCONTEXT_GREGS_RBX 0x80 -#define UC_MCONTEXT_GREGS_RDX 0x88 -#define UC_MCONTEXT_GREGS_RAX 0x90 -#define UC_MCONTEXT_GREGS_RCX 0x98 -#define UC_MCONTEXT_GREGS_RSP 0xa0 -#define UC_MCONTEXT_GREGS_RIP 0xa8 +#define UC_MCONTEXT_GREGS_R8 0x28 +#define UC_MCONTEXT_GREGS_R9 0x30 +#define UC_MCONTEXT_GREGS_R10 0x38 +#define UC_MCONTEXT_GREGS_R11 0x40 +#define UC_MCONTEXT_GREGS_R12 0x48 +#define UC_MCONTEXT_GREGS_R13 0x50 +#define UC_MCONTEXT_GREGS_R14 0x58 +#define UC_MCONTEXT_GREGS_R15 0x60 +#define UC_MCONTEXT_GREGS_RDI 0x68 +#define UC_MCONTEXT_GREGS_RSI 0x70 +#define UC_MCONTEXT_GREGS_RBP 0x78 +#define UC_MCONTEXT_GREGS_RBX 0x80 +#define UC_MCONTEXT_GREGS_RDX 0x88 +#define UC_MCONTEXT_GREGS_RAX 0x90 +#define UC_MCONTEXT_GREGS_RCX 0x98 +#define UC_MCONTEXT_GREGS_RSP 0xa0 +#define UC_MCONTEXT_GREGS_RIP 0xa8 #define UC_MCONTEXT_FPREGS_PTR 0x1a8 -#define UC_MCONTEXT_FPREGS_MEM 0xe0 -#define UC_SIGMASK 0x128 -#define FPREGS_OFFSET_MXCSR 0x18 +#define UC_MCONTEXT_FPREGS_MEM 0xe0 +#define UC_SIGMASK 0x128 +#define FPREGS_OFFSET_MXCSR 0x18 #elif defined __FreeBSD__ -#define UC_SIGMASK 0x0 -#define UC_MCONTEXT_GREGS_RDI 0x18 -#define UC_MCONTEXT_GREGS_RSI 0x20 -#define UC_MCONTEXT_GREGS_RDX 0x28 -#define UC_MCONTEXT_GREGS_RCX 0x30 -#define UC_MCONTEXT_GREGS_R8 0x38 -#define UC_MCONTEXT_GREGS_R9 0x40 -#define UC_MCONTEXT_GREGS_RAX 0x48 -#define UC_MCONTEXT_GREGS_RBX 0x50 -#define UC_MCONTEXT_GREGS_RBP 0x58 -#define UC_MCONTEXT_GREGS_R10 0x60 -#define UC_MCONTEXT_GREGS_R11 0x68 -#define UC_MCONTEXT_GREGS_R12 0x70 -#define UC_MCONTEXT_GREGS_R13 0x78 -#define UC_MCONTEXT_GREGS_R14 0x80 -#define UC_MCONTEXT_GREGS_R15 0x88 -#define UC_MCONTEXT_FS 0x94 -#define UC_MCONTEXT_GS 0x96 -#define UC_MCONTEXT_FLAGS 0xa0 -#define UC_MCONTEXT_ES 0xa4 -#define UC_MCONTEXT_DS 0xa6 -#define UC_MCONTEXT_GREGS_RIP 0xb0 -#define UC_MCONTEXT_CS 0xb8 -#define UC_MCONTEXT_RFLAGS 0xc0 -#define UC_MCONTEXT_GREGS_RSP 0xc8 -#define UC_MCONTEXT_SS 0xd0 -#define UC_MCONTEXT_MC_LEN 0xd8 -#define UC_MCONTEXT_FPFORMAT 0xe0 -#define UC_MCONTEXT_OWNEDFP 0xe8 -#define UC_MCONTEXT_FPSTATE 0xf0 -#define UC_MCONTEXT_FPOWNED_FPU 0x20001 -#define UC_MCONTEXT_FPFMT_XMM 0x10002 -#define UC_MCONTEXT_MC_LEN_VAL 0x320 +#define UC_SIGMASK 0x0 +#define UC_MCONTEXT_GREGS_RDI 0x18 +#define UC_MCONTEXT_GREGS_RSI 0x20 +#define UC_MCONTEXT_GREGS_RDX 0x28 +#define UC_MCONTEXT_GREGS_RCX 0x30 +#define UC_MCONTEXT_GREGS_R8 0x38 +#define UC_MCONTEXT_GREGS_R9 0x40 +#define UC_MCONTEXT_GREGS_RAX 0x48 +#define UC_MCONTEXT_GREGS_RBX 0x50 +#define UC_MCONTEXT_GREGS_RBP 0x58 +#define UC_MCONTEXT_GREGS_R10 0x60 +#define UC_MCONTEXT_GREGS_R11 0x68 +#define UC_MCONTEXT_GREGS_R12 0x70 +#define UC_MCONTEXT_GREGS_R13 0x78 +#define UC_MCONTEXT_GREGS_R14 0x80 +#define UC_MCONTEXT_GREGS_R15 0x88 +#define UC_MCONTEXT_FS 0x94 +#define UC_MCONTEXT_GS 0x96 +#define UC_MCONTEXT_FLAGS 0xa0 +#define UC_MCONTEXT_ES 0xa4 +#define UC_MCONTEXT_DS 0xa6 +#define UC_MCONTEXT_GREGS_RIP 0xb0 +#define UC_MCONTEXT_CS 0xb8 +#define UC_MCONTEXT_RFLAGS 0xc0 +#define UC_MCONTEXT_GREGS_RSP 0xc8 +#define UC_MCONTEXT_SS 0xd0 +#define UC_MCONTEXT_MC_LEN 0xd8 +#define UC_MCONTEXT_FPFORMAT 0xe0 +#define UC_MCONTEXT_OWNEDFP 0xe8 +#define UC_MCONTEXT_FPSTATE 0xf0 +#define UC_MCONTEXT_FPOWNED_FPU 0x20001 +#define UC_MCONTEXT_FPFMT_XMM 0x10002 +#define UC_MCONTEXT_MC_LEN_VAL 0x320 #endif diff --git a/src/x86_64/unwind_i.h b/src/x86_64/unwind_i.h index 0f1fc0bb..4f81566a 100644 --- a/src/x86_64/unwind_i.h +++ b/src/x86_64/unwind_i.h @@ -1,6 +1,6 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2002, 2005 Hewlett-Packard Co - Contributed by David Mosberger-Tang + Contributed by David Mosberger-Tang Modified for x86_64 by Max Asbock @@ -36,33 +36,33 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include /* DWARF column numbers for x86_64: */ -#define RAX 0 -#define RDX 1 -#define RCX 2 -#define RBX 3 -#define RSI 4 -#define RDI 5 -#define RBP 6 -#define RSP 7 -#define R8 8 -#define R9 9 -#define R10 10 -#define R11 11 -#define R12 12 -#define R13 13 -#define R14 14 -#define R15 15 -#define RIP 16 +#define RAX 0 +#define RDX 1 +#define RCX 2 +#define RBX 3 +#define RSI 4 +#define RDI 5 +#define RBP 6 +#define RSP 7 +#define R8 8 +#define R9 9 +#define R10 10 +#define R11 11 +#define R12 12 +#define R13 13 +#define R14 14 +#define R15 15 +#define RIP 16 -#define x86_64_lock UNW_OBJ(lock) -#define x86_64_local_resume UNW_OBJ(local_resume) -#define x86_64_local_addr_space_init UNW_OBJ(local_addr_space_init) -#define setcontext UNW_ARCH_OBJ (setcontext) +#define x86_64_lock UNW_OBJ(lock) +#define x86_64_local_resume UNW_OBJ(local_resume) +#define x86_64_local_addr_space_init UNW_OBJ(local_addr_space_init) +#define setcontext UNW_ARCH_OBJ (setcontext) #if 0 -#define x86_64_scratch_loc UNW_OBJ(scratch_loc) +#define x86_64_scratch_loc UNW_OBJ(scratch_loc) #endif -#define x86_64_r_uc_addr UNW_OBJ(r_uc_addr) -#define x86_64_sigreturn UNW_OBJ(sigreturn) +#define x86_64_r_uc_addr UNW_OBJ(r_uc_addr) +#define x86_64_sigreturn UNW_OBJ(sigreturn) /* By-pass calls to access_mem() when known to be safe. */ #ifdef UNW_LOCAL_ONLY @@ -78,7 +78,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ extern void x86_64_local_addr_space_init (void); extern int x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, - void *arg); + void *arg); extern int setcontext (const ucontext_t *ucp); #if 0