2003-03-12 Andrew Cagney <cagney@redhat.com>

* frame.c (get_saved_register): Delete function.
	* xstormy16-tdep.c: Update comment.
	* regcache.h: Update comments.
	* sparc-tdep.c (sparc_init_extra_frame_info): Instead of
	get_saved_register and extract_address, use
	frame_read_unsigned_register.
	(sparc_frame_saved_pc): Ditto.
	(sparc_get_saved_register): Instead of get_saved_register, use
	frame_register.
	(sparc_pop_frame): Ditto.
	* frame.h (get_saved_register): Delete declaration.
	* findvar.c: Update comments.
	(value_of_register): Call frame_register instead of
	get_saved_register.
	(value_from_register): Ditto.
	* config/sparc/tm-sparc.h: Update comment.
	* breakpoint.c: Update comment.

Index: doc/ChangeLog
2003-03-12  Andrew Cagney  <cagney@redhat.com>

	* gdbint.texinfo (Target Architecture Definition): Delete
	references to get_saved_register.
This commit is contained in:
Andrew Cagney
2003-03-14 17:07:01 +00:00
parent 129c1cd6c2
commit ac2adee56d
15 changed files with 103 additions and 90 deletions

View File

@ -1,3 +1,23 @@
2003-03-14 Andrew Cagney <cagney@redhat.com>
* frame.c (get_saved_register): Delete function.
* frame.h (get_saved_register): Delete declaration.
* xstormy16-tdep.c: Update comment.
* regcache.h: Update comments.
* sparc-tdep.c (sparc_init_extra_frame_info): Instead of
get_saved_register and extract_address, use
frame_read_unsigned_register.
(sparc_frame_saved_pc): Ditto.
(sparc_get_saved_register): Instead of get_saved_register, use
frame_register.
(sparc_pop_frame): Ditto.
* findvar.c: Update comments.
(value_of_register): Call frame_register instead of
get_saved_register.
(value_from_register): Ditto.
* config/sparc/tm-sparc.h: Update comment.
* breakpoint.c: Update comment.
2003-03-14 Andrew Cagney <cagney@redhat.com> 2003-03-14 Andrew Cagney <cagney@redhat.com>
* gdbarch.sh (DEPRECATED_GET_SAVED_REGISTER): Replace * gdbarch.sh (DEPRECATED_GET_SAVED_REGISTER): Replace

View File

@ -1679,7 +1679,7 @@ breakpoint_inserted_here_p (CORE_ADDR pc)
/* Return nonzero if FRAME is a dummy frame. We can't use /* Return nonzero if FRAME is a dummy frame. We can't use
DEPRECATED_PC_IN_CALL_DUMMY because figuring out the saved SP would DEPRECATED_PC_IN_CALL_DUMMY because figuring out the saved SP would
take too much time, at least using get_saved_register on the 68k. take too much time, at least using frame_register() on the 68k.
This means that for this function to work right a port must use the This means that for this function to work right a port must use the
bp_call_dummy breakpoint. */ bp_call_dummy breakpoint. */

View File

@ -199,10 +199,10 @@ extern int sparc_intreg_size (void);
stack rather than with the other registers, and this causes hair stack rather than with the other registers, and this causes hair
and confusion in places like pop_frame. It might be better to and confusion in places like pop_frame. It might be better to
remove the ins and locals from `registers', make sure that remove the ins and locals from `registers', make sure that
get_saved_register can get them from the stack (even in the frame_register() can get them from the stack (even in the innermost
innermost frame), and make this the way to access them. For the frame), and make this the way to access them. For the frame
frame pointer we would do that via TARGET_READ_FP. On the other pointer we would do that via TARGET_READ_FP. On the other hand,
hand, that is likely to be confusing or worse for flat frames. */ that is likely to be confusing or worse for flat frames. */
#define REGISTER_BYTES (32*4+32*4+8*4) #define REGISTER_BYTES (32*4+32*4+8*4)

View File

@ -1,3 +1,9 @@
2003-03-12 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Delete
references to get_saved_register. Rename GET_SAVED_REGISTER to
DEPRECATED_GET_SAVED_REGISTER.
2003-03-13 Andrew Cagney <cagney@redhat.com> 2003-03-13 Andrew Cagney <cagney@redhat.com>
* gdbint.texinfo (Target Architecture Definition): Replace * gdbint.texinfo (Target Architecture Definition): Replace

View File

@ -3352,11 +3352,10 @@ assuming that we have just stopped at a @code{longjmp} breakpoint. It takes a
@code{CORE_ADDR *} as argument, and stores the target PC value through this @code{CORE_ADDR *} as argument, and stores the target PC value through this
pointer. It examines the current state of the machine as needed. pointer. It examines the current state of the machine as needed.
@item GET_SAVED_REGISTER @item DEPRECATED_GET_SAVED_REGISTER
@findex GET_SAVED_REGISTER @findex DEPRECATED_GET_SAVED_REGISTER
@findex get_saved_register
Define this if you need to supply your own definition for the function Define this if you need to supply your own definition for the function
@code{get_saved_register}. @code{DEPRECATED_GET_SAVED_REGISTER}.
@item IBM6000_TARGET @item IBM6000_TARGET
@findex IBM6000_TARGET @findex IBM6000_TARGET

View File

@ -299,6 +299,7 @@ value_of_register (int regnum, struct frame_info *frame)
CORE_ADDR addr; CORE_ADDR addr;
int optim; int optim;
struct value *reg_val; struct value *reg_val;
int realnum;
char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE);
enum lval_type lval; enum lval_type lval;
@ -307,8 +308,7 @@ value_of_register (int regnum, struct frame_info *frame)
if (regnum >= NUM_REGS + NUM_PSEUDO_REGS) if (regnum >= NUM_REGS + NUM_PSEUDO_REGS)
return value_of_builtin_reg (regnum, frame); return value_of_builtin_reg (regnum, frame);
get_saved_register (raw_buffer, &optim, &addr, frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer);
frame, regnum, &lval);
/* FIXME: cagney/2002-05-15: This test is just bogus. /* FIXME: cagney/2002-05-15: This test is just bogus.
@ -780,12 +780,9 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
(value_bytes_copied += REGISTER_RAW_SIZE (local_regnum), (value_bytes_copied += REGISTER_RAW_SIZE (local_regnum),
++local_regnum)) ++local_regnum))
{ {
get_saved_register (value_bytes + value_bytes_copied, int realnum;
&optim, frame_register (frame, local_regnum, &optim, &lval, &addr,
&addr, &realnum, value_bytes + value_bytes_copied);
frame,
local_regnum,
&lval);
if (register_cached (local_regnum) == -1) if (register_cached (local_regnum) == -1)
return NULL; /* register value not available */ return NULL; /* register value not available */
@ -851,7 +848,10 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame)
register's contents in a real register or in core; register's contents in a real register or in core;
read the data in raw format. */ read the data in raw format. */
get_saved_register (raw_buffer, &optim, &addr, frame, regnum, &lval); {
int realnum;
frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer);
}
if (register_cached (regnum) == -1) if (register_cached (regnum) == -1)
return NULL; /* register value not available */ return NULL; /* register value not available */

View File

@ -399,24 +399,6 @@ generic_unwind_get_saved_register (char *raw_buffer,
&realnumx, raw_buffer); &realnumx, raw_buffer);
} }
void
get_saved_register (char *raw_buffer,
int *optimized,
CORE_ADDR *addrp,
struct frame_info *frame,
int regnum,
enum lval_type *lval)
{
if (DEPRECATED_GET_SAVED_REGISTER_P ())
{
DEPRECATED_GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame,
regnum, lval);
return;
}
generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame,
regnum, lval);
}
/* frame_register_read () /* frame_register_read ()
Find and return the value of REGNUM for the specified stack frame. Find and return the value of REGNUM for the specified stack frame.
@ -810,9 +792,10 @@ const struct frame_unwind trad_frame_unwinder = {
const struct frame_unwind *trad_frame_unwind = &trad_frame_unwinder; const struct frame_unwind *trad_frame_unwind = &trad_frame_unwinder;
/* Function: get_saved_register /* Function: deprecated_generic_get_saved_register
Find register number REGNUM relative to FRAME and put its (raw, Find register number REGNUM relative to FRAME and put its (raw,
target format) contents in *RAW_BUFFER. target format) contents in *RAW_BUFFER.
Set *OPTIMIZED if the variable was optimized out (and thus can't be Set *OPTIMIZED if the variable was optimized out (and thus can't be
fetched). Note that this is never set to anything other than zero fetched). Note that this is never set to anything other than zero
@ -828,10 +811,6 @@ const struct frame_unwind *trad_frame_unwind = &trad_frame_unwinder;
offset into the registers array. If the value is stored in a dummy offset into the registers array. If the value is stored in a dummy
frame, set *ADDRP to zero. frame, set *ADDRP to zero.
To use this implementation, define a function called
"get_saved_register" in your target code, which simply passes all
of its arguments to this function.
The argument RAW_BUFFER must point to aligned memory. */ The argument RAW_BUFFER must point to aligned memory. */
void void

View File

@ -538,7 +538,7 @@ extern int generic_pc_in_call_dummy (CORE_ADDR pc,
/* NOTE: cagney/2002-06-26: Targets should no longer use this /* NOTE: cagney/2002-06-26: Targets should no longer use this
function. Instead, the contents of a dummy frames registers can be function. Instead, the contents of a dummy frames registers can be
obtained by applying: frame_register_unwind to the dummy frame; or obtained by applying: frame_register_unwind to the dummy frame; or
get_saved_register to the next outer frame. */ frame_register_unwind() to the next outer frame. */
extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp); extern char *deprecated_generic_find_dummy_frame (CORE_ADDR pc, CORE_ADDR fp);
@ -565,11 +565,6 @@ extern void deprecated_generic_get_saved_register (char *, int *, CORE_ADDR *,
extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi); extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi);
extern void get_saved_register (char *raw_buffer, int *optimized,
CORE_ADDR * addrp,
struct frame_info *frame,
int regnum, enum lval_type *lval);
/* FIXME: cagney/2003-02-02: Should be deprecated or replaced with a /* FIXME: cagney/2003-02-02: Should be deprecated or replaced with a
function called frame_read_register_p(). This slightly weird (and function called frame_read_register_p(). This slightly weird (and
older) variant of frame_read_register() returns zero (indicating older) variant of frame_read_register() returns zero (indicating

View File

@ -1,3 +1,8 @@
2003-03-12 Andrew Cagney <cagney@redhat.com>
* mi-main.c (get_register): Use frame_register instead of
get_saved_register.
2003-03-08 Andrew Cagney <cagney@redhat.com> 2003-03-08 Andrew Cagney <cagney@redhat.com>
* mi-out.c: Update copyright. * mi-out.c: Update copyright.

View File

@ -514,6 +514,9 @@ get_register (int regnum, int format)
char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
int optim; int optim;
int realnum;
CORE_ADDR addr;
enum lval_type lval;
static struct ui_stream *stb = NULL; static struct ui_stream *stb = NULL;
stb = ui_out_stream_new (uiout); stb = ui_out_stream_new (uiout);
@ -521,9 +524,9 @@ get_register (int regnum, int format)
if (format == 'N') if (format == 'N')
format = 0; format = 0;
get_saved_register (raw_buffer, &optim, (CORE_ADDR *) NULL, frame_register (deprecated_selected_frame, regnum, &optim, &lval, &addr,
deprecated_selected_frame, &realnum, raw_buffer);
regnum, (enum lval_type *) NULL);
if (optim) if (optim)
{ {
xasprintf (&mi_error_message, "Optimized out"); xasprintf (&mi_error_message, "Optimized out");

View File

@ -98,7 +98,7 @@ extern void regcache_collect (int regnum, void *buf);
/* The register's ``offset''. /* The register's ``offset''.
FIXME: cagney/2002-11-07: The get_saved_register() function, when FIXME: cagney/2002-11-07: The frame_register() function, when
specifying the real location of a register, does so using that specifying the real location of a register, does so using that
registers offset in the register cache. That offset is then used registers offset in the register cache. That offset is then used
by valops.c to determine the location of the register. The code by valops.c to determine the location of the register. The code

View File

@ -326,9 +326,9 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi)
else else
{ {
/* Should we adjust for stack bias here? */ /* Should we adjust for stack bias here? */
get_saved_register (buf, 0, 0, fi, FP_REGNUM, 0); ULONGEST tmp;
deprecated_update_frame_base_hack (fi, extract_address (buf, REGISTER_RAW_SIZE (FP_REGNUM))); frame_read_unsigned_register (fi, FP_REGNUM, &tmp);
deprecated_update_frame_base_hack (fi, tmp);
if (GDB_TARGET_IS_SPARC64 && (get_frame_base (fi) & 1)) if (GDB_TARGET_IS_SPARC64 && (get_frame_base (fi) & 1))
deprecated_update_frame_base_hack (fi, get_frame_base (fi) + 2047); deprecated_update_frame_base_hack (fi, get_frame_base (fi) + 2047);
} }
@ -367,8 +367,11 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi)
get_frame_extra_info (fi)->sp_offset = offset; get_frame_extra_info (fi)->sp_offset = offset;
/* Overwrite the frame's address with the value in %i7. */ /* Overwrite the frame's address with the value in %i7. */
get_saved_register (buf, 0, 0, fi, I7_REGNUM, 0); {
deprecated_update_frame_base_hack (fi, extract_address (buf, REGISTER_RAW_SIZE (I7_REGNUM))); ULONGEST tmp;
frame_read_unsigned_register (fi, I7_REGNUM, &tmp);
deprecated_update_frame_base_hack (fi, tmp);
}
if (GDB_TARGET_IS_SPARC64 && (get_frame_base (fi) & 1)) if (GDB_TARGET_IS_SPARC64 && (get_frame_base (fi) & 1))
deprecated_update_frame_base_hack (fi, get_frame_base (fi) + 2047); deprecated_update_frame_base_hack (fi, get_frame_base (fi) + 2047);
@ -487,9 +490,11 @@ sparc_frame_saved_pc (struct frame_info *frame)
saved_pc_offset = 12; saved_pc_offset = 12;
/* The sigcontext address is contained in register O2. */ /* The sigcontext address is contained in register O2. */
get_saved_register (buf, (int *) NULL, (CORE_ADDR *) NULL, {
frame, O0_REGNUM + 2, (enum lval_type *) NULL); ULONGEST tmp;
sigcontext_addr = extract_address (buf, REGISTER_RAW_SIZE (O0_REGNUM + 2)); frame_read_unsigned_register (frame, O0_REGNUM + 2, &tmp);
sigcontext_addr = tmp;
}
/* Don't cause a memory_error when accessing sigcontext in case the /* Don't cause a memory_error when accessing sigcontext in case the
stack layout has changed or the stack is corrupt. */ stack layout has changed or the stack is corrupt. */
@ -505,9 +510,9 @@ sparc_frame_saved_pc (struct frame_info *frame)
{ {
/* A frameless function interrupted by a signal did not save /* A frameless function interrupted by a signal did not save
the PC, it is still in %o7. */ the PC, it is still in %o7. */
get_saved_register (buf, (int *) NULL, (CORE_ADDR *) NULL, ULONGEST tmp;
frame, O7_REGNUM, (enum lval_type *) NULL); frame_read_unsigned_register (frame, O7_REGNUM, &tmp);
return PC_ADJUST (extract_address (buf, SPARC_INTREG_SIZE)); return PC_ADJUST (tmp);
} }
if (get_frame_extra_info (frame)->flat) if (get_frame_extra_info (frame)->flat)
addr = get_frame_extra_info (frame)->pc_addr; addr = get_frame_extra_info (frame)->pc_addr;
@ -936,8 +941,9 @@ sparc_get_saved_register (char *raw_buffer, int *optimized, CORE_ADDR *addrp,
else if (regnum >= O0_REGNUM && regnum < O0_REGNUM + 8) else if (regnum >= O0_REGNUM && regnum < O0_REGNUM + 8)
{ {
/* Outs become ins. */ /* Outs become ins. */
get_saved_register (raw_buffer, optimized, addrp, frame1, int realnum;
(regnum - O0_REGNUM + I0_REGNUM), lval); frame_register (frame1, (regnum - O0_REGNUM + I0_REGNUM),
optimized, lval, addrp, &realnum, raw_buffer);
return; return;
} }
} }
@ -1090,10 +1096,10 @@ sparc_push_dummy_frame (void)
I think few ports of GDB get right--if you are popping a frame I think few ports of GDB get right--if you are popping a frame
which does not save some register that *is* saved by a more inner which does not save some register that *is* saved by a more inner
frame (such a frame will never be a dummy frame because dummy frame (such a frame will never be a dummy frame because dummy
frames save all registers). Rewriting pop_frame to use frames save all registers).
get_saved_register would solve this problem and also get rid of the
ugly duplication between sparc_frame_find_saved_regs and NOTE: cagney/2003-03-12: Since pop_frame has been rewritten to use
get_saved_register. frame_unwind_register() the need for this function is questionable.
Stores, into an array of CORE_ADDR, Stores, into an array of CORE_ADDR,
the addresses of the saved registers of frame described by FRAME_INFO. the addresses of the saved registers of frame described by FRAME_INFO.
@ -1369,12 +1375,9 @@ sparc_pop_frame (void)
/* I think this happens only in the innermost frame, if so then /* I think this happens only in the innermost frame, if so then
it is a complicated way of saying it is a complicated way of saying
"pc = read_register (O7_REGNUM);". */ "pc = read_register (O7_REGNUM);". */
char *buf; ULONGEST tmp;
frame_read_unsigned_register (frame, O7_REGNUM, &tmp);
buf = alloca (MAX_REGISTER_RAW_SIZE); pc = PC_ADJUST (tmp);
get_saved_register (buf, 0, 0, frame, O7_REGNUM, 0);
pc = PC_ADJUST (extract_address
(buf, REGISTER_RAW_SIZE (O7_REGNUM)));
} }
write_register (PC_REGNUM, pc); write_register (PC_REGNUM, pc);

View File

@ -1,3 +1,8 @@
2003-03-14 Andrew Cagney <cagney@redhat.com>
* tuiRegs.c (_tuiGetRegisterRawValue): Use frame_read_register,
instead of get_saved_register.
2003-03-13 Stephane Carrez <stcarrez@nerim.fr> 2003-03-13 Stephane Carrez <stcarrez@nerim.fr>
* tui-out.c (tui_out_data): Fix typedef. * tui-out.c (tui_out_data): Fix typedef.

View File

@ -799,10 +799,10 @@ _tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame)
if (target_has_registers) if (target_has_registers)
{ {
int opt; frame_read_register (frame, regNum, regValue);
/* NOTE: cagney/2003-03-13: This is bogus. It is refering to
get_saved_register (regValue, &opt, (CORE_ADDR*) NULL, frame, the register cache and not the frame which could have pulled
regNum, (enum lval_type*) NULL); the register value off the stack. */
if (register_cached (regNum) >= 0) if (register_cached (regNum) >= 0)
ret = TUI_SUCCESS; ret = TUI_SUCCESS;
} }

View File

@ -723,11 +723,10 @@ xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc)
actual value of the previous frame's stack register. actual value of the previous frame's stack register.
This function may be called in any context where the saved register This function may be called in any context where the saved register
values may be needed (backtrace, frame_info, get_saved_register). values may be needed (backtrace, frame_info, frame_register). On
On many targets, it is called directly by init_extra_frame_info, many targets, it is called directly by init_extra_frame_info, in
in part because the information may be needed immediately by part because the information may be needed immediately by
frame_chain. frame_chain. */
*/
static void static void
xstormy16_frame_init_saved_regs (struct frame_info *fi) xstormy16_frame_init_saved_regs (struct frame_info *fi)
@ -841,12 +840,11 @@ xstormy16_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
get_frame_base (thisframe) - get_frame_extra_info (thisframe)->framesize == chain); get_frame_base (thisframe) - get_frame_extra_info (thisframe)->framesize == chain);
} }
/* Function: xstormy16_saved_pc_after_call /* Function: xstormy16_saved_pc_after_call Returns the previous PC
Returns the previous PC immediately after a function call. immediately after a function call. This function is meant to
This function is meant to bypass the regular get_saved_register bypass the regular frame_register() mechanism, ie. it is meant to
mechanism, ie. it is meant to work even if the frame isn't complete. work even if the frame isn't complete. Called by
Called by step_over_function, and sometimes by get_prev_frame. step_over_function, and sometimes by get_prev_frame. */
*/
static CORE_ADDR static CORE_ADDR
xstormy16_saved_pc_after_call (struct frame_info *ignore) xstormy16_saved_pc_after_call (struct frame_info *ignore)