From 4f734ebfabf1d9497948847d8d721adce1bfe54b Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sun, 21 Apr 2002 20:23:34 +0000 Subject: * frame.h (selected_frame_level): Document as deprecated. (frame_relative_level): Declare. * stack.c (frame_relative_level): New function. (selected_frame_level): Document as deprecated. (select_frame): Do not set the selected_frame_level. * stack.c (frame_info, record_selected_frame): Update. (frame_command, current_frame_command): Update. (up_silently_base, up_command, down_silently_base): Update. (down_command): Update. * inflow.c (kill_command): Update. * tracepoint.c (finish_tfind_command): Update. * corelow.c (core_open): Update. * thread.c (info_threads_command): Update. (do_captured_thread_select): Update. * infcmd.c (finish_command): Update. * breakpoint.c (insert_breakpoints, do_enable_breakpoint): Update. --- gdb/ChangeLog | 20 ++++++++++++++++++++ gdb/breakpoint.c | 6 +++--- gdb/corelow.c | 3 ++- gdb/frame.h | 10 +++++++++- gdb/infcmd.c | 3 ++- gdb/inflow.c | 3 ++- gdb/mi/ChangeLog | 4 ++++ gdb/mi/mi-main.c | 2 +- gdb/stack.c | 44 +++++++++++++++++++++++++++++++++----------- gdb/thread.c | 4 ++-- gdb/tracepoint.c | 3 ++- 11 files changed, 80 insertions(+), 22 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5698447858f..61a7ef78372 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +2002-04-21 Andrew Cagney + + * frame.h (selected_frame_level): Document as deprecated. + (frame_relative_level): Declare. + * stack.c (frame_relative_level): New function. + (selected_frame_level): Document as deprecated. + (select_frame): Do not set the selected_frame_level. + + * stack.c (frame_info, record_selected_frame): Update. + (frame_command, current_frame_command): Update. + (up_silently_base, up_command, down_silently_base): Update. + (down_command): Update. + * inflow.c (kill_command): Update. + * tracepoint.c (finish_tfind_command): Update. + * corelow.c (core_open): Update. + * thread.c (info_threads_command): Update. + (do_captured_thread_select): Update. + * infcmd.c (finish_command): Update. + * breakpoint.c (insert_breakpoints, do_enable_breakpoint): Update. + 2002-04-21 Jason Thorpe * config/alpha/tm-fbsd.h (FRAME_CHAIN_VALID): Remove. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index b48b4a2e669..bdf73596b30 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -901,7 +901,7 @@ insert_breakpoints (void) /* Save the current frame and level so we can restore it after evaluating the watchpoint expression on its own frame. */ saved_frame = selected_frame; - saved_level = selected_frame_level; + saved_level = frame_relative_level (selected_frame); /* Determine if the watchpoint is within scope. */ if (b->exp_valid_block == NULL) @@ -1002,7 +1002,7 @@ insert_breakpoints (void) /* Restore the frame and level. */ if ((saved_frame != selected_frame) || - (saved_level != selected_frame_level)) + (saved_level != frame_relative_level (selected_frame))) select_frame (saved_frame, saved_level); if (val) @@ -7282,7 +7282,7 @@ is valid is not currently in scope.\n", bpt->number); } save_selected_frame = selected_frame; - save_selected_frame_level = selected_frame_level; + save_selected_frame_level = frame_relative_level (selected_frame); select_frame (fr, -1); } diff --git a/gdb/corelow.c b/gdb/corelow.c index 68219c512c6..125952d9745 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -359,7 +359,8 @@ core_open (char *filename, int from_tty) /* Now, set up the frame cache, and print the top of stack. */ flush_cached_frames (); select_frame (get_current_frame (), 0); - print_stack_frame (selected_frame, selected_frame_level, 1); + print_stack_frame (selected_frame, + frame_relative_level (selected_frame), 1); } else { diff --git a/gdb/frame.h b/gdb/frame.h index 4f41364d5d9..2b7bf41a239 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -160,6 +160,11 @@ extern void frame_saved_regs_zalloc (struct frame_info *); #define FRAME_FP(fi) ((fi)->frame) +/* Level of the frame: 0 for innermost, 1 for its caller, ...; or -1 + for an invalid frame. */ + +extern int frame_relative_level (struct frame_info *fi); + /* Define a default FRAME_CHAIN_VALID, in the form that is suitable for most targets. If FRAME_CHAIN_VALID returns zero it means that the given frame is the outermost one and has no caller. @@ -184,7 +189,10 @@ extern struct frame_info *selected_frame; 0 for innermost, 1 for its caller, ... or -1 for frame specified by address with no defined level. */ -extern int selected_frame_level; +/* FIXME: cagney/2002-04-21: The variable `selected_frame_level' is + deprecated. It will dissapear `real soon now'. */ + +extern int selected_frame_level; /* DEPRECATED */ extern struct frame_info *create_new_frame (CORE_ADDR, CORE_ADDR); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 0680caa05ea..a7496d1f88c 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1289,7 +1289,8 @@ finish_command (char *arg, int from_tty) if (from_tty) { printf_filtered ("Run till exit from "); - print_stack_frame (selected_frame, selected_frame_level, 0); + print_stack_frame (selected_frame, + frame_relative_level (selected_frame), 0); } /* If running asynchronously and the target support asynchronous diff --git a/gdb/inflow.c b/gdb/inflow.c index 9cf24f4718d..526acdfdc7e 100644 --- a/gdb/inflow.c +++ b/gdb/inflow.c @@ -594,7 +594,8 @@ kill_command (char *arg, int from_tty) if (selected_frame == NULL) fputs_filtered ("No selected stack frame.\n", gdb_stdout); else - print_stack_frame (selected_frame, selected_frame_level, 1); + print_stack_frame (selected_frame, + frame_relative_level (selected_frame), 1); } } diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index cfe77bdfdbd..f2cc44a61cd 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,7 @@ +2002-04-14 Andrew Cagney + + * mi-main.c (mi_cmd_exec_return): + 2002-04-09 Andrew Cagney * mi-main.c (register_changed_p): Use frame_register_read instead diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index f42fdcfb1f2..ccb153fe95a 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -165,7 +165,7 @@ mi_cmd_exec_return (char *args, int from_tty) /* Because we have called return_command with from_tty = 0, we need to print the frame here. */ show_and_print_stack_frame (selected_frame, - selected_frame_level, + frame_relative_level (selected_frame), LOC_AND_ADDRESS); return MI_CMD_DONE; diff --git a/gdb/stack.c b/gdb/stack.c index 6a26e9a419c..7a8bbc22146 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -119,7 +119,22 @@ struct frame_info *selected_frame; 0 for innermost, 1 for its caller, ... or -1 for frame specified by address with no defined level. */ -int selected_frame_level; +/* FIXME: cagney/2002-04-21: The variable `selected_frame_level' is + deprecated. It will dissapear `real soon now'. */ + +int selected_frame_level; /* DEPRECATED */ + +/* Level of the selected frame: 0 for innermost, 1 for its caller, ... + or -1 for NULL frame. */ + +int +frame_relative_level (struct frame_info *fi) +{ + if (fi == NULL) + return -1; + else + return fi->level; +} /* Zero means do things normally; we are interacting directly with the user. One means print the full filename and linenumber when a @@ -817,9 +832,10 @@ frame_info (char *addr_exp, int from_tty) } calling_frame_info = get_prev_frame (fi); - if (!addr_exp && selected_frame_level >= 0) + if (!addr_exp && frame_relative_level (selected_frame) >= 0) { - printf_filtered ("Stack level %d, frame at ", selected_frame_level); + printf_filtered ("Stack level %d, frame at ", + frame_relative_level (selected_frame)); print_address_numeric (fi->frame, 1, gdb_stdout); printf_filtered (":\n"); } @@ -1457,7 +1473,9 @@ select_frame (struct frame_info *fi, int level) register struct symtab *s; selected_frame = fi; - selected_frame_level = level; + /* FIXME: cagney/2002-04-21: The variable `selected_frame_level' is + deprecated. It will dissapear `real soon now'. */ + selected_frame_level = level; /* DEPRECATED */ /* FIXME: cagney/2002-04-05: It can't be this easy (and looking at the increasingly complex list of checkes, it wasn't)! GDB is dragging around, and constantly updating, the global variable @@ -1530,7 +1548,7 @@ void record_selected_frame (CORE_ADDR *frameaddrp, int *levelp) { *frameaddrp = selected_frame ? selected_frame->frame : 0; - *levelp = selected_frame_level; + *levelp = frame_relative_level (selected_frame); } /* Return the symbol-block in which the selected frame is executing. @@ -1641,7 +1659,8 @@ void frame_command (char *level_exp, int from_tty) { select_frame_command (level_exp, from_tty); - show_and_print_stack_frame (selected_frame, selected_frame_level, 1); + show_and_print_stack_frame (selected_frame, + frame_relative_level (selected_frame), 1); } /* The XDB Compatibility command to print the current frame. */ @@ -1651,7 +1670,8 @@ current_frame_command (char *level_exp, int from_tty) { if (target_has_stack == 0 || selected_frame == 0) error ("No stack."); - print_only_stack_frame (selected_frame, selected_frame_level, 1); + print_only_stack_frame (selected_frame, + frame_relative_level (selected_frame), 1); } /* Select the frame up one or COUNT stack levels @@ -1673,7 +1693,7 @@ up_silently_base (char *count_exp) fi = find_relative_frame (selected_frame, &count1); if (count1 != 0 && count_exp == 0) error ("Initial frame selected; you cannot go up."); - select_frame (fi, selected_frame_level + count - count1); + select_frame (fi, frame_relative_level (selected_frame) + count - count1); } static void @@ -1686,7 +1706,8 @@ static void up_command (char *count_exp, int from_tty) { up_silently_base (count_exp); - show_and_print_stack_frame (selected_frame, selected_frame_level, 1); + show_and_print_stack_frame (selected_frame, + frame_relative_level (selected_frame), 1); } /* Select the frame down one or COUNT stack levels @@ -1717,7 +1738,7 @@ down_silently_base (char *count_exp) error ("Bottom (i.e., innermost) frame selected; you cannot go down."); } - select_frame (frame, selected_frame_level + count - count1); + select_frame (frame, frame_relative_level (selected_frame) + count - count1); } /* ARGSUSED */ @@ -1731,7 +1752,8 @@ static void down_command (char *count_exp, int from_tty) { down_silently_base (count_exp); - show_and_print_stack_frame (selected_frame, selected_frame_level, 1); + show_and_print_stack_frame (selected_frame, + frame_relative_level (selected_frame), 1); } void diff --git a/gdb/thread.c b/gdb/thread.c index b9c1f0265ec..640c4396c9b 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -421,7 +421,7 @@ info_threads_command (char *arg, int from_tty) struct thread_info *tp; ptid_t current_ptid; struct frame_info *cur_frame; - int saved_frame_level = selected_frame_level; + int saved_frame_level = frame_relative_level (selected_frame); int counter; char *extra_info; @@ -713,7 +713,7 @@ do_captured_thread_select (struct ui_out *uiout, #endif ui_out_text (uiout, ")]"); - print_stack_frame (selected_frame, selected_frame_level, 1); + print_stack_frame (selected_frame, frame_relative_level (selected_frame), 1); return GDB_RC_OK; } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 260012c1745..24ad8563c36 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1958,7 +1958,8 @@ finish_tfind_command (char *msg, else source_only = 1; - print_stack_frame (selected_frame, selected_frame_level, source_only); + print_stack_frame (selected_frame, frame_relative_level (selected_frame), + source_only); do_displays (); } } -- cgit v1.2.1