X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fppc-sysv-tdep.c;h=1c2644deb5f5c29803a7c4e7b2f2266a39f6c497;hb=b08b78e7d4bb56f395d3212eed6184ede236c760;hp=254c8c2d9da7a1f9fcbdabad72334f2f8d7c9417;hpb=cc0e89c519912e0e4e75a2fc0d836f715cdc6806;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 254c8c2d9d..1c2644deb5 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -1,7 +1,7 @@ /* Target-dependent code for PowerPC systems using the SVR4 ABI for GDB, the GNU debugger. - Copyright (C) 2000-2014 Free Software Foundation, Inc. + Copyright (C) 2000-2015 Free Software Foundation, Inc. This file is part of GDB. @@ -23,8 +23,6 @@ #include "inferior.h" #include "regcache.h" #include "value.h" -#include -#include "gdb_assert.h" #include "ppc-tdep.h" #include "target.h" #include "objfiles.h" @@ -610,7 +608,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } /* Handle the return-value conventions for Decimal Floating Point values. */ -static int +static enum return_value_convention get_decimal_float_return_value (struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf) @@ -1076,12 +1074,12 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr) { struct obj_section *dot_fn_section; struct bound_minimal_symbol dot_fn; - struct minimal_symbol *fn; + struct bound_minimal_symbol fn; /* Find the minimal symbol that corresponds to CODE_ADDR (should have a name of the form ".FN"). */ dot_fn = lookup_minimal_symbol_by_pc (code_addr); - if (dot_fn.minsym == NULL || SYMBOL_LINKAGE_NAME (dot_fn.minsym)[0] != '.') + if (dot_fn.minsym == NULL || MSYMBOL_LINKAGE_NAME (dot_fn.minsym)[0] != '.') return 0; /* Get the section that contains CODE_ADDR. Need this for the "objfile" that it contains. */ @@ -1092,12 +1090,12 @@ convert_code_addr_to_desc_addr (CORE_ADDR code_addr, CORE_ADDR *desc_addr) address. Only look for the minimal symbol in ".FN"'s object file - avoids problems when two object files (i.e., shared libraries) contain a minimal symbol with the same name. */ - fn = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (dot_fn.minsym) + 1, NULL, + fn = lookup_minimal_symbol (MSYMBOL_LINKAGE_NAME (dot_fn.minsym) + 1, NULL, dot_fn_section->objfile); - if (fn == NULL) + if (fn.minsym == NULL) return 0; /* Found a descriptor. */ - (*desc_addr) = SYMBOL_VALUE_ADDRESS (fn); + (*desc_addr) = BMSYMBOL_VALUE_ADDRESS (fn); return 1; } @@ -1894,7 +1892,8 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, } /* AltiVec vectors are returned in VRs starting at v2. */ - if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) + if (TYPE_LENGTH (valtype) == 16 + && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype) && tdep->vector_abi == POWERPC_VEC_ALTIVEC) { int regnum = tdep->ppc_vr0_regnum + 2 + index; @@ -1906,6 +1905,25 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, return 1; } + /* Short vectors are returned in GPRs starting at r3. */ + if (TYPE_LENGTH (valtype) <= 8 + && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)) + { + int regnum = tdep->ppc_gp0_regnum + 3 + index; + int offset = 0; + + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) + offset = 8 - TYPE_LENGTH (valtype); + + if (writebuf != NULL) + regcache_cooked_write_part (regcache, regnum, + offset, TYPE_LENGTH (valtype), writebuf); + if (readbuf != NULL) + regcache_cooked_read_part (regcache, regnum, + offset, TYPE_LENGTH (valtype), readbuf); + return 1; + } + return 0; } @@ -1995,6 +2013,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, /* Small character arrays are returned, right justified, in r3. */ if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY + && !TYPE_VECTOR (valtype) && TYPE_LENGTH (valtype) <= 8 && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) @@ -2014,7 +2033,13 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, /* In the ELFv2 ABI, homogeneous floating-point or vector aggregates are returned in registers. */ if (tdep->elf_abi == POWERPC_ELF_V2 - && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt)) + && ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt) + && (TYPE_CODE (eltype) == TYPE_CODE_FLT + || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT + || (TYPE_CODE (eltype) == TYPE_CODE_ARRAY + && TYPE_VECTOR (eltype) + && tdep->vector_abi == POWERPC_VEC_ALTIVEC + && TYPE_LENGTH (eltype) == 16))) { for (i = 0; i < nelt; i++) {