diff options
-rw-r--r-- | gdb/ChangeLog | 20 | ||||
-rw-r--r-- | gdb/breakpoint.c | 2 | ||||
-rw-r--r-- | gdb/config/sparc/tm-sparc.h | 8 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/doc/gdbint.texinfo | 7 | ||||
-rw-r--r-- | gdb/findvar.c | 18 | ||||
-rw-r--r-- | gdb/frame.c | 27 | ||||
-rw-r--r-- | gdb/frame.h | 7 | ||||
-rw-r--r-- | gdb/mi/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 9 | ||||
-rw-r--r-- | gdb/regcache.h | 2 | ||||
-rw-r--r-- | gdb/sparc-tdep.c | 49 | ||||
-rw-r--r-- | gdb/tui/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/tui/tuiRegs.c | 8 | ||||
-rw-r--r-- | gdb/xstormy16-tdep.c | 20 |
15 files changed, 103 insertions, 90 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e89554e..bd123a1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,25 @@ 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> + * gdbarch.sh (DEPRECATED_GET_SAVED_REGISTER): Replace GET_SAVED_REGISTER. * gdbarch.h, gdbarch.c: Re-generate. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 1ff80d7..491766d 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1679,7 +1679,7 @@ breakpoint_inserted_here_p (CORE_ADDR pc) /* Return nonzero if FRAME is a dummy frame. We can't use 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 bp_call_dummy breakpoint. */ diff --git a/gdb/config/sparc/tm-sparc.h b/gdb/config/sparc/tm-sparc.h index 5268713..8ab7401 100644 --- a/gdb/config/sparc/tm-sparc.h +++ b/gdb/config/sparc/tm-sparc.h @@ -199,10 +199,10 @@ extern int sparc_intreg_size (void); stack rather than with the other registers, and this causes hair and confusion in places like pop_frame. It might be better to remove the ins and locals from `registers', make sure that - get_saved_register can get them from the stack (even in the - innermost frame), and make this the way to access them. For the - frame pointer we would do that via TARGET_READ_FP. On the other - hand, that is likely to be confusing or worse for flat frames. */ + frame_register() can get them from the stack (even in the innermost + frame), and make this the way to access them. For the frame + pointer we would do that via TARGET_READ_FP. On the other hand, + that is likely to be confusing or worse for flat frames. */ #define REGISTER_BYTES (32*4+32*4+8*4) diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index f14dadb..982322d 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -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> * gdbint.texinfo (Target Architecture Definition): Replace diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 4dd1add..186d9e7 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -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 pointer. It examines the current state of the machine as needed. -@item GET_SAVED_REGISTER -@findex GET_SAVED_REGISTER -@findex get_saved_register +@item DEPRECATED_GET_SAVED_REGISTER +@findex DEPRECATED_GET_SAVED_REGISTER 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 @findex IBM6000_TARGET diff --git a/gdb/findvar.c b/gdb/findvar.c index 38d01cd..93c4d8a 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -299,6 +299,7 @@ value_of_register (int regnum, struct frame_info *frame) CORE_ADDR addr; int optim; struct value *reg_val; + int realnum; char *raw_buffer = (char*) alloca (MAX_REGISTER_RAW_SIZE); enum lval_type lval; @@ -307,8 +308,7 @@ value_of_register (int regnum, struct frame_info *frame) if (regnum >= NUM_REGS + NUM_PSEUDO_REGS) return value_of_builtin_reg (regnum, frame); - get_saved_register (raw_buffer, &optim, &addr, - frame, regnum, &lval); + frame_register (frame, regnum, &optim, &lval, &addr, &realnum, raw_buffer); /* 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), ++local_regnum)) { - get_saved_register (value_bytes + value_bytes_copied, - &optim, - &addr, - frame, - local_regnum, - &lval); + int realnum; + frame_register (frame, local_regnum, &optim, &lval, &addr, + &realnum, value_bytes + value_bytes_copied); if (register_cached (local_regnum) == -1) 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; 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) return NULL; /* register value not available */ diff --git a/gdb/frame.c b/gdb/frame.c index 5f67d4d..26e80be 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -399,24 +399,6 @@ generic_unwind_get_saved_register (char *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 () 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; -/* Function: get_saved_register +/* Function: deprecated_generic_get_saved_register + 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 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 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. */ void diff --git a/gdb/frame.h b/gdb/frame.h index 01ee289..c4905dd 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -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 function. Instead, the contents of a dummy frames registers can be 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); @@ -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 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 function called frame_read_register_p(). This slightly weird (and older) variant of frame_read_register() returns zero (indicating diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 7290ef9..1785b9b 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -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> * mi-out.c: Update copyright. diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index f08bd3f..6ba0698 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -514,6 +514,9 @@ get_register (int regnum, int format) char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE); char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE); int optim; + int realnum; + CORE_ADDR addr; + enum lval_type lval; static struct ui_stream *stb = NULL; stb = ui_out_stream_new (uiout); @@ -521,9 +524,9 @@ get_register (int regnum, int format) if (format == 'N') format = 0; - get_saved_register (raw_buffer, &optim, (CORE_ADDR *) NULL, - deprecated_selected_frame, - regnum, (enum lval_type *) NULL); + frame_register (deprecated_selected_frame, regnum, &optim, &lval, &addr, + &realnum, raw_buffer); + if (optim) { xasprintf (&mi_error_message, "Optimized out"); diff --git a/gdb/regcache.h b/gdb/regcache.h index bc9757e..3fb43c4 100644 --- a/gdb/regcache.h +++ b/gdb/regcache.h @@ -98,7 +98,7 @@ extern void regcache_collect (int regnum, void *buf); /* 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 registers offset in the register cache. That offset is then used by valops.c to determine the location of the register. The code diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 755c9a1..6e1b211 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -326,9 +326,9 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) else { /* Should we adjust for stack bias here? */ - get_saved_register (buf, 0, 0, fi, FP_REGNUM, 0); - deprecated_update_frame_base_hack (fi, extract_address (buf, REGISTER_RAW_SIZE (FP_REGNUM))); - + ULONGEST tmp; + 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)) 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; /* 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)) 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; /* 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); - sigcontext_addr = extract_address (buf, REGISTER_RAW_SIZE (O0_REGNUM + 2)); + { + ULONGEST tmp; + frame_read_unsigned_register (frame, O0_REGNUM + 2, &tmp); + sigcontext_addr = tmp; + } /* Don't cause a memory_error when accessing sigcontext in case the 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 the PC, it is still in %o7. */ - get_saved_register (buf, (int *) NULL, (CORE_ADDR *) NULL, - frame, O7_REGNUM, (enum lval_type *) NULL); - return PC_ADJUST (extract_address (buf, SPARC_INTREG_SIZE)); + ULONGEST tmp; + frame_read_unsigned_register (frame, O7_REGNUM, &tmp); + return PC_ADJUST (tmp); } if (get_frame_extra_info (frame)->flat) 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) { /* Outs become ins. */ - get_saved_register (raw_buffer, optimized, addrp, frame1, - (regnum - O0_REGNUM + I0_REGNUM), lval); + int realnum; + frame_register (frame1, (regnum - O0_REGNUM + I0_REGNUM), + optimized, lval, addrp, &realnum, raw_buffer); return; } } @@ -1090,10 +1096,10 @@ sparc_push_dummy_frame (void) 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 frame (such a frame will never be a dummy frame because dummy - frames save all registers). Rewriting pop_frame to use - get_saved_register would solve this problem and also get rid of the - ugly duplication between sparc_frame_find_saved_regs and - get_saved_register. + frames save all registers). + + NOTE: cagney/2003-03-12: Since pop_frame has been rewritten to use + frame_unwind_register() the need for this function is questionable. Stores, into an array of CORE_ADDR, 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 it is a complicated way of saying "pc = read_register (O7_REGNUM);". */ - char *buf; - - buf = alloca (MAX_REGISTER_RAW_SIZE); - get_saved_register (buf, 0, 0, frame, O7_REGNUM, 0); - pc = PC_ADJUST (extract_address - (buf, REGISTER_RAW_SIZE (O7_REGNUM))); + ULONGEST tmp; + frame_read_unsigned_register (frame, O7_REGNUM, &tmp); + pc = PC_ADJUST (tmp); } write_register (PC_REGNUM, pc); diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 04b7e80..7069f96 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -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> * tui-out.c (tui_out_data): Fix typedef. diff --git a/gdb/tui/tuiRegs.c b/gdb/tui/tuiRegs.c index 6fc63d9..6920d80 100644 --- a/gdb/tui/tuiRegs.c +++ b/gdb/tui/tuiRegs.c @@ -799,10 +799,10 @@ _tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame) if (target_has_registers) { - int opt; - - get_saved_register (regValue, &opt, (CORE_ADDR*) NULL, frame, - regNum, (enum lval_type*) NULL); + frame_read_register (frame, regNum, regValue); + /* NOTE: cagney/2003-03-13: This is bogus. It is refering to + the register cache and not the frame which could have pulled + the register value off the stack. */ if (register_cached (regNum) >= 0) ret = TUI_SUCCESS; } diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 600f535..2ccbb1e 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -723,11 +723,10 @@ xstormy16_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR pc) actual value of the previous frame's stack register. This function may be called in any context where the saved register - values may be needed (backtrace, frame_info, get_saved_register). - On many targets, it is called directly by init_extra_frame_info, - in part because the information may be needed immediately by - frame_chain. -*/ + values may be needed (backtrace, frame_info, frame_register). On + many targets, it is called directly by init_extra_frame_info, in + part because the information may be needed immediately by + frame_chain. */ static void 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); } -/* Function: xstormy16_saved_pc_after_call - Returns the previous PC immediately after a function call. - This function is meant to bypass the regular get_saved_register - mechanism, ie. it is meant to work even if the frame isn't complete. - Called by step_over_function, and sometimes by get_prev_frame. -*/ +/* Function: xstormy16_saved_pc_after_call Returns the previous PC + immediately after a function call. This function is meant to + bypass the regular frame_register() mechanism, ie. it is meant to + work even if the frame isn't complete. Called by + step_over_function, and sometimes by get_prev_frame. */ static CORE_ADDR xstormy16_saved_pc_after_call (struct frame_info *ignore) |