2003-02-02 Andrew Cagney <ac131313@redhat.com>

* frame.c (frame_unwind_register): New function.
	(frame_unwind_unsigned_register): Use.
	(frame_unwind_signed_register): Use.
	(frame_read_register): New function.
	* frame.h (frame_unwind_register): Declare.
	(frame_read_register): Declare.

	* d10v-tdep.c (d10v_frame_pop): Rewrite. Use regcache_cooked_write
	and frame_unwind_register instead of read_memory, write_register and
	deprecated_write_register_bytes.
This commit is contained in:
Andrew Cagney 2003-02-02 20:31:43 +00:00
parent 5e0116d519
commit 5b181d6277
4 changed files with 59 additions and 25 deletions

View File

@ -1,3 +1,16 @@
2003-02-02 Andrew Cagney <ac131313@redhat.com>
* frame.c (frame_unwind_register): New function.
(frame_unwind_unsigned_register): Use.
(frame_unwind_signed_register): Use.
(frame_read_register): New function.
* frame.h (frame_unwind_register): Declare.
(frame_read_register): Declare.
* d10v-tdep.c (d10v_frame_pop): Rewrite. Use regcache_cooked_write
and frame_unwind_register instead of read_memory, write_register
and deprecated_write_register_bytes.
2003-02-02 Andrew Cagney <ac131313@redhat.com>
* frame.h: Note that namelen can be negative.

View File

@ -1552,27 +1552,24 @@ d10v_frame_pop (struct frame_info *fi, void **unwind_cache,
/* now update the current registers with the old values */
for (regnum = A0_REGNUM; regnum < A0_REGNUM + NR_A_REGS; regnum++)
{
if (info->saved_regs[regnum])
{
read_memory (info->saved_regs[regnum], raw_buffer, REGISTER_RAW_SIZE (regnum));
deprecated_write_register_bytes (REGISTER_BYTE (regnum), raw_buffer,
REGISTER_RAW_SIZE (regnum));
}
frame_unwind_register (fi, regnum, raw_buffer);
regcache_cooked_write (regcache, regnum, raw_buffer);
}
for (regnum = 0; regnum < SP_REGNUM; regnum++)
{
if (info->saved_regs[regnum])
{
write_register (regnum, read_memory_unsigned_integer (info->saved_regs[regnum], REGISTER_RAW_SIZE (regnum)));
}
}
if (info->saved_regs[PSW_REGNUM])
{
write_register (PSW_REGNUM, read_memory_unsigned_integer (info->saved_regs[PSW_REGNUM], REGISTER_RAW_SIZE (PSW_REGNUM)));
frame_unwind_register (fi, regnum, raw_buffer);
regcache_cooked_write (regcache, regnum, raw_buffer);
}
frame_unwind_register (fi, PSW_REGNUM, raw_buffer);
regcache_cooked_write (regcache, PSW_REGNUM, raw_buffer);
frame_unwind_register (fi, LR_REGNUM, raw_buffer);
regcache_cooked_write (regcache, PC_REGNUM, raw_buffer);
store_unsigned_integer (raw_buffer, REGISTER_RAW_SIZE (SP_REGNUM),
fp + info->size);
regcache_cooked_write (regcache, SP_REGNUM, raw_buffer);
write_register (PC_REGNUM, read_register (LR_REGNUM));
write_register (SP_REGNUM, fp + info->size);
target_store_registers (-1);
flush_cached_frames ();
}

View File

@ -238,16 +238,22 @@ frame_register (struct frame_info *frame, int regnum,
}
void
frame_unwind_signed_register (struct frame_info *frame, int regnum,
LONGEST *val)
frame_unwind_register (struct frame_info *frame, int regnum, void *buf)
{
int optimized;
CORE_ADDR addr;
int realnum;
enum lval_type lval;
void *buf = alloca (MAX_REGISTER_RAW_SIZE);
frame_register_unwind (frame, regnum, &optimized, &lval, &addr,
&realnum, buf);
}
void
frame_unwind_signed_register (struct frame_info *frame, int regnum,
LONGEST *val)
{
void *buf = alloca (MAX_REGISTER_RAW_SIZE);
frame_unwind_register (frame, regnum, buf);
(*val) = extract_signed_integer (buf, REGISTER_VIRTUAL_SIZE (regnum));
}
@ -255,16 +261,18 @@ void
frame_unwind_unsigned_register (struct frame_info *frame, int regnum,
ULONGEST *val)
{
int optimized;
CORE_ADDR addr;
int realnum;
enum lval_type lval;
void *buf = alloca (MAX_REGISTER_RAW_SIZE);
frame_register_unwind (frame, regnum, &optimized, &lval, &addr,
&realnum, buf);
frame_unwind_register (frame, regnum, buf);
(*val) = extract_unsigned_integer (buf, REGISTER_VIRTUAL_SIZE (regnum));
}
void
frame_read_register (struct frame_info *frame, int regnum, void *buf)
{
gdb_assert (frame != NULL && frame->next != NULL);
frame_unwind_register (frame->next, regnum, buf);
}
void
frame_read_unsigned_register (struct frame_info *frame, int regnum,
ULONGEST *val)

View File

@ -263,6 +263,9 @@ extern void frame_register_unwind (struct frame_info *frame, int regnum,
/* NOTE: cagney/2002-09-13: Return void as one day these functions may
be changed to return an indication that the read succeeded. */
extern void frame_unwind_register (struct frame_info *frame,
int regnum, void *buf);
extern void frame_unwind_signed_register (struct frame_info *frame,
int regnum, LONGEST *val);
@ -283,6 +286,9 @@ extern void frame_register (struct frame_info *frame, int regnum,
/* NOTE: cagney/2002-09-13: Return void as one day these functions may
be changed to return an indication that the read succeeded. */
extern void frame_read_register (struct frame_info *frame, int regnum,
void *buf);
extern void frame_read_signed_register (struct frame_info *frame,
int regnum, LONGEST *val);
@ -563,6 +569,16 @@ extern void get_saved_register (char *raw_buffer, int *optimized,
struct frame_info *frame,
int regnum, enum lval_type *lval);
/* FIXME: cagney/2003-02-02: Should be deprecated or replaced with a
function called frame_read_register_p(). This slightly weird (and
older) variant of frame_read_register() returns zero (indicating
the register is unavailable) if either: the register isn't cached;
or the register has been optimized out. Problem is, neither check
is exactly correct. A register can't be optimized out (it may not
have been saved as part of a function call); The fact that a
register isn't in the register cache doesn't mean that the register
isn't available (it could have been fetched from memory). */
extern int frame_register_read (struct frame_info *frame, int regnum,
void *buf);