From 7f5f525dc281b83409f2251c6caa0cc19e6fedfe Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 28 Sep 2003 22:32:20 +0000 Subject: [PATCH] 2003-09-28 Andrew Cagney * frame.c (frame_read_unsigned_register): Delete function. * frame.h (frame_read_unsigned_register): Delete declaration. * sparc-tdep.c (sparc_init_extra_frame_info): Use get_frame_register_unsigned. (sparc_frame_saved_pc, sparc_pop_frame): Ditto. * m68hc11-tdep.c (m68hc11_print_register): Ditto. * d10v-tdep.c (d10v_print_registers_info): Ditto. * frame.h (frame_read_register): Delete declaration. * frame.c (frame_read_register): Delete function. * arch-utils.c (legacy_register_to_value): Use get_frame_register. * sparc-tdep.c (sparc_fetch_pointer_argument): Ditto. * rs6000-tdep.c (rs6000_fetch_pointer_argument): Ditto. * mips-tdep.c (mips_register_to_value): Ditto. * hppa-tdep.c (hppa_fetch_pointer_argument): Ditto. * d10v-tdep.c (d10v_print_registers_info): Ditto. * frame.c (frame_read_signed_register): Delete function. (frame_read_unsigned_register): Update comments. * frame.h (frame_read_signed_register): Delete declaration. * h8300-tdep.c (h8300_print_register): Use get_frame_register_signed. * m68hc11-tdep.c (m68hc11_print_register): Ditto. --- gdb/ChangeLog | 24 ++++++++++++++++++++++++ gdb/arch-utils.c | 2 +- gdb/d10v-tdep.c | 14 +++++++------- gdb/frame.c | 41 ----------------------------------------- gdb/frame.h | 26 +++++--------------------- gdb/h8300-tdep.c | 2 +- gdb/hppa-tdep.c | 2 +- gdb/m68hc11-tdep.c | 6 +++--- gdb/mips-tdep.c | 4 ++-- gdb/rs6000-tdep.c | 2 +- gdb/sparc-tdep.c | 12 ++++++------ gdb/tui/tuiRegs.c | 2 +- 12 files changed, 52 insertions(+), 85 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 45ada991c3..e20eab28c1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,29 @@ 2003-09-28 Andrew Cagney + * frame.c (frame_read_unsigned_register): Delete function. + * frame.h (frame_read_unsigned_register): Delete declaration. + * sparc-tdep.c (sparc_init_extra_frame_info): Use + get_frame_register_unsigned. + (sparc_frame_saved_pc, sparc_pop_frame): Ditto. + * m68hc11-tdep.c (m68hc11_print_register): Ditto. + * d10v-tdep.c (d10v_print_registers_info): Ditto. + + * frame.h (frame_read_register): Delete declaration. + * frame.c (frame_read_register): Delete function. + * arch-utils.c (legacy_register_to_value): Use get_frame_register. + * sparc-tdep.c (sparc_fetch_pointer_argument): Ditto. + * rs6000-tdep.c (rs6000_fetch_pointer_argument): Ditto. + * mips-tdep.c (mips_register_to_value): Ditto. + * hppa-tdep.c (hppa_fetch_pointer_argument): Ditto. + * d10v-tdep.c (d10v_print_registers_info): Ditto. + + * frame.c (frame_read_signed_register): Delete function. + (frame_read_unsigned_register): Update comments. + * frame.h (frame_read_signed_register): Delete declaration. + * h8300-tdep.c (h8300_print_register): Use + get_frame_register_signed. + * m68hc11-tdep.c (m68hc11_print_register): Ditto. + * config/pa/tm-hppa.h (DEPRECATED_VALUE_RETURNED_FROM_STACK): Rename VALUE_RETURNED_FROM_STACK. * infcmd.c (print_return_value): Update. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 3f0295a435..6e79c55f83 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -338,7 +338,7 @@ legacy_register_to_value (struct frame_info *frame, int regnum, struct type *type, void *to) { char from[MAX_REGISTER_SIZE]; - frame_read_register (frame, regnum, from); + get_frame_register (frame, regnum, from); DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (regnum, type, from, to); } diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index 129f56355c..0a245dc2d9 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -795,11 +795,11 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, { ULONGEST pc, psw, rpt_s, rpt_e, rpt_c; - frame_read_unsigned_register (frame, D10V_PC_REGNUM, &pc); - frame_read_unsigned_register (frame, PSW_REGNUM, &psw); - frame_read_unsigned_register (frame, frame_map_name_to_regnum (frame, "rpt_s", -1), &rpt_s); - frame_read_unsigned_register (frame, frame_map_name_to_regnum (frame, "rpt_e", -1), &rpt_e); - frame_read_unsigned_register (frame, frame_map_name_to_regnum (frame, "rpt_c", -1), &rpt_c); + pc = get_frame_register_unsigned (frame, D10V_PC_REGNUM); + psw = get_frame_register_unsigned (frame, PSW_REGNUM); + rpt_s = get_frame_register_unsigned (frame, frame_map_name_to_regnum (frame, "rpt_s", -1)); + rpt_e = get_frame_register_unsigned (frame, frame_map_name_to_regnum (frame, "rpt_e", -1)); + rpt_c = get_frame_register_unsigned (frame, frame_map_name_to_regnum (frame, "rpt_c", -1)); fprintf_filtered (file, "PC=%04lx (0x%lx) PSW=%04lx RPT_S=%04lx RPT_E=%04lx RPT_C=%04lx\n", (long) pc, (long) d10v_make_iaddr (pc), (long) psw, (long) rpt_s, (long) rpt_e, (long) rpt_c); @@ -814,7 +814,7 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, for (r = group; r < group + 8; r++) { ULONGEST tmp; - frame_read_unsigned_register (frame, r, &tmp); + tmp = get_frame_register_unsigned (frame, r); fprintf_filtered (file, " %04lx", (long) tmp); } fprintf_filtered (file, "\n"); @@ -856,7 +856,7 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file, { int i; fprintf_filtered (file, " "); - frame_read_register (frame, a, num); + get_frame_register (frame, a, num); for (i = 0; i < register_size (gdbarch, a); i++) { fprintf_filtered (file, "%02x", (num[i] & 0xff)); diff --git a/gdb/frame.c b/gdb/frame.c index 46949c0af3..b3d1c4b0aa 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -670,47 +670,6 @@ frame_unwind_unsigned_register (struct frame_info *frame, int regnum, (*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) -{ - /* NOTE: cagney/2002-10-31: There is a bit of dogma here - there is - always a frame. Both this, and the equivalent - frame_read_signed_register() function, can only be called with a - valid frame. If, for some reason, this function is called - without a frame then the problem isn't here, but rather in the - caller. It should of first created a frame and then passed that - in. */ - /* NOTE: cagney/2002-10-31: As a side bar, keep in mind that the - ``current_frame'' should not be treated as a special case. While - ``get_next_frame (current_frame) == NULL'' currently holds, it - should, as far as possible, not be relied upon. In the future, - ``get_next_frame (current_frame)'' may instead simply return a - normal frame object that simply always gets register values from - the register cache. Consequently, frame code should try to avoid - tests like ``if get_next_frame() == NULL'' and instead just rely - on recursive frame calls (like the below code) when manipulating - a frame chain. */ - gdb_assert (frame != NULL && frame->next != NULL); - frame_unwind_unsigned_register (frame->next, regnum, val); -} - -void -frame_read_signed_register (struct frame_info *frame, int regnum, - LONGEST *val) -{ - /* See note above in frame_read_unsigned_register(). */ - gdb_assert (frame != NULL && frame->next != NULL); - frame_unwind_signed_register (frame->next, regnum, val); -} - void put_frame_register (struct frame_info *frame, int regnum, const void *buf) { diff --git a/gdb/frame.h b/gdb/frame.h index 579dbdbd91..72f1496d2c 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -398,22 +398,6 @@ extern void frame_register (struct frame_info *frame, int regnum, CORE_ADDR *addrp, int *realnump, void *valuep); -/* More convenient interface to frame_register(). */ -/* NOTE: cagney/2002-09-13: Return void as one day these functions may - be changed to return an indication that the read succeeded. */ - -/* Use get_frame_register. */ -extern void frame_read_register (struct frame_info *frame, int regnum, - void *buf); - -/* Use get_frame_register_signed. */ -extern void frame_read_signed_register (struct frame_info *frame, - int regnum, LONGEST *val); - -/* Use get_frame_register_unsigned. */ -extern void frame_read_unsigned_register (struct frame_info *frame, - int regnum, ULONGEST *val); - /* The reverse. Store a register value relative to the specified frame. Note: this call makes the frame's state undefined. The register and frame caches must be flushed. */ @@ -591,11 +575,11 @@ extern void deprecated_generic_get_saved_register (char *, int *, CORE_ADDR *, extern void generic_save_call_dummy_addr (CORE_ADDR lo, CORE_ADDR hi); /* 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 + function called get_frame_register_p(). This slightly weird (and + older) variant of get_frame_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). */ diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c index e155e75ae2..69155cefdf 100644 --- a/gdb/h8300-tdep.c +++ b/gdb/h8300-tdep.c @@ -944,7 +944,7 @@ h8300_print_register (struct gdbarch *gdbarch, struct ui_file *file, if (!name || !*name) return; - frame_read_signed_register (frame, regno, &rval); + rval = get_frame_register_signed (frame, regno); fprintf_filtered (file, "%-14s ", name); if (regno == E_PSEUDO_CCR_REGNUM || (regno == E_PSEUDO_EXR_REGNUM && h8300smode)) diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 9017971c07..9caf2273e0 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -5075,7 +5075,7 @@ hppa_fetch_pointer_argument (struct frame_info *frame, int argi, struct type *type) { CORE_ADDR addr; - frame_read_register (frame, R0_REGNUM + 26 - argi, &addr); + get_frame_register (frame, R0_REGNUM + 26 - argi, &addr); return addr; } diff --git a/gdb/m68hc11-tdep.c b/gdb/m68hc11-tdep.c index 0f3ed0e5e1..ad68b6024f 100644 --- a/gdb/m68hc11-tdep.c +++ b/gdb/m68hc11-tdep.c @@ -1032,9 +1032,9 @@ m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file, if (regno == HARD_PC_REGNUM || regno == HARD_SP_REGNUM || regno == SOFT_FP_REGNUM || regno == M68HC12_HARD_PC_REGNUM) - frame_read_unsigned_register (frame, regno, &rval); + rval = get_frame_register_unsigned (frame, regno); else - frame_read_signed_register (frame, regno, &rval); + rval = get_frame_register_signed (frame, regno); if (regno == HARD_A_REGNUM || regno == HARD_B_REGNUM || regno == HARD_CCR_REGNUM || regno == HARD_PAGE_REGNUM) @@ -1049,7 +1049,7 @@ m68hc11_print_register (struct gdbarch *gdbarch, struct ui_file *file, { ULONGEST page; - frame_read_unsigned_register (frame, HARD_PAGE_REGNUM, &page); + page = get_frame_register_unsigned (frame, HARD_PAGE_REGNUM); fprintf_filtered (file, "0x%02x:%04x ", (unsigned) page, (unsigned) rval); } diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index fc38b58a24..1968b60380 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -763,8 +763,8 @@ static void mips_register_to_value (struct frame_info *frame, int regnum, struct type *type, void *to) { - frame_read_register (frame, regnum + 0, (char *) to + 4); - frame_read_register (frame, regnum + 1, (char *) to + 0); + get_frame_register (frame, regnum + 0, (char *) to + 4); + get_frame_register (frame, regnum + 1, (char *) to + 0); } static void diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index e82aced4cc..5175bd8cfd 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -237,7 +237,7 @@ rs6000_fetch_pointer_argument (struct frame_info *frame, int argi, struct type *type) { CORE_ADDR addr; - frame_read_register (frame, 3 + argi, &addr); + get_frame_register (frame, 3 + argi, &addr); return addr; } diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index f3e953580c..46b041494c 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -299,7 +299,7 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) { /* Should we adjust for stack bias here? */ ULONGEST tmp; - frame_read_unsigned_register (fi, DEPRECATED_FP_REGNUM, &tmp); + tmp = get_frame_register_unsigned (fi, DEPRECATED_FP_REGNUM); 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); @@ -339,7 +339,7 @@ sparc_init_extra_frame_info (int fromleaf, struct frame_info *fi) /* Overwrite the frame's address with the value in %i7. */ { ULONGEST tmp; - frame_read_unsigned_register (fi, I7_REGNUM, &tmp); + tmp = get_frame_register_unsigned (fi, I7_REGNUM); deprecated_update_frame_base_hack (fi, tmp); } @@ -455,7 +455,7 @@ sparc_frame_saved_pc (struct frame_info *frame) /* The sigcontext address is contained in register O2. */ { ULONGEST tmp; - frame_read_unsigned_register (frame, O0_REGNUM + 2, &tmp); + tmp = get_frame_register_unsigned (frame, O0_REGNUM + 2); sigcontext_addr = tmp; } @@ -474,7 +474,7 @@ 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. */ ULONGEST tmp; - frame_read_unsigned_register (frame, O7_REGNUM, &tmp); + tmp = get_frame_register_unsigned (frame, O7_REGNUM); return PC_ADJUST (tmp); } if (get_frame_extra_info (frame)->flat) @@ -1337,7 +1337,7 @@ sparc_pop_frame (void) it is a complicated way of saying "pc = read_register (O7_REGNUM);". */ ULONGEST tmp; - frame_read_unsigned_register (frame, O7_REGNUM, &tmp); + tmp = get_frame_register_unsigned (frame, O7_REGNUM); pc = PC_ADJUST (tmp); } @@ -3169,7 +3169,7 @@ sparc_fetch_pointer_argument (struct frame_info *frame, int argi, struct type *type) { CORE_ADDR addr; - frame_read_register (frame, O0_REGNUM + argi, &addr); + get_frame_register (frame, O0_REGNUM + argi, &addr); return addr; } diff --git a/gdb/tui/tuiRegs.c b/gdb/tui/tuiRegs.c index 9f0b1a4d84..1c8ba9a960 100644 --- a/gdb/tui/tuiRegs.c +++ b/gdb/tui/tuiRegs.c @@ -790,7 +790,7 @@ _tuiGetRegisterRawValue (int regNum, char *regValue, struct frame_info *frame) if (target_has_registers) { - frame_read_register (frame, regNum, regValue); + get_frame_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. */