]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add a Debian patch that prevents some bogus "No selected frame" errors.
authorDaniel Jacobowitz <drow@false.org>
Sun, 2 Apr 2006 21:52:40 +0000 (21:52 +0000)
committerDaniel Jacobowitz <drow@false.org>
Sun, 2 Apr 2006 21:52:40 +0000 (21:52 +0000)
This needs to go to mainline separately.

13 files changed:
gdb/breakpoint.c
gdb/cli/cli-cmds.c
gdb/f-valprint.c
gdb/infcmd.c
gdb/inflow.c
gdb/infrun.c
gdb/stack.c
gdb/testsuite/gdb.base/default.exp
gdb/tui/tui-disasm.c
gdb/tui/tui-source.c
gdb/tui/tui-winsource.c
gdb/valops.c
gdb/varobj.c

index 31b3b4b36dbf3618724e7bca3602dd14b2555855..472d8d080547e0d4804b90498c44147aaad85396 100644 (file)
@@ -932,7 +932,7 @@ insert_bp_location (struct bp_location *bpt,
       /* FIXME drow/2003-09-09: It would be nice if evaluate_expression
         took a frame parameter, so that we didn't have to change the
         selected frame.  */
-      saved_frame_id = get_frame_id (deprecated_selected_frame);
+      saved_frame_id = get_frame_id (get_selected_frame (NULL));
 
       /* Determine if the watchpoint is within scope.  */
       if (bpt->owner->exp_valid_block == NULL)
@@ -5939,7 +5939,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
 {
   struct symtabs_and_lines sals;
   struct symtab_and_line sal;
-  struct frame_info *prev_frame = get_prev_frame (deprecated_selected_frame);
+  struct frame_info *prev_frame = get_prev_frame (get_selected_frame (NULL));
   struct breakpoint *breakpoint;
   struct cleanup *old_chain;
   struct continuation_arg *arg1;
@@ -5976,7 +5976,7 @@ until_break_command (char *arg, int from_tty, int anywhere)
     /* Otherwise, specify the current frame, because we want to stop only
        at the very same frame.  */
     breakpoint = set_momentary_breakpoint (sal,
-                                          get_frame_id (deprecated_selected_frame),
+                                          get_frame_id (get_selected_frame (NULL)),
                                           bp_until);
 
   if (!target_can_async_p ())
index 88b495641ee798c1f9fbcaf84c63dd69759ec5a3..2fc3445386e5fe07bf2402071d02ebb43afa0043 100644 (file)
@@ -862,10 +862,7 @@ disassemble_command (char *arg, int from_tty)
   name = NULL;
   if (!arg)
     {
-      if (!deprecated_selected_frame)
-       error (_("No frame selected."));
-
-      pc = get_frame_pc (deprecated_selected_frame);
+      pc = get_frame_pc (get_selected_frame (_("No frame selected.")));
       if (find_pc_partial_function (pc, &name, &low, &high) == 0)
        error (_("No function contains program counter for selected frame."));
 #if defined(TUI)
index b83597cf3b0a8645ab9baedf396db64328fe9e2f..526c85c940755e2f1eb5b3d2e8341d83e99eeee4 100644 (file)
@@ -71,7 +71,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 = get_frame_base (deprecated_selected_frame);
+      current_frame_addr = get_frame_base (get_selected_frame (NULL));
       if (current_frame_addr > 0)
        {
          *lower_bound =
@@ -95,7 +95,7 @@ f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
       break;
 
     case BOUND_BY_REF_ON_STACK:
-      current_frame_addr = get_frame_base (deprecated_selected_frame);
+      current_frame_addr = get_frame_base (get_selected_frame (NULL));
       if (current_frame_addr > 0)
        {
          ptr_to_lower_bound =
@@ -129,7 +129,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 = get_frame_base (deprecated_selected_frame);
+      current_frame_addr = get_frame_base (get_selected_frame (NULL));
       if (current_frame_addr > 0)
        {
          *upper_bound =
@@ -158,7 +158,7 @@ f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
       break;
 
     case BOUND_BY_REF_ON_STACK:
-      current_frame_addr = get_frame_base (deprecated_selected_frame);
+      current_frame_addr = get_frame_base (get_selected_frame (NULL));
       if (current_frame_addr > 0)
        {
          ptr_to_upper_bound =
@@ -643,10 +643,7 @@ info_common_command (char *comname, int from_tty)
      first make sure that it is visible and if so, let 
      us display its contents */
 
-  fi = deprecated_selected_frame;
-
-  if (fi == NULL)
-    error (_("No frame selected"));
+  fi = get_selected_frame (_("No frame selected"));
 
   /* The following is generally ripped off from stack.c's routine 
      print_frame_info() */
@@ -735,10 +732,7 @@ there_is_a_visible_common_named (char *comname)
   if (comname == NULL)
     error (_("Cannot deal with NULL common name!"));
 
-  fi = deprecated_selected_frame;
-
-  if (fi == NULL)
-    error (_("No frame selected"));
+  fi = get_selected_frame (_("No frame selected"));
 
   /* The following is generally ripped off from stack.c's routine 
      print_frame_info() */
index 66387d9f5e687164a2be47cdaab4e53177d3606a..3d18298a1c6fbd0a329063171ca0b7d4354f78b5 100644 (file)
@@ -1308,10 +1308,8 @@ finish_command (char *arg, int from_tty)
     error (_("The \"finish\" command does not take any arguments."));
   if (!target_has_execution)
     error (_("The program is not running."));
-  if (deprecated_selected_frame == NULL)
-    error (_("No selected frame."));
 
-  frame = get_prev_frame (deprecated_selected_frame);
+  frame = get_prev_frame (get_selected_frame (_("No selected frame.")));
   if (frame == 0)
     error (_("\"finish\" not meaningful in the outermost frame."));
 
@@ -1329,7 +1327,7 @@ finish_command (char *arg, int from_tty)
 
   /* Find the function we will return from.  */
 
-  function = find_pc_function (get_frame_pc (deprecated_selected_frame));
+  function = find_pc_function (get_frame_pc (get_selected_frame (NULL)));
 
   /* Print info on the selected frame, including level number but not
      source.  */
@@ -1695,13 +1693,12 @@ registers_info (char *addr_exp, int fpregs)
 
   if (!target_has_registers)
     error (_("The program has no registers now."));
-  if (deprecated_selected_frame == NULL)
-    error (_("No selected frame."));
 
   if (!addr_exp)
     {
       gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
-                                   deprecated_selected_frame, -1, fpregs);
+                                   get_selected_frame (_("No selected frame.")),
+                                   -1, fpregs);
       return;
     }
 
@@ -1734,12 +1731,12 @@ registers_info (char *addr_exp, int fpregs)
 
       /* A register name?  */
       {
-       int regnum = frame_map_name_to_regnum (deprecated_selected_frame,
+       int regnum = frame_map_name_to_regnum (get_selected_frame (_("No selected frame.")),
                                               start, end - start);
        if (regnum >= 0)
          {
            gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
-                                         deprecated_selected_frame, regnum, fpregs);
+                                         get_selected_frame (NULL), regnum, fpregs);
            continue;
          }
       }
@@ -1753,7 +1750,7 @@ registers_info (char *addr_exp, int fpregs)
            && regnum < NUM_REGS + NUM_PSEUDO_REGS)
          {
            gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
-                                         deprecated_selected_frame, regnum, fpregs);
+                                         get_selected_frame (NULL), regnum, fpregs);
            continue;
          }
       }
@@ -1779,7 +1776,7 @@ registers_info (char *addr_exp, int fpregs)
                if (gdbarch_register_reggroup_p (current_gdbarch, regnum,
                                                 group))
                  gdbarch_print_registers_info (current_gdbarch,
-                                               gdb_stdout, deprecated_selected_frame,
+                                               gdb_stdout, get_selected_frame (NULL),
                                                regnum, fpregs);
              }
            continue;
@@ -1809,8 +1806,6 @@ print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
 {
   if (!target_has_registers)
     error (_("The program has no registers now."));
-  if (deprecated_selected_frame == NULL)
-    error (_("No selected frame."));
 
   if (gdbarch_print_vector_info_p (gdbarch))
     gdbarch_print_vector_info (gdbarch, file, frame, args);
@@ -1835,7 +1830,7 @@ print_vector_info (struct gdbarch *gdbarch, struct ui_file *file,
 static void
 vector_info (char *args, int from_tty)
 {
-  print_vector_info (current_gdbarch, gdb_stdout, deprecated_selected_frame, args);
+  print_vector_info (current_gdbarch, gdb_stdout, get_selected_frame (NULL), args);
 }
 \f
 
@@ -2023,8 +2018,6 @@ print_float_info (struct gdbarch *gdbarch, struct ui_file *file,
 {
   if (!target_has_registers)
     error (_("The program has no registers now."));
-  if (deprecated_selected_frame == NULL)
-    error (_("No selected frame."));
 
   if (gdbarch_print_float_info_p (gdbarch))
     gdbarch_print_float_info (gdbarch, file, frame, args);
@@ -2051,7 +2044,7 @@ static void
 float_info (char *args, int from_tty)
 {
   print_float_info (current_gdbarch, gdb_stdout, 
-                   deprecated_selected_frame, args);
+                   get_selected_frame (NULL), args);
 }
 \f
 static void
index 83a0c9d828155cce4704383ebbcc18275d606fab..1b15d2c395820c1292e4c57a8358b1b2d22327df 100644 (file)
@@ -588,7 +588,7 @@ kill_command (char *arg, int from_tty)
   if (target_has_stack)
     {
       printf_filtered (_("In %s,\n"), target_longname);
-      if (deprecated_selected_frame == NULL)
+      if (deprecated_safe_get_selected_frame () == NULL)
        fputs_filtered ("No selected stack frame.\n", gdb_stdout);
       else
        print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
index 47fbe09ed7294dab55b26c57d58c95613054d001..d4bf88940bbb4ace62cdf01039df33a53d7456c9 100644 (file)
@@ -3590,7 +3590,7 @@ save_inferior_status (int restore_stack_info)
 
   inf_status->registers = regcache_dup (current_regcache);
 
-  inf_status->selected_frame_id = get_frame_id (deprecated_selected_frame);
+  inf_status->selected_frame_id = get_frame_id (get_selected_frame (NULL));
   return inf_status;
 }
 
index 435bb0c9e7a8ec909e943d37552dd2f8865f0407..91930466cd7b001b339627b93186d1f6d6d9b7ac 100644 (file)
@@ -1909,7 +1909,7 @@ func_command (char *arg, int from_tty)
 
   if (!found)
     printf_filtered (_("'%s' not within current stack frame.\n"), arg);
-  else if (frame != deprecated_selected_frame)
+  else if (frame != get_selected_frame (NULL))
     select_and_print_frame (frame);
 }
 
@@ -1918,7 +1918,7 @@ func_command (char *arg, int from_tty)
 enum language
 get_frame_language (void)
 {
-  struct frame_info *frame = deprecated_selected_frame;
+  struct frame_info *frame = deprecated_safe_get_selected_frame ();
 
   if (frame)
     {
index 1ecf1f7dbe6c0c94d7e214709c5504fe82c1be11..784fe8c2152d31f319c9a77f738c1db7b0ac906a 100644 (file)
@@ -167,7 +167,7 @@ gdb_test "disable breakpoints" "" "disable breakpoints"
 #test disable display
 gdb_test "disable display" "" "disable display"
 #test disassemble
-gdb_test "disassemble" "No frame selected." "disassemble"
+gdb_test "disassemble" "No (frame selected|registers)." "disassemble"
 #test display
 gdb_test "display" "" "display"
 #test do
@@ -229,9 +229,9 @@ gdb_expect {
 }
 
 #test frame "f" abbreviation
-gdb_test "f" "No stack." "frame \"f\" abbreviation"
+gdb_test "f" "No (stack|registers)." "frame \"f\" abbreviation"
 #test frame
-gdb_test "frame" "No stack." "frame"
+gdb_test "frame" "No (stack|registers)." "frame"
 #test fg
 gdb_test "fg" "The program is not being run." "fg"
 # FIXME: fg kills the udi connection
@@ -294,9 +294,9 @@ gdb_test "ignore" "Argument required .a breakpoint number.*" "ignore"
 #test info address
 gdb_test "info address" "Argument required." "info address"
 #test info all-registers
-gdb_test "info all-registers" "The program has no registers now." "info all-registers"
+gdb_test "info all-registers" "(The program has no registers now|No registers)." "info all-registers"
 #test info args
-gdb_test "info args" "No frame selected." "info args"
+gdb_test "info args" "No (frame selected|registers)." "info args"
 #test info bogus-gdb-command
 gdb_test "info bogus-gdb-command" "Undefined info command: \"bogus-gdb-command\".  Try \"help info\".*" "info bogus-gdb-command"
 #test info breakpoints
@@ -320,11 +320,11 @@ gdb_test "info frame" "No stack.|No selected frame." "info frame"
 #test info files
 gdb_test "info files" "" "info files"
 #test info float
-gdb_test "info float" "The program has no registers now." "info float"
+gdb_test "info float" "(The program has no registers now|No registers)." "info float"
 #test info functions
 gdb_test "info functions" "All defined functions:" "info functions"
 #test info locals
-gdb_test "info locals" "No frame selected." "info locals"
+gdb_test "info locals" "(No frame selected|No registers)." "info locals"
 #test info program
 gdb_test "info program" "The program being debugged is not being run." "info program"
 #test info registers
@@ -352,7 +352,7 @@ gdb_test "info types" "All defined types:" "info types"
 #test info variables
 gdb_test "info variables" "All defined variables:" "info variables"
 #test info vector
-gdb_test "info vector" "The program has no registers now." "info vector"
+gdb_test "info vector" "(The program has no registers now|No registers)." "info vector"
 #test info warranty
 gdb_test "info warranty" "NO WARRANTY(\[^\r\n\]*\[\r\n\])+  *11.  *BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY(\[^\r\n\]*\[\r\n\])+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN(\[^\r\n\]*\[\r\n\])+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES(\[^\r\n\]*\[\r\n\])+PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED(\[^\r\n\]*\[\r\n\])+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF(\[^\r\n\]*\[\r\n\])+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS(\[^\r\n\]*\[\r\n\])+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE(\[^\r\n\]*\[\r\n\])+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,(\[^\r\n\]*\[\r\n\])+REPAIR OR CORRECTION.(\[^\r\n\]*\[\r\n\])+  *12.  *IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING(\[^\r\n\]*\[\r\n\])+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR(\[^\r\n\]*\[\r\n\])+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,(\[^\r\n\]*\[\r\n\])+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING(\[^\r\n\]*\[\r\n\])+OUT OF THE USE OR INABILITY TO USE THE PROGRAM .INCLUDING BUT NOT LIMITED(\[^\r\n\]*\[\r\n\])+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY(\[^\r\n\]*\[\r\n\])+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER(\[^\r\n\]*\[\r\n\])+PROGRAMS., EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE(\[^\r\n\]*\[\r\n\])+POSSIBILITY OF SUCH DAMAGES.*" "info warranty"
 #test info watchpoints
index 676f492ad3f8fc1e3f64163297d8656169b191ad..3c017ebe174eff29725d05de914c5ee3f85292a5 100644 (file)
@@ -386,7 +386,7 @@ tui_vertical_disassem_scroll (enum tui_scroll_direction scroll_direction,
 
       content = (tui_win_content) TUI_DISASM_WIN->generic.content;
       if (cursal.symtab == (struct symtab *) NULL)
-       s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+       s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL)));
       else
        s = cursal.symtab;
 
index c7bcea684830a86cba9e66eaabd0160f5257744d..b639ec3b94ab761183b41a07b1831297b88b49c5 100644 (file)
@@ -330,7 +330,7 @@ tui_vertical_source_scroll (enum tui_scroll_direction scroll_direction,
       struct symtab_and_line cursal = get_current_source_symtab_and_line ();
 
       if (cursal.symtab == (struct symtab *) NULL)
-       s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+       s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL)));
       else
        s = cursal.symtab;
 
index d7ca706e0a655c7109a506b35c44603b15e140a7..5d6949aaa25382eed4322a29e5a4112a21f36f5c 100644 (file)
@@ -314,7 +314,7 @@ tui_horizontal_source_scroll (struct tui_win_info * win_info,
       struct symtab_and_line cursal = get_current_source_symtab_and_line ();
 
       if (cursal.symtab == (struct symtab *) NULL)
-       s = find_pc_symtab (get_frame_pc (deprecated_selected_frame));
+       s = find_pc_symtab (get_frame_pc (get_selected_frame (NULL)));
       else
        s = cursal.symtab;
 
index e86b532e40be696a6630a2fc8d81c38fa29e8d1a..d34623849e9dfcb074959396226846a0cb8ea5c3 100644 (file)
@@ -544,7 +544,7 @@ value_assign (struct value *toval, struct value *fromval)
   /* Since modifying a register can trash the frame chain, and modifying memory
      can trash the frame cache, we save the old frame and then restore the new
      frame afterwards.  */
-  old_frame = get_frame_id (deprecated_selected_frame);
+  old_frame = get_frame_id (deprecated_safe_get_selected_frame ());
 
   switch (VALUE_LVAL (toval))
     {
@@ -2605,16 +2605,18 @@ value_of_local (const char *name, int complain)
   struct symbol *func, *sym;
   struct block *b;
   struct value * ret;
+  struct frame_info *frame;
 
-  if (deprecated_selected_frame == 0)
+  if (complain)
+    frame = get_selected_frame (_("no frame selected"));
+  else
     {
-      if (complain)
-       error (_("no frame selected"));
-      else
+      frame = deprecated_safe_get_selected_frame ();
+      if (frame == 0)
        return 0;
     }
 
-  func = get_frame_function (deprecated_selected_frame);
+  func = get_frame_function (frame);
   if (!func)
     {
       if (complain)
@@ -2643,7 +2645,7 @@ value_of_local (const char *name, int complain)
        return NULL;
     }
 
-  ret = read_var_value (sym, deprecated_selected_frame);
+  ret = read_var_value (sym, frame);
   if (ret == 0 && complain)
     error (_("`%s' argument unreadable"), name);
   return ret;
index 76ced134a8b33dc3e83b002b3c9f654bbc388ef5..532d819917a6b017ae0a65fd7e5a7689d2601c97 100644 (file)
@@ -498,7 +498,7 @@ varobj_create (char *objname,
       if (fi != NULL)
        {
          var->root->frame = get_frame_id (fi);
-         old_fi = deprecated_selected_frame;
+         old_fi = get_selected_frame (NULL);
          select_frame (fi);
        }