44 if (ftype->
code () == TYPE_CODE_PTR)
47 return (ftype->
code () == TYPE_CODE_FUNC
65 int nargs,
struct value **args, CORE_ADDR sp,
67 CORE_ADDR struct_addr)
92 for (write_pass = 0; write_pass < 2; write_pass++)
106 int structoffset = argoffset + argspace;
121 for (argno = 0; argno < nargs; argno++)
123 struct value *arg = args[argno];
128 if (
type->
code () == TYPE_CODE_FLT && len <= 8
162 argoffset = align_up (argoffset, len);
168 else if (
type->
code () == TYPE_CODE_FLT
188 argoffset = align_up (argoffset, 8);
197 || (
type->
code () == TYPE_CODE_DECFLOAT
210 argoffset = align_up (argoffset, 8);
234 || (
type->
code () == TYPE_CODE_DECFLOAT
243 argoffset = align_up (argoffset, 8);
264 else if (
type->
code () == TYPE_CODE_DECFLOAT && len <= 8
281 memcpy (regval + 4, val, 4);
294 argoffset = align_up (argoffset, len);
303 else if (
type->
code () == TYPE_CODE_DECFLOAT && len == 16
323 argoffset = align_up (argoffset, 8);
347 for (i = 0; i < nelt; i++)
349 const gdb_byte *elval = val + i * eltype->
length ();
369 argoffset = align_up (argoffset, len);
375 else if (eltype->
length () == 8)
381 argoffset = align_up (argoffset, 8);
416 argoffset = align_up (argoffset, tdep->
wordsize);
433 for (i = 0; i < len / 16; i++)
435 const gdb_byte *elval = val + i * 16;
446 argoffset = align_up (argoffset, 16);
454 && ((
type->
code () == TYPE_CODE_ARRAY
473 argoffset = align_up (argoffset, 16);
499 argoffset = align_up (argoffset, 8);
512 ||
type->
code () == TYPE_CODE_STRUCT
513 ||
type->
code () == TYPE_CODE_UNION)
517 if (
type->
code () == TYPE_CODE_ARRAY
520 structoffset = align_up (structoffset, 16);
522 structoffset = align_up (structoffset, 8);
532 else if (
type->
code () == TYPE_CODE_INT)
538 memcpy (word, val, len);
549 argoffset = align_up (argoffset, tdep->
wordsize);
561 argspace = argoffset;
563 sp -= (argoffset + structoffset);
565 sp = align_down (sp, 16);
604 const gdb_byte *writebuf)
608 gdb_assert (valtype->
code () == TYPE_CODE_DECFLOAT);
611 if (valtype->
length () <= 8)
613 if (writebuf != NULL)
619 if (valtype->
length () == 4)
621 memcpy (regval + 4, writebuf, 4);
634 if (valtype->
length () == 4)
635 memcpy (readbuf, readbuf + 4, 4);
639 else if (valtype->
length () == 16)
641 if (writebuf != NULL || readbuf != NULL)
645 for (i = 0; i < 2; i++)
647 if (writebuf != NULL)
658 internal_error (_(
"Unknown decimal float size."));
681 gdb_byte *readbuf,
const gdb_byte *writebuf,
782 else if ((
type->
code () == TYPE_CODE_INT
812 if (
type->
code () == TYPE_CODE_ARRAY
820 for (i = 0; i < nelt; i++)
822 int offset = i * eltype->
length ();
824 if (eltype->
code () == TYPE_CODE_FLT)
830 if (writebuf != NULL)
840 readbuf + offset, eltype);
848 if (writebuf != NULL)
857 eltype->
length (), byte_order,
866 if (
type->
code () == TYPE_CODE_ARRAY
874 for (i = 0; i < n_regs; i++)
879 if (writebuf != NULL)
960 memcpy (readbuf, regvals + offset, len);
964 memset (regvals, 0,
sizeof regvals);
965 memcpy (regvals + offset, writebuf, len);
996 memset (regvals, 0,
sizeof regvals);
1012 gdb_byte *readbuf,
const gdb_byte *writebuf)
1016 valtype,
regcache, readbuf, writebuf, 0);
1021 struct value *function,
1022 struct type *valtype,
1024 gdb_byte *readbuf,
const gdb_byte *writebuf)
1028 valtype,
regcache, readbuf, writebuf, 1);
1057 if (dot_fn_section == NULL || dot_fn_section->
objfile == NULL)
1081 struct type **field_type)
1088 case TYPE_CODE_DECFLOAT:
1091 if ((*field_type)->code () ==
type->
code ()
1092 && (*field_type)->length () ==
type->
length ())
1096 case TYPE_CODE_COMPLEX:
1099 ||
type->
code () == TYPE_CODE_DECFLOAT)
1103 if ((*field_type)->code () ==
type->
code ()
1104 && (*field_type)->length () ==
type->
length ())
1109 case TYPE_CODE_ARRAY:
1114 if ((*field_type)->code () ==
type->
code ()
1115 && (*field_type)->length () ==
type->
length ())
1120 LONGEST count, low_bound, high_bound;
1129 count *= high_bound - low_bound;
1134 else if (
type->
length () != count * (*field_type)->length ())
1141 case TYPE_CODE_STRUCT:
1142 case TYPE_CODE_UNION:
1156 if (sub_count == -1)
1159 if (
type->
code () == TYPE_CODE_STRUCT)
1162 count = std::max (count, sub_count);
1168 else if (
type->
length () != count * (*field_type)->length ())
1189 struct type **elt_type,
int *n_elts,
1194 if (
type->
code () == TYPE_CODE_STRUCT
1195 ||
type->
code () == TYPE_CODE_UNION
1198 struct type *field_type = NULL;
1201 if (field_count > 0)
1205 if (field_type->
code () == TYPE_CODE_FLT
1211 else if (field_type->
code () == TYPE_CODE_FLT
1212 || field_type->
code () == TYPE_CODE_DECFLOAT)
1213 n_regs = (field_type->
length () + 7) >> 3;
1220 if (field_count * n_regs <= 8)
1223 *elt_type = field_type;
1225 *n_elts = (int) field_count;
1268 const bfd_byte *val,
int len,
int align,
1277 CORE_ADDR aligned_gparam = align_up (argpos->
gparam, align);
1280 argpos->
gparam = aligned_gparam;
1287 if (len < tdep->wordsize
1336 struct type *
type,
const bfd_byte *val,
1361 &&
type->
code () == TYPE_CODE_DECFLOAT)
1390 if (argpos->
freg <= 12)
1397 &&
type->
code () == TYPE_CODE_DECFLOAT)
1437 struct type *
type,
const bfd_byte *val,
1451 else if (
type->
code () == TYPE_CODE_FLT
1452 ||
type->
code () == TYPE_CODE_DECFLOAT)
1472 CORE_ADDR addr = align_up (argpos->
refparam, 16);
1480 else if ((
type->
code () == TYPE_CODE_INT
1498 ||
type->
code () == TYPE_CODE_REF))
1506 CORE_ADDR desc = word;
1526 if (
type->
code () == TYPE_CODE_STRUCT
1529 while (
type->
code () == TYPE_CODE_STRUCT
1533 if (
type->
code () == TYPE_CODE_FLT) {
1552 struct type *eltype;
1557 for (i = 0; i < nelt; i++)
1559 const gdb_byte *elval = val + i * eltype->
length ();
1561 if (eltype->
code () == TYPE_CODE_FLT
1562 && eltype->
length () == 16
1570 else if (eltype->
code () == TYPE_CODE_FLT
1571 || eltype->
code () == TYPE_CODE_DECFLOAT)
1575 else if (eltype->
code () == TYPE_CODE_ARRAY
1578 && eltype->
length () == 16)
1599 struct value *function,
1601 int nargs,
struct value **args, CORE_ADDR sp,
1603 CORE_ADDR struct_addr)
1609 ULONGEST back_chain;
1614 LONGEST refparam_size = 0;
1617 LONGEST gparam_size = 0;
1646 for (write_pass = 0; write_pass < 2; write_pass++)
1671 argpos.
refparam = align_down (sp - refparam_size, 16);
1677 sp = align_down (argpos.
gparam - 48, 16);
1679 sp = align_down (argpos.
gparam - 32, 16);
1690 for (argno = 0; argno < nargs; argno++)
1692 struct value *arg = args[argno];
1696 if (
type->
code () == TYPE_CODE_COMPLEX)
1703 val + eltype->
length (), &argpos);
1711 struct type *eltype;
1720 for (i = 0; i < nelt; i++)
1722 const gdb_byte *elval = val + i * eltype->
length ();
1740 if (argpos.
greg < 8)
1743 gparam_size = argpos.
gparam;
1765 if (ftype->
code () == TYPE_CODE_PTR
1798 const gdb_byte *writebuf,
int index)
1803 if ((valtype->
code () == TYPE_CODE_INT
1804 || valtype->
code () == TYPE_CODE_ENUM
1805 || valtype->
code () == TYPE_CODE_CHAR
1806 || valtype->
code () == TYPE_CODE_BOOL
1807 || valtype->
code () == TYPE_CODE_RANGE
1809 && valtype->
length () <= 8)
1813 if (writebuf != NULL)
1822 unscaled.
read (gdb::make_array_view (writebuf,
1826 return_val = unscaled.
as_integer<LONGEST> ();
1834 if (readbuf != NULL)
1849 if (valtype->
length () <= 8
1850 && valtype->
code () == TYPE_CODE_FLT)
1856 if (writebuf != NULL)
1861 if (readbuf != NULL)
1871 if (valtype->
length () <= 8
1872 && valtype->
code () == TYPE_CODE_DECFLOAT)
1878 offset = 8 - valtype->
length ();
1880 if (writebuf != NULL)
1883 if (readbuf != NULL)
1890 if (valtype->
length () == 16
1891 && valtype->
code () == TYPE_CODE_FLT
1897 if (writebuf != NULL)
1902 if (readbuf != NULL)
1912 if (valtype->
length () == 16
1913 && valtype->
code () == TYPE_CODE_DECFLOAT)
1919 if (writebuf != NULL)
1924 if (readbuf != NULL)
1935 if (valtype->
length () == 16
1936 && ((valtype->
code () == TYPE_CODE_ARRAY
1939 || (valtype->
code () == TYPE_CODE_FLT
1945 if (writebuf != NULL)
1947 if (readbuf != NULL)
1953 if (valtype->
length () <= 8
1954 && valtype->
code () == TYPE_CODE_ARRAY && valtype->
is_vector ())
1960 offset = 8 - valtype->
length ();
1962 if (writebuf != NULL)
1965 if (readbuf != NULL)
1987 gdb_byte *readbuf,
const gdb_byte *writebuf)
1992 struct type *eltype;
2001 if (valtype->
code () == TYPE_CODE_COMPLEX)
2005 for (
int i = 0; i < 2; i++)
2008 readbuf, writebuf, i);
2012 readbuf += eltype->
length ();
2014 writebuf += eltype->
length ();
2022 if (valtype->
code () == TYPE_CODE_ARRAY && valtype->
is_vector ()
2025 if (valtype->
length () < 16)
2031 for (
int i = 0; i < nelt; i++)
2034 readbuf, writebuf, i);
2038 readbuf += eltype->
length ();
2040 writebuf += eltype->
length ();
2050 if (writebuf != NULL)
2052 if (readbuf != NULL)
2058 if (valtype->
code () == TYPE_CODE_ARRAY
2060 && valtype->
length () <= 8
2067 if (writebuf != NULL)
2070 if (readbuf != NULL)
2081 && (eltype->
code () == TYPE_CODE_FLT
2082 || eltype->
code () == TYPE_CODE_DECFLOAT
2083 || (eltype->
code () == TYPE_CODE_ARRAY
2086 && eltype->
length () == 16)))
2088 for (
int i = 0; i < nelt; i++)
2091 readbuf, writebuf, i);
2095 readbuf += eltype->
length ();
2097 writebuf += eltype->
length ();
2104 && valtype->
code () == TYPE_CODE_STRUCT)
2110 && valtype->
length () <= 16
2111 && (valtype->
code () == TYPE_CODE_STRUCT
2112 || valtype->
code () == TYPE_CODE_UNION
2113 || (valtype->
code () == TYPE_CODE_ARRAY
2119 for (
int i = 0; i < n_regs; i++)
2124 int len = valtype->
length () - offset;
2129 if (writebuf != NULL)
2131 memset (regval, 0,
sizeof regval);
2134 memcpy (regval + tdep->
wordsize - len, writebuf, len);
2136 memcpy (regval, writebuf + offset, len);
2139 if (readbuf != NULL)
2144 memcpy (readbuf, regval + tdep->
wordsize - len, len);
2146 memcpy (readbuf + offset, regval, len);
2154 readbuf, writebuf, 0))
2179 CORE_ADDR return_val = 0;
2194 catch (
const gdb_exception_error &e)
2196 warning (
"Cannot determine the function return value.\n"
2197 "Try compiling with -fvar-tracking.");
enum register_status cooked_read_part(int regnum, int offset, int len, gdb_byte *buf)
enum register_status cooked_read(int regnum, gdb_byte *buf)
void cooked_write(int regnum, const gdb_byte *buf)
void cooked_write_part(int regnum, int offset, int len, const gdb_byte *buf)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
ULONGEST read_memory_unsigned_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
void write_memory_signed_integer(CORE_ADDR addr, int len, enum bfd_endian byte_order, LONGEST value)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
@ RETURN_VALUE_REGISTER_CONVENTION
@ RETURN_VALUE_STRUCT_CONVENTION
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
int gdbarch_sp_regnum(struct gdbarch *gdbarch)
const struct floatformat ** gdbarch_long_double_format(struct gdbarch *gdbarch)
function_call_return_method
enum bfd_endian type_byte_order(const struct type *type)
struct type * lookup_pointer_type(struct type *type)
const struct floatformat * floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN]
int field_is_static(struct field *f)
const struct floatformat * floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN]
bool get_array_bounds(struct type *type, LONGEST *low_bound, LONGEST *high_bound)
bool is_fixed_point_type(struct type *type)
struct type * check_typedef(struct type *type)
#define TYPE_IS_REFERENCE(t)
#define TYPE_CALLING_CONVENTION(thistype)
@ CALL_SITE_PARAMETER_DWARF_REG
CORE_ADDR find_function_addr(struct value *function, struct type **retval_type, struct type **function_type)
struct language_pass_by_ref_info language_pass_by_reference(struct type *type)
struct value * value_of_dwarf_reg_entry(struct type *type, frame_info_ptr frame, enum call_site_parameter_kind kind, union call_site_parameter_u kind_u)
struct bound_minimal_symbol lookup_minimal_symbol(const char *name, const char *sfile, struct objfile *objf)
struct bound_minimal_symbol lookup_minimal_symbol_by_pc(CORE_ADDR pc)
struct obj_section * find_pc_section(CORE_ADDR pc)
CORE_ADDR ppc_sysv_abi_push_dummy_call(struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr)
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)
CORE_ADDR ppc64_sysv_abi_push_dummy_call(struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, function_call_return_method return_method, CORE_ADDR struct_addr)
static int ppc_sysv_use_opencl_abi(struct type *ftype)
enum return_value_convention ppc64_sysv_abi_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static enum return_value_convention do_ppc_sysv_return_value(struct gdbarch *gdbarch, struct type *func_type, struct type *type, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf, int broken_gcc)
static void ppc64_sysv_abi_push_integer(struct gdbarch *gdbarch, ULONGEST val, struct ppc64_sysv_argpos *argpos)
static void ppc64_sysv_abi_push_param(struct gdbarch *gdbarch, struct type *type, const bfd_byte *val, struct ppc64_sysv_argpos *argpos)
static int convert_code_addr_to_desc_addr(CORE_ADDR code_addr, CORE_ADDR *desc_addr)
CORE_ADDR ppc64_sysv_get_return_buf_addr(struct type *val_type, frame_info_ptr cur_frame)
enum return_value_convention ppc_sysv_abi_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static void ppc64_sysv_abi_push_val(struct gdbarch *gdbarch, const bfd_byte *val, int len, int align, struct ppc64_sysv_argpos *argpos)
static void ppc64_sysv_abi_push_vreg(struct gdbarch *gdbarch, const bfd_byte *val, struct ppc64_sysv_argpos *argpos)
static LONGEST ppc64_aggregate_candidate(struct type *type, struct type **field_type)
enum return_value_convention ppc_sysv_abi_broken_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
static int ppc64_elfv2_abi_homogeneous_aggregate(struct type *type, struct type **elt_type, int *n_elts, struct gdbarch *gdbarch)
static int ppc64_sysv_abi_return_value_base(struct gdbarch *gdbarch, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf, int index)
static void ppc64_sysv_abi_push_freg(struct gdbarch *gdbarch, struct type *type, const bfd_byte *val, struct ppc64_sysv_argpos *argpos)
#define PPC_MAX_REGISTER_SIZE
int ppc_floating_point_unit_p(struct gdbarch *gdbarch)
int register_size(struct gdbarch *gdbarch, int regnum)
void regcache_cooked_write_signed(struct regcache *regcache, int regnum, LONGEST val)
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
struct type * register_type(struct gdbarch *gdbarch, int regnum)
CORE_ADDR value_address() const
struct minimal_symbol * minsym
struct type * type() const
void read(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order, bool unsigned_p)
const char * linkage_name() const
struct regcache * regcache
struct type * target_type() const
struct field & field(int idx) const
void target_float_convert(const gdb_byte *from, const struct type *from_type, gdb_byte *to, const struct type *to_type)
struct type * value_type(const struct value *value)
CORE_ADDR value_as_address(struct value *val)
gdb::array_view< const gdb_byte > value_contents(struct value *value)
LONGEST unpack_long(struct type *type, const gdb_byte *valaddr)