don't share per-BFD data if relocations are needed
[deliverable/binutils-gdb.git] / gdb / stack.c
index d89ff89bdd63e56c866f3afbc523da24c0565144..cd4ac7a24f69b2078ed7c25a75ebf78e2c06e03f 100644 (file)
@@ -52,7 +52,6 @@
 #include <ctype.h>
 #include "gdb_string.h"
 
-#include "psymtab.h"
 #include "symfile.h"
 #include "python/python.h"
 
@@ -155,7 +154,8 @@ frame_show_address (struct frame_info *frame,
 
 void
 print_stack_frame (struct frame_info *frame, int print_level,
-                  enum print_what print_what)
+                  enum print_what print_what,
+                  int set_current_sal)
 {
   volatile struct gdb_exception e;
 
@@ -167,8 +167,10 @@ print_stack_frame (struct frame_info *frame, int print_level,
     {
       int center = (print_what == SRC_LINE || print_what == SRC_AND_LOC);
 
-      print_frame_info (frame, print_level, print_what, 1 /* print_args */);
-      set_current_sal_from_frame (frame, center);
+      print_frame_info (frame, print_level, print_what, 1 /* print_args */,
+                       set_current_sal);
+      if (set_current_sal)
+       set_current_sal_from_frame (frame, center);
     }
 }
 
@@ -301,6 +303,27 @@ print_frame_arg (const struct frame_arg *arg)
   annotate_arg_end ();
 }
 
+/* Read in inferior function local SYM at FRAME into ARGP.  Caller is
+   responsible for xfree of ARGP->ERROR.  This function never throws an
+   exception.  */
+
+void
+read_frame_local (struct symbol *sym, struct frame_info *frame,
+                 struct frame_arg *argp)
+{
+  volatile struct gdb_exception except;
+  struct value *val = NULL;
+
+  TRY_CATCH (except, RETURN_MASK_ERROR)
+    {
+      val = read_var_value (sym, frame);
+    }
+
+  argp->error = (val == NULL) ? xstrdup (except.message) : NULL;
+  argp->sym = sym;
+  argp->val = val;
+}
+
 /* Read in inferior function parameter SYM at FRAME into ARGP.  Caller is
    responsible for xfree of ARGP->ERROR.  This function never throws an
    exception.  */
@@ -448,7 +471,10 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
          || print_entry_values == print_entry_values_both
          || (print_entry_values == print_entry_values_preferred
              && (!val || value_optimized_out (val))))
-       entryval = allocate_optimized_out_value (SYMBOL_TYPE (sym));
+       {
+         entryval = allocate_optimized_out_value (SYMBOL_TYPE (sym));
+         entryval_error = NULL;
+       }
     }
   if ((print_entry_values == print_entry_values_compact
        || print_entry_values == print_entry_values_if_needed
@@ -757,7 +783,8 @@ do_gdb_disassembly (struct gdbarch *gdbarch,
 
 void
 print_frame_info (struct frame_info *frame, int print_level,
-                 enum print_what print_what, int print_args)
+                 enum print_what print_what, int print_args,
+                 int set_current_sal)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
   struct symtab_and_line sal;
@@ -882,7 +909,7 @@ print_frame_info (struct frame_info *frame, int print_level,
        do_gdb_disassembly (get_frame_arch (frame), -1, sal.pc, sal.end);
     }
 
-  if (print_what != LOCATION)
+  if (set_current_sal)
     {
       CORE_ADDR pc;
 
@@ -1764,7 +1791,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
             hand, perhaps the code does or could be fixed to make sure
             the frame->prev field gets set to NULL in that case).  */
 
-         print_frame_info (fi, 1, LOCATION, 1);
+         print_frame_info (fi, 1, LOCATION, 1, 0);
          if (show_locals)
            {
              struct frame_id frame_id = get_frame_id (fi);
@@ -2161,7 +2188,7 @@ select_and_print_frame (struct frame_info *frame)
 {
   select_frame (frame);
   if (frame)
-    print_stack_frame (frame, 1, SRC_AND_LOC);
+    print_stack_frame (frame, 1, SRC_AND_LOC, 1);
 }
 \f
 /* Return the symbol-block in which the selected frame is executing.
@@ -2239,7 +2266,7 @@ static void
 frame_command (char *level_exp, int from_tty)
 {
   select_frame_command (level_exp, from_tty);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* The XDB Compatibility command to print the current frame.  */
@@ -2247,7 +2274,7 @@ frame_command (char *level_exp, int from_tty)
 static void
 current_frame_command (char *level_exp, int from_tty)
 {
-  print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (_("No stack.")), 1, SRC_AND_LOC, 1);
 }
 
 /* Select the frame up one or COUNT_EXP stack levels from the
@@ -2278,7 +2305,7 @@ static void
 up_command (char *count_exp, int from_tty)
 {
   up_silently_base (count_exp);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 
 /* Select the frame down one or COUNT_EXP stack levels from the previously
@@ -2317,7 +2344,7 @@ static void
 down_command (char *count_exp, int from_tty)
 {
   down_silently_base (count_exp);
-  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+  print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
 }
 \f
 
This page took 0.125507 seconds and 4 git commands to generate.