mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 11:00:01 +08:00
* alpha-tdep.c (alpha_extract_return_value): Convert to regcache.
(alpha_extract_struct_value_address): Likewise. (alpha_store_return_value): Likewise. (alpha_store_struct_return): Remove. (alpha_gdbarch_init): Update hook registration to match.
This commit is contained in:
@ -1,5 +1,11 @@
|
|||||||
2003-06-02 Richard Henderson <rth@redhat.com>
|
2003-06-02 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
* alpha-tdep.c (alpha_extract_return_value): Convert to regcache.
|
||||||
|
(alpha_extract_struct_value_address): Likewise.
|
||||||
|
(alpha_store_return_value): Likewise.
|
||||||
|
(alpha_store_struct_return): Remove.
|
||||||
|
(alpha_gdbarch_init): Update hook registration to match.
|
||||||
|
|
||||||
* alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of
|
* alpha-tdep.c (alpha_register_convert_to_virtual): Tidy use of
|
||||||
deprecated interfaces; use ALPHA_REGISTER_SIZE instead of gdbarch
|
deprecated interfaces; use ALPHA_REGISTER_SIZE instead of gdbarch
|
||||||
macros where appropriate.
|
macros where appropriate.
|
||||||
|
127
gdb/alpha-tdep.c
127
gdb/alpha-tdep.c
@ -377,42 +377,90 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, CORE_ADDR func_addr,
|
|||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a return value in `regbuf' with a type `valtype',
|
/* Extract from REGCACHE the value about to be returned from a function
|
||||||
extract and copy its value into `valbuf'. */
|
and copy it into VALBUF. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
alpha_extract_return_value (struct type *valtype,
|
alpha_extract_return_value (struct type *valtype, struct regcache *regcache,
|
||||||
char regbuf[ALPHA_REGISTER_BYTES], char *valbuf)
|
void *valbuf)
|
||||||
{
|
|
||||||
if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
|
|
||||||
alpha_register_convert_to_virtual (FP0_REGNUM, valtype,
|
|
||||||
regbuf + REGISTER_BYTE (FP0_REGNUM),
|
|
||||||
valbuf);
|
|
||||||
else
|
|
||||||
memcpy (valbuf, regbuf + REGISTER_BYTE (ALPHA_V0_REGNUM),
|
|
||||||
TYPE_LENGTH (valtype));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Given a return value in `regbuf' with a type `valtype',
|
|
||||||
write its value into the appropriate register. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
alpha_store_return_value (struct type *valtype, char *valbuf)
|
|
||||||
{
|
{
|
||||||
char raw_buffer[ALPHA_REGISTER_SIZE];
|
char raw_buffer[ALPHA_REGISTER_SIZE];
|
||||||
int regnum = ALPHA_V0_REGNUM;
|
ULONGEST l;
|
||||||
int length = TYPE_LENGTH (valtype);
|
|
||||||
|
|
||||||
if (TYPE_CODE (valtype) == TYPE_CODE_FLT)
|
switch (TYPE_CODE (valtype))
|
||||||
{
|
{
|
||||||
regnum = FP0_REGNUM;
|
case TYPE_CODE_FLT:
|
||||||
length = ALPHA_REGISTER_SIZE;
|
switch (TYPE_LENGTH (valtype))
|
||||||
alpha_register_convert_to_raw (valtype, regnum, valbuf, raw_buffer);
|
{
|
||||||
}
|
case 4:
|
||||||
else
|
regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, raw_buffer);
|
||||||
memcpy (raw_buffer, valbuf, length);
|
alpha_convert_dbl_flt (valbuf, raw_buffer);
|
||||||
|
break;
|
||||||
|
|
||||||
deprecated_write_register_bytes (REGISTER_BYTE (regnum), raw_buffer, length);
|
case 8:
|
||||||
|
regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, valbuf);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* Assume everything else degenerates to an integer. */
|
||||||
|
regcache_cooked_read_unsigned (regcache, ALPHA_V0_REGNUM, &l);
|
||||||
|
store_unsigned_integer (valbuf, TYPE_LENGTH (valtype), l);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extract from REGCACHE the address of a structure about to be returned
|
||||||
|
from a function. */
|
||||||
|
|
||||||
|
static CORE_ADDR
|
||||||
|
alpha_extract_struct_value_address (struct regcache *regcache)
|
||||||
|
{
|
||||||
|
ULONGEST addr;
|
||||||
|
regcache_cooked_read_unsigned (regcache, ALPHA_V0_REGNUM, &addr);
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Insert the given value into REGCACHE as if it was being
|
||||||
|
returned by a function. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
alpha_store_return_value (struct type *valtype, struct regcache *regcache,
|
||||||
|
const void *valbuf)
|
||||||
|
{
|
||||||
|
int length = TYPE_LENGTH (valtype);
|
||||||
|
char raw_buffer[ALPHA_REGISTER_SIZE];
|
||||||
|
ULONGEST l;
|
||||||
|
|
||||||
|
switch (TYPE_CODE (valtype))
|
||||||
|
{
|
||||||
|
case TYPE_CODE_FLT:
|
||||||
|
switch (length)
|
||||||
|
{
|
||||||
|
case 4:
|
||||||
|
alpha_convert_flt_dbl (raw_buffer, valbuf);
|
||||||
|
valbuf = raw_buffer;
|
||||||
|
/* FALLTHRU */
|
||||||
|
|
||||||
|
case 8:
|
||||||
|
regcache_cooked_write (regcache, ALPHA_FP0_REGNUM, valbuf);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
/* Assume everything else degenerates to an integer. */
|
||||||
|
l = unpack_long (valtype, valbuf);
|
||||||
|
regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -422,20 +470,6 @@ alpha_use_struct_convention (int gcc_p, struct type *type)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
alpha_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
|
|
||||||
{
|
|
||||||
/* Store the address of the place in which to copy the structure the
|
|
||||||
subroutine will return. Handled by alpha_push_arguments. */
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
alpha_extract_struct_value_address (char *regbuf)
|
|
||||||
{
|
|
||||||
return (extract_unsigned_integer (regbuf + REGISTER_BYTE (ALPHA_V0_REGNUM),
|
|
||||||
REGISTER_RAW_SIZE (ALPHA_V0_REGNUM)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const unsigned char *
|
static const unsigned char *
|
||||||
alpha_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
|
alpha_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
|
||||||
@ -1325,10 +1359,9 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
generic_frameless_function_invocation_not);
|
generic_frameless_function_invocation_not);
|
||||||
|
|
||||||
set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention);
|
set_gdbarch_use_struct_convention (gdbarch, alpha_use_struct_convention);
|
||||||
set_gdbarch_deprecated_extract_return_value (gdbarch, alpha_extract_return_value);
|
set_gdbarch_extract_return_value (gdbarch, alpha_extract_return_value);
|
||||||
set_gdbarch_deprecated_store_struct_return (gdbarch, alpha_store_struct_return);
|
set_gdbarch_store_return_value (gdbarch, alpha_store_return_value);
|
||||||
set_gdbarch_deprecated_store_return_value (gdbarch, alpha_store_return_value);
|
set_gdbarch_extract_struct_value_address (gdbarch,
|
||||||
set_gdbarch_deprecated_extract_struct_value_address (gdbarch,
|
|
||||||
alpha_extract_struct_value_address);
|
alpha_extract_struct_value_address);
|
||||||
|
|
||||||
/* Settings for calling functions in the inferior. */
|
/* Settings for calling functions in the inferior. */
|
||||||
|
Reference in New Issue
Block a user