From 8b36eed86d2784688816eb8bf25bf50b188e2c23 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 9 Dec 2002 01:40:25 +0000 Subject: [PATCH] 2002-12-08 Andrew Cagney * blockframe.c: Use get_frame_base instead of directly accessing the `struct frame_info' member frame. * f-valprint.c, std-regs.c, rs6000-tdep.c: Ditto. * stack.c, dummy-frame.c, breakpoint.c: Ditto. --- gdb/ChangeLog | 7 +++++++ gdb/blockframe.c | 6 ++++-- gdb/breakpoint.c | 10 +++++----- gdb/dummy-frame.c | 4 ++-- gdb/f-valprint.c | 8 ++++---- gdb/rs6000-tdep.c | 36 ++++++++++++++++++++++-------------- gdb/stack.c | 16 +++++++++------- gdb/std-regs.c | 6 ++++-- 8 files changed, 57 insertions(+), 36 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d92a3aa..a10fb57 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2002-12-08 Andrew Cagney + + * blockframe.c: Use get_frame_base instead of directly accessing + the `struct frame_info' member frame. + * f-valprint.c, std-regs.c, rs6000-tdep.c: Ditto. + * stack.c, dummy-frame.c, breakpoint.c: Ditto. + 2002-12-08 Elena Zannoni * Makefile.in (readline_h): Define. diff --git a/gdb/blockframe.c b/gdb/blockframe.c index caaecd4..d7a25c9 100644 --- a/gdb/blockframe.c +++ b/gdb/blockframe.c @@ -701,7 +701,8 @@ generic_file_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) return 1; /* don't prune CALL_DUMMY frames */ else /* fall back to default algorithm (see frame.h) */ return (fp != 0 - && (INNER_THAN (fi->frame, fp) || fi->frame == fp) + && (INNER_THAN (get_frame_base (fi), fp) + || get_frame_base (fi) == fp) && !inside_entry_file (frame_pc_unwind (fi))); } @@ -713,7 +714,8 @@ generic_func_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi) return 1; /* don't prune CALL_DUMMY frames */ else /* fall back to default algorithm (see frame.h) */ return (fp != 0 - && (INNER_THAN (fi->frame, fp) || fi->frame == fp) + && (INNER_THAN (get_frame_base (fi), fp) + || get_frame_base (fi) == fp) && !inside_main_func ((fi)->pc) && !inside_entry_func ((fi)->pc)); } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index cf3da5e..a53a16b 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -1704,7 +1704,7 @@ deprecated_frame_in_dummy (struct frame_info *frame) ALL_BREAKPOINTS (b) { if (b->type == bp_call_dummy - && b->frame == frame->frame + && b->frame == get_frame_base (frame) /* We need to check the PC as well as the frame on the sparc, for signals.exp in the testsuite. */ && (frame->pc @@ -2728,7 +2728,7 @@ bpstat_stop_status (CORE_ADDR *pc, int not_a_sw_breakpoint) } if (b->frame && - b->frame != (get_current_frame ())->frame) + b->frame != get_frame_base (get_current_frame ())) bs->stop = 0; else { @@ -4318,7 +4318,7 @@ set_longjmp_resume_breakpoint (CORE_ADDR pc, struct frame_info *frame) b->address = pc; b->enable_state = bp_enabled; if (frame != NULL) - b->frame = frame->frame; + b->frame = get_frame_base (frame); else b->frame = 0; check_duplicates (b); @@ -4379,7 +4379,7 @@ set_momentary_breakpoint (struct symtab_and_line sal, struct frame_info *frame, b = set_raw_breakpoint (sal, type); b->enable_state = bp_enabled; b->disposition = disp_donttouch; - b->frame = (frame ? frame->frame : 0); + b->frame = (frame ? get_frame_base (frame) : 0); /* If we're debugging a multi-threaded program, then we want momentary breakpoints to be active in only a @@ -5427,7 +5427,7 @@ watch_command_1 (char *arg, int accessflag, int from_tty) scope_breakpoint->disposition = disp_del; /* Only break in the proper frame (help with recursion). */ - scope_breakpoint->frame = prev_frame->frame; + scope_breakpoint->frame = get_frame_base (prev_frame); /* Set the address at which we will stop. */ scope_breakpoint->address = get_frame_pc (prev_frame); diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 1f29859..727d508 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -106,7 +106,7 @@ struct dummy_frame * cached_find_dummy_frame (struct frame_info *frame, void **cache) { if ((*cache) == NULL) - (*cache) = find_dummy_frame (frame->pc, frame->frame); + (*cache) = find_dummy_frame (frame->pc, get_frame_base (frame)); return (*cache); } @@ -207,7 +207,7 @@ void generic_push_dummy_frame (void) { struct dummy_frame *dummy_frame; - CORE_ADDR fp = (get_current_frame ())->frame; + CORE_ADDR fp = get_frame_base (get_current_frame ()); /* check to see if there are stale dummy frames, perhaps left over from when a longjump took us out of a diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 7c57e0d..bd0b7bc 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -74,7 +74,7 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound) switch (TYPE_ARRAY_LOWER_BOUND_TYPE (type)) { case BOUND_BY_VALUE_ON_STACK: - current_frame_addr = deprecated_selected_frame->frame; + current_frame_addr = get_frame_base (deprecated_selected_frame); if (current_frame_addr > 0) { *lower_bound = @@ -98,7 +98,7 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound) break; case BOUND_BY_REF_ON_STACK: - current_frame_addr = deprecated_selected_frame->frame; + current_frame_addr = get_frame_base (deprecated_selected_frame); if (current_frame_addr > 0) { ptr_to_lower_bound = @@ -132,7 +132,7 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound) switch (TYPE_ARRAY_UPPER_BOUND_TYPE (type)) { case BOUND_BY_VALUE_ON_STACK: - current_frame_addr = deprecated_selected_frame->frame; + current_frame_addr = get_frame_base (deprecated_selected_frame); if (current_frame_addr > 0) { *upper_bound = @@ -161,7 +161,7 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound) break; case BOUND_BY_REF_ON_STACK: - current_frame_addr = deprecated_selected_frame->frame; + current_frame_addr = get_frame_base (deprecated_selected_frame); if (current_frame_addr > 0) { ptr_to_upper_bound = diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 31b6cb1..c5f9b03 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -261,7 +261,7 @@ branch_dest (int opcode, int instr, CORE_ADDR pc, CORE_ADDR safety) fi = get_current_frame (); if (fi != NULL) - dest = read_memory_addr (fi->frame + SIG_FRAME_PC_OFFSET, + dest = read_memory_addr (get_frame_base (fi) + SIG_FRAME_PC_OFFSET, gdbarch_tdep (current_gdbarch)->wordsize); } } @@ -958,7 +958,9 @@ rs6000_pop_frame (void) pc = read_pc (); sp = get_frame_base (frame); - if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, frame->frame, frame->frame)) + if (DEPRECATED_PC_IN_CALL_DUMMY (frame->pc, + get_frame_base (frame), + get_frame_base (frame))) { generic_pop_dummy_frame (); flush_cached_frames (); @@ -1513,10 +1515,14 @@ rs6000_frame_saved_pc (struct frame_info *fi) int wordsize = tdep->wordsize; if ((get_frame_type (fi) == SIGTRAMP_FRAME)) - return read_memory_addr (fi->frame + SIG_FRAME_PC_OFFSET, wordsize); + return read_memory_addr (get_frame_base (fi) + SIG_FRAME_PC_OFFSET, + wordsize); - if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame)) - return deprecated_read_register_dummy (fi->pc, fi->frame, PC_REGNUM); + if (DEPRECATED_PC_IN_CALL_DUMMY (fi->pc, + get_frame_base (fi), + get_frame_base (fi))) + return deprecated_read_register_dummy (fi->pc, + get_frame_base (fi), PC_REGNUM); func_start = get_pc_function_start (fi->pc); @@ -1530,8 +1536,8 @@ rs6000_frame_saved_pc (struct frame_info *fi) if (fdata.lr_offset == 0 && get_next_frame (fi) != NULL) { if ((get_frame_type (get_next_frame (fi)) == SIGTRAMP_FRAME)) - return read_memory_addr (get_next_frame (fi)->frame - + SIG_FRAME_LR_OFFSET, + return read_memory_addr ((get_frame_base (get_next_frame (fi)) + + SIG_FRAME_LR_OFFSET), wordsize); else if (DEPRECATED_PC_IN_CALL_DUMMY (get_next_frame (fi)->pc, 0, 0)) /* The link register wasn't saved by this frame and the next @@ -1708,7 +1714,7 @@ frame_initial_stack_address (struct frame_info *fi) if (fdata.alloca_reg < 0) { - fi->extra_info->initial_sp = fi->frame; + fi->extra_info->initial_sp = get_frame_base (fi); return fi->extra_info->initial_sp; } @@ -1726,7 +1732,7 @@ frame_initial_stack_address (struct frame_info *fi) /* NOTE: cagney/2002-04-17: At present the only time frame_register_read will fail is when the register isn't available. If that does happen, use the frame. */ - fi->extra_info->initial_sp = fi->frame; + fi->extra_info->initial_sp = get_frame_base (fi); } return fi->extra_info->initial_sp; } @@ -1746,18 +1752,20 @@ rs6000_frame_chain (struct frame_info *thisframe) CORE_ADDR fp, fpp, lr; int wordsize = gdbarch_tdep (current_gdbarch)->wordsize; - if (DEPRECATED_PC_IN_CALL_DUMMY (thisframe->pc, thisframe->frame, thisframe->frame)) + if (DEPRECATED_PC_IN_CALL_DUMMY (thisframe->pc, + get_frame_base (thisframe), + get_frame_base (thisframe))) /* A dummy frame always correctly chains back to the previous frame. */ - return read_memory_addr ((thisframe)->frame, wordsize); + return read_memory_addr (get_frame_base (thisframe), wordsize); if (inside_entry_file (thisframe->pc) || thisframe->pc == entry_point_address ()) return 0; if ((get_frame_type (thisframe) == SIGTRAMP_FRAME)) - fp = read_memory_addr (thisframe->frame + SIG_FRAME_FP_OFFSET, - wordsize); + fp = read_memory_addr (get_frame_base (thisframe) + SIG_FRAME_FP_OFFSET, + wordsize); else if (get_next_frame (thisframe) != NULL && (get_frame_type (get_next_frame (thisframe)) == SIGTRAMP_FRAME) && FRAMELESS_FUNCTION_INVOCATION (thisframe)) @@ -1765,7 +1773,7 @@ rs6000_frame_chain (struct frame_info *thisframe) frame pointer. */ fp = get_frame_base (thisframe); else - fp = read_memory_addr ((thisframe)->frame, wordsize); + fp = read_memory_addr (get_frame_base (thisframe), wordsize); return fp; } diff --git a/gdb/stack.c b/gdb/stack.c index d1dbd4e..51a2b3b 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -688,13 +688,13 @@ parse_frame_specification (char *frame_exp) (s)he gets. Still, give the highest one that matches. */ for (fid = get_current_frame (); - fid && fid->frame != args[0]; + fid && get_frame_base (fid) != args[0]; fid = get_prev_frame (fid)) ; if (fid) while ((tfid = get_prev_frame (fid)) && - (tfid->frame == args[0])) + (get_frame_base (tfid) == args[0])) fid = tfid; /* We couldn't identify the frame as an existing frame, but @@ -797,13 +797,13 @@ frame_info (char *addr_exp, int from_tty) { printf_filtered ("Stack level %d, frame at ", frame_relative_level (deprecated_selected_frame)); - print_address_numeric (fi->frame, 1, gdb_stdout); + print_address_numeric (get_frame_base (fi), 1, gdb_stdout); printf_filtered (":\n"); } else { printf_filtered ("Stack frame at "); - print_address_numeric (fi->frame, 1, gdb_stdout); + print_address_numeric (get_frame_base (fi), 1, gdb_stdout); printf_filtered (":\n"); } printf_filtered (" %s = ", REGISTER_NAME (PC_REGNUM)); @@ -835,7 +835,8 @@ frame_info (char *addr_exp, int from_tty) if (calling_frame_info) { printf_filtered (" called by frame at "); - print_address_numeric (calling_frame_info->frame, 1, gdb_stdout); + print_address_numeric (get_frame_base (calling_frame_info), + 1, gdb_stdout); } if (get_next_frame (fi) && calling_frame_info) puts_filtered (","); @@ -843,7 +844,8 @@ frame_info (char *addr_exp, int from_tty) if (get_next_frame (fi)) { printf_filtered (" caller of frame at "); - print_address_numeric (get_next_frame (fi)->frame, 1, gdb_stdout); + print_address_numeric (get_frame_base (get_next_frame (fi)), 1, + gdb_stdout); } if (get_next_frame (fi) || calling_frame_info) puts_filtered ("\n"); @@ -1750,7 +1752,7 @@ return_command (char *retval_exp, int from_tty) a POP_FRAME. The pc comparison makes this work even if the selected frame shares its fp with another frame. */ - while (selected_frame_addr != (frame = get_current_frame ())->frame + while (selected_frame_addr != get_frame_base (frame = get_current_frame ()) || selected_frame_pc != frame->pc) POP_FRAME; diff --git a/gdb/std-regs.c b/gdb/std-regs.c index 8177fc2..ef22681 100644 --- a/gdb/std-regs.c +++ b/gdb/std-regs.c @@ -64,7 +64,8 @@ value_of_builtin_frame_reg (struct frame_info *frame) memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); /* frame.base. */ if (frame != NULL) - ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, frame->frame); + ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, + get_frame_base (frame)); buf += TYPE_LENGTH (builtin_type_void_data_ptr); /* frame.XXX. */ return val; @@ -83,7 +84,8 @@ value_of_builtin_frame_fp_reg (struct frame_info *frame) if (frame == NULL) memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0); else - ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, frame->frame); + ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, + get_frame_base (frame)); return val; } } -- 2.7.4