2005-05-24 Andrew Cagney <cagney@gnu.org>

* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
	for byte buffers.
	(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
	(rs6000_software_single_step, sstep_breaks, skip_prologue)
	(rs6000_push_dummy_call, rs6000_push_dummy_call)
	(rs6000_push_dummy_call, rs6000_push_dummy_call)
	(rs6000_register_to_value, e500_pseudo_register_read)
	(rs6000_store_return_value, e500_pseudo_register_write)
	(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
	* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
	(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
	(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
	(ppc_sysv_abi_broken_return_value)
	(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
	(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
	(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
	* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
	(ppc_linux_at_sigtramp_return_path)
	(ppc_linux_skip_trampoline_code)
	(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
	* rs6000-tdep.c (rs6000_value_to_register)
	(rs6000_register_to_value): Ditto.
	* ppc-tdep.h (ppc_sysv_abi_return_value)
	(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
	(ppc_linux_memory_remove_breakpoint): Ditto.
This commit is contained in:
Andrew Cagney 2005-05-25 03:12:13 +00:00
parent 39c833404f
commit 50fd128082
5 changed files with 94 additions and 67 deletions

View File

@ -1,3 +1,31 @@
2005-05-24 Andrew Cagney <cagney@gnu.org>
* rs6000-tdep.c (ppc_supply_reg, ppc_collect_reg): Use gdb_byte
for byte buffers.
(rs6000_fetch_pointer_argument): Use get_frame_register_unsigned.
(rs6000_software_single_step, sstep_breaks, skip_prologue)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_push_dummy_call, rs6000_push_dummy_call)
(rs6000_register_to_value, e500_pseudo_register_read)
(rs6000_store_return_value, e500_pseudo_register_write)
(rs6000_frame_prev_register, rs6000_extract_return_value): Ditto.
* ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call)
(ppc_sysv_abi_push_dummy_call, do_ppc_sysv_return_value)
(do_ppc_sysv_return_value, ppc_sysv_abi_return_value)
(ppc_sysv_abi_broken_return_value)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_push_dummy_call)
(ppc64_sysv_abi_push_dummy_call, ppc64_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc64_sysv_abi_return_value): Ditto.
* ppc-linux-tdep.c (ppc_linux_in_sigtramp)
(ppc_linux_at_sigtramp_return_path)
(ppc_linux_skip_trampoline_code)
(ppc_linux_memory_remove_breakpoint, ppc_linux_return_value):
* rs6000-tdep.c (rs6000_value_to_register)
(rs6000_register_to_value): Ditto.
* ppc-tdep.h (ppc_sysv_abi_return_value)
(ppc64_sysv_abi_return_value, ppc_sysv_abi_broken_return_value)
(ppc_linux_memory_remove_breakpoint): Ditto.
2005-05-24 Ulrich Weigand <uweigand@de.ibm.com>
* s390-tdep.c (s390_frame_prev_register): Change type of last

View File

@ -157,7 +157,7 @@ ppc_linux_in_sigtramp (CORE_ADDR pc, char *func_name)
CORE_ADDR lr;
CORE_ADDR sp;
CORE_ADDR tramp_sp;
char buf[4];
gdb_byte buf[4];
CORE_ADDR handler;
lr = read_register (gdbarch_tdep (current_gdbarch)->ppc_lr_regnum);
@ -205,7 +205,7 @@ insn_is_sigreturn (unsigned long pcinsn)
static int
ppc_linux_at_sigtramp_return_path (CORE_ADDR pc)
{
char buf[12];
gdb_byte buf[12];
unsigned long pcinsn;
if (target_read_memory (pc - 4, buf, sizeof (buf)) != 0)
return 0;
@ -224,7 +224,7 @@ ppc_linux_at_sigtramp_return_path (CORE_ADDR pc)
static CORE_ADDR
ppc_linux_skip_trampoline_code (CORE_ADDR pc)
{
char buf[4];
gdb_byte buf[4];
struct obj_section *sect;
struct objfile *objfile;
unsigned long insn;
@ -317,7 +317,8 @@ ppc_linux_skip_trampoline_code (CORE_ADDR pc)
/* Fetch the string; we don't know how long it is. Is it possible
that the following will fail because we're trying to fetch too
much? */
if (target_read_memory (strtab + symidx, symname, sizeof (symname)) != 0)
if (target_read_memory (strtab + symidx, (gdb_byte *) symname,
sizeof (symname)) != 0)
return 0;
/* This might not work right if we have multiple symbols with the
@ -455,12 +456,13 @@ ppc_linux_skip_trampoline_code (CORE_ADDR pc)
regard to removing breakpoints in some potentially self modifying
code. */
int
ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
ppc_linux_memory_remove_breakpoint (CORE_ADDR addr,
gdb_byte *contents_cache)
{
const unsigned char *bp;
int val;
int bplen;
char old_contents[BREAKPOINT_MAX];
gdb_byte old_contents[BREAKPOINT_MAX];
/* Determine appropriate breakpoint contents and size for this address. */
bp = BREAKPOINT_FROM_PC (&addr, &bplen);
@ -485,8 +487,8 @@ ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
static enum return_value_convention
ppc_linux_return_value (struct gdbarch *gdbarch, struct type *valtype,
struct regcache *regcache, void *readbuf,
const void *writebuf)
struct regcache *regcache, gdb_byte *readbuf,
const gdb_byte *writebuf)
{
if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
|| TYPE_CODE (valtype) == TYPE_CODE_UNION)

View File

@ -114,7 +114,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* Always store the floating point value using
the register's floating-point format. */
char regval[MAX_REGISTER_SIZE];
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, tdep->ppc_fp0_regnum + freg);
convert_typed_floating (val, type, regval, regtype);
@ -242,7 +242,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* Reduce the parameter down to something that fits in a
"word". */
char word[MAX_REGISTER_SIZE];
gdb_byte word[MAX_REGISTER_SIZE];
memset (word, 0, MAX_REGISTER_SIZE);
if (len > tdep->wordsize
|| TYPE_CODE (type) == TYPE_CODE_STRUCT
@ -340,7 +340,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
{
/* Floats and doubles stored in "f1". Convert the value to
the required type. */
char regval[MAX_REGISTER_SIZE];
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch,
tdep->ppc_fp0_regnum + 1);
regcache_cooked_read (regcache, tdep->ppc_fp0_regnum + 1, regval);
@ -350,7 +350,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
{
/* Floats and doubles stored in "f1". Convert the value to
the register's "double" type. */
char regval[MAX_REGISTER_SIZE];
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
convert_typed_floating (writebuf, type, regval, regtype);
regcache_cooked_write (regcache, tdep->ppc_fp0_regnum + 1, regval);
@ -488,7 +488,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
/* This matches SVr4 PPC, it does not match GCC. */
/* The value is right-padded to 8 bytes and then loaded, as
two "words", into r3/r4. */
char regvals[MAX_REGISTER_SIZE * 2];
gdb_byte regvals[MAX_REGISTER_SIZE * 2];
regcache_cooked_read (regcache, tdep->ppc_gp0_regnum + 3,
regvals + 0 * tdep->wordsize);
if (TYPE_LENGTH (type) > tdep->wordsize)
@ -501,7 +501,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
/* This matches SVr4 PPC, it does not match GCC. */
/* The value is padded out to 8 bytes and then loaded, as
two "words" into r3/r4. */
char regvals[MAX_REGISTER_SIZE * 2];
gdb_byte regvals[MAX_REGISTER_SIZE * 2];
memset (regvals, 0, sizeof regvals);
memcpy (regvals, writebuf, TYPE_LENGTH (type));
regcache_cooked_write (regcache, tdep->ppc_gp0_regnum + 3,
@ -517,8 +517,8 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type,
enum return_value_convention
ppc_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype,
struct regcache *regcache, void *readbuf,
const void *writebuf)
struct regcache *regcache, gdb_byte *readbuf,
const gdb_byte *writebuf)
{
return do_ppc_sysv_return_value (gdbarch, valtype, regcache, readbuf,
writebuf, 0);
@ -528,7 +528,7 @@ enum return_value_convention
ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch,
struct type *valtype,
struct regcache *regcache,
void *readbuf, const void *writebuf)
gdb_byte *readbuf, const gdb_byte *writebuf)
{
return do_ppc_sysv_return_value (gdbarch, valtype, regcache, readbuf,
writebuf, 1);
@ -688,7 +688,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (ppc_floating_point_unit_p (current_gdbarch)
&& freg <= 13)
{
char regval[MAX_REGISTER_SIZE];
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype
= register_type (gdbarch, tdep->ppc_fp0_regnum);
convert_typed_floating (val, type, regval, regtype);
@ -707,7 +707,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
This code interprets that to mean: store it,
left aligned, in the general register. */
char regval[MAX_REGISTER_SIZE];
gdb_byte regval[MAX_REGISTER_SIZE];
memset (regval, 0, sizeof regval);
memcpy (regval, val, TYPE_LENGTH (type));
regcache_cooked_write (regcache,
@ -782,7 +782,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
if (write_pass && greg <= 10)
{
char regval[MAX_REGISTER_SIZE];
gdb_byte regval[MAX_REGISTER_SIZE];
int len = TYPE_LENGTH (type) - byte;
if (len > tdep->wordsize)
len = tdep->wordsize;
@ -880,8 +880,8 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
corresponding register return-value location. */
enum return_value_convention
ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype,
struct regcache *regcache, void *readbuf,
const void *writebuf)
struct regcache *regcache, gdb_byte *readbuf,
const gdb_byte *writebuf)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@ -893,7 +893,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype,
/* Floats and doubles in F1. */
if (TYPE_CODE (valtype) == TYPE_CODE_FLT && TYPE_LENGTH (valtype) <= 8)
{
char regval[MAX_REGISTER_SIZE];
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
if (writebuf != NULL)
{
@ -984,7 +984,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype,
int i;
for (i = 0; i < 2; i++)
{
char regval[MAX_REGISTER_SIZE];
gdb_byte regval[MAX_REGISTER_SIZE];
struct type *regtype =
register_type (current_gdbarch, tdep->ppc_fp0_regnum);
if (writebuf != NULL)

View File

@ -33,13 +33,13 @@ struct type;
enum return_value_convention ppc_sysv_abi_return_value (struct gdbarch *gdbarch,
struct type *valtype,
struct regcache *regcache,
void *readbuf,
const void *writebuf);
gdb_byte *readbuf,
const gdb_byte *writebuf);
enum return_value_convention ppc_sysv_abi_broken_return_value (struct gdbarch *gdbarch,
struct type *valtype,
struct regcache *regcache,
void *readbuf,
const void *writebuf);
gdb_byte *readbuf,
const gdb_byte *writebuf);
CORE_ADDR ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
struct value *function,
struct regcache *regcache,
@ -56,7 +56,8 @@ CORE_ADDR ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch,
CORE_ADDR struct_addr);
CORE_ADDR ppc64_sysv_abi_adjust_breakpoint_address (struct gdbarch *gdbarch,
CORE_ADDR bpaddr);
int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr, char *contents_cache);
int ppc_linux_memory_remove_breakpoint (CORE_ADDR addr,
gdb_byte *contents_cache);
struct link_map_offsets *ppc_linux_svr4_fetch_link_map_offsets (void);
void ppc_linux_supply_gregset (struct regcache *regcache,
int regnum, const void *gregs, size_t size,
@ -68,8 +69,8 @@ void ppc_linux_supply_fpregset (const struct regset *regset,
enum return_value_convention ppc64_sysv_abi_return_value (struct gdbarch *gdbarch,
struct type *valtype,
struct regcache *regcache,
void *readbuf,
const void *writebuf);
gdb_byte *readbuf,
const gdb_byte *writebuf);
/* From rs6000-tdep.c... */
int altivec_register_p (int regno);

View File

@ -112,12 +112,12 @@ struct reg
/* Breakpoint shadows for the single step instructions will be kept here. */
static struct sstep_breaks
{
/* Address, or 0 if this is not in use. */
CORE_ADDR address;
/* Shadow contents. */
char data[4];
}
{
/* Address, or 0 if this is not in use. */
CORE_ADDR address;
/* Shadow contents. */
gdb_byte data[4];
}
stepBreaks[2];
/* Hook for determining the TOC address when calling functions in the
@ -319,7 +319,7 @@ rs6000_register_sim_regno (int reg)
static void
ppc_supply_reg (struct regcache *regcache, int regnum,
const char *regs, size_t offset)
const gdb_byte *regs, size_t offset)
{
if (regnum != -1 && offset != -1)
regcache_raw_supply (regcache, regnum, regs + offset);
@ -327,7 +327,7 @@ ppc_supply_reg (struct regcache *regcache, int regnum,
static void
ppc_collect_reg (const struct regcache *regcache, int regnum,
char *regs, size_t offset)
gdb_byte *regs, size_t offset)
{
if (regnum != -1 && offset != -1)
regcache_raw_collect (regcache, regnum, regs + offset);
@ -520,9 +520,7 @@ static CORE_ADDR
rs6000_fetch_pointer_argument (struct frame_info *frame, int argi,
struct type *type)
{
CORE_ADDR addr;
get_frame_register (frame, 3 + argi, &addr);
return addr;
return get_frame_register_unsigned (frame, 3 + argi);
}
/* Calculate the destination of a branch/jump. Return -1 if not a branch. */
@ -621,7 +619,7 @@ rs6000_software_single_step (enum target_signal signal,
{
CORE_ADDR dummy;
int breakp_sz;
const char *breakp = rs6000_breakpoint_from_pc (&dummy, &breakp_sz);
const gdb_byte *breakp = rs6000_breakpoint_from_pc (&dummy, &breakp_sz);
int ii, insn;
CORE_ADDR loc;
CORE_ADDR breaks[2];
@ -831,7 +829,7 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR lim_pc, struct rs6000_framedata *fdata)
CORE_ADDR orig_pc = pc;
CORE_ADDR last_prologue_pc = pc;
CORE_ADDR li_found_pc = 0;
char buf[4];
gdb_byte buf[4];
unsigned long op;
long offset = 0;
long vr_saved_offset = 0;
@ -1429,7 +1427,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int len = 0;
int argno; /* current argument number */
int argbytes; /* current argument byte */
char tmp_buffer[50];
gdb_byte tmp_buffer[50];
int f_argno = 0; /* current floating point argno */
int wordsize = gdbarch_tdep (current_gdbarch)->wordsize;
CORE_ADDR func_addr = find_function_addr (function, NULL);
@ -1507,7 +1505,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Argument takes more than one register. */
while (argbytes < len)
{
char word[MAX_REGISTER_SIZE];
gdb_byte word[MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
memcpy (word,
((char *) value_contents (arg)) + argbytes,
@ -1528,7 +1526,7 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* Argument can fit in one register. No problem. */
int adj = TARGET_BYTE_ORDER == BFD_ENDIAN_BIG ? reg_size - len : 0;
char word[MAX_REGISTER_SIZE];
gdb_byte word[MAX_REGISTER_SIZE];
memset (word, 0, reg_size);
memcpy (word, value_contents (arg), len);
@ -1589,7 +1587,7 @@ ran_out_of_registers_for_arguments:
if (argbytes)
{
write_memory (sp + 24 + (ii * 4),
((char *) value_contents (arg)) + argbytes,
value_contents (arg) + argbytes,
len - argbytes);
++argno;
ii += ((len - argbytes + 3) & -4) / 4;
@ -1617,9 +1615,7 @@ ran_out_of_registers_for_arguments:
++f_argno;
}
write_memory (sp + 24 + (ii * 4),
(char *) value_contents (arg),
len);
write_memory (sp + 24 + (ii * 4), value_contents (arg), len);
ii += ((len + 3) & -4) / 4;
}
}
@ -1665,8 +1661,8 @@ rs6000_use_struct_convention (int gcc_p, struct type *value_type)
}
static void
rs6000_extract_return_value (struct type *valtype, bfd_byte *regbuf,
bfd_byte *valbuf)
rs6000_extract_return_value (struct type *valtype, gdb_byte *regbuf,
gdb_byte *valbuf)
{
int offset = 0;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
@ -1933,10 +1929,10 @@ static void
rs6000_register_to_value (struct frame_info *frame,
int regnum,
struct type *type,
void *to)
gdb_byte *to)
{
const struct reg *reg = gdbarch_tdep (current_gdbarch)->regs + regnum;
char from[MAX_REGISTER_SIZE];
gdb_byte from[MAX_REGISTER_SIZE];
gdb_assert (reg->fpr);
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
@ -1949,10 +1945,10 @@ static void
rs6000_value_to_register (struct frame_info *frame,
int regnum,
struct type *type,
const void *from)
const gdb_byte *from)
{
const struct reg *reg = gdbarch_tdep (current_gdbarch)->regs + regnum;
char to[MAX_REGISTER_SIZE];
gdb_byte to[MAX_REGISTER_SIZE];
gdb_assert (reg->fpr);
gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
@ -1986,14 +1982,14 @@ rs6000_value_to_register (struct frame_info *frame,
co-variant type qualifiers, ... */
static void
e500_move_ev_register (void (*move) (struct regcache *regcache,
int regnum, void *buf),
int regnum, gdb_byte *buf),
struct regcache *regcache, int ev_reg,
void *buffer)
gdb_byte *buffer)
{
struct gdbarch *arch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
int reg_index;
char *byte_buffer = buffer;
gdb_byte *byte_buffer = buffer;
gdb_assert (tdep->ppc_ev0_regnum <= ev_reg
&& ev_reg < tdep->ppc_ev0_regnum + ppc_num_gprs);
@ -2014,7 +2010,7 @@ e500_move_ev_register (void (*move) (struct regcache *regcache,
static void
e500_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, void *buffer)
int reg_nr, gdb_byte *buffer)
{
struct gdbarch *regcache_arch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@ -2033,7 +2029,7 @@ e500_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
static void
e500_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, const void *buffer)
int reg_nr, const gdb_byte *buffer)
{
struct gdbarch *regcache_arch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@ -2042,9 +2038,9 @@ e500_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
if (tdep->ppc_ev0_regnum <= reg_nr
&& reg_nr < tdep->ppc_ev0_regnum + ppc_num_gprs)
e500_move_ev_register ((void (*) (struct regcache *, int, void *))
e500_move_ev_register ((void (*) (struct regcache *, int, gdb_byte *))
regcache_raw_write,
regcache, reg_nr, (void *) buffer);
regcache, reg_nr, (gdb_byte *) buffer);
else
internal_error (__FILE__, __LINE__,
_("e500_pseudo_register_read: "
@ -2161,7 +2157,7 @@ rs6000_dwarf2_reg_to_regnum (int num)
static void
rs6000_store_return_value (struct type *type,
struct regcache *regcache,
const void *valbuf)
const gdb_byte *valbuf)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
@ -2201,7 +2197,7 @@ rs6000_store_return_value (struct type *type,
register_size (gdbarch, regnum));
regcache_cooked_write_part (regcache, regnum,
0, bytes_to_write,
(char *) valbuf + bytes_written);
valbuf + bytes_written);
regnum++;
bytes_written += bytes_to_write;
}
@ -3001,7 +2997,7 @@ rs6000_frame_prev_register (struct frame_info *next_frame,
void **this_cache,
int regnum, int *optimizedp,
enum lval_type *lvalp, CORE_ADDR *addrp,
int *realnump, void *valuep)
int *realnump, gdb_byte *valuep)
{
struct rs6000_frame_cache *info = rs6000_frame_cache (next_frame,
this_cache);