2013-08-30 Phil Muldoon <pmuldoon@redhat.com>
[deliverable/binutils-gdb.git] / gdb / stack.c
index a4b392e563b09fbc1fed64795fe02859fb1f915c..16a03eb1e3fcbb6037063fe57a88740c9e5c6b2f 100644 (file)
@@ -52,7 +52,6 @@
 #include <ctype.h>
 #include "gdb_string.h"
 
-#include "psymtab.h"
 #include "symfile.h"
 #include "python/python.h"
 
@@ -65,6 +64,9 @@ static const char *const print_frame_arguments_choices[] =
   {"all", "scalars", "none", NULL};
 static const char *print_frame_arguments = "scalars";
 
+/* If non-zero, don't invoke pretty-printers for frame arguments.  */
+static int print_raw_frame_arguments;
+
 /* The possible choices of "set print entry-values", and the value
    of this setting.  */
 
@@ -275,8 +277,9 @@ print_frame_arg (const struct frame_arg *arg)
              else
                language = current_language;
 
-             get_raw_print_options (&opts);
+             get_no_prettyformat_print_options (&opts);
              opts.deref_ref = 1;
+             opts.raw = print_raw_frame_arguments;
 
              /* True in "summary" mode, false otherwise.  */
              opts.summary = !strcmp (print_frame_arguments, "scalars");
@@ -297,6 +300,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.  */
@@ -359,10 +383,6 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
            {
              struct type *type = value_type (val);
 
-             if (!value_optimized_out (val) && value_lazy (val))
-               value_fetch_lazy (val);
-             if (!value_optimized_out (val) && value_lazy (entryval))
-               value_fetch_lazy (entryval);
              if (!value_optimized_out (val)
                  && value_available_contents_eq (val, 0, entryval, 0,
                                                  TYPE_LENGTH (type)))
@@ -448,7 +468,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
@@ -1766,20 +1789,20 @@ backtrace_command_1 (char *count_exp, int show_locals, int no_filters,
 
          print_frame_info (fi, 1, LOCATION, 1);
          if (show_locals)
-       {
-         struct frame_id frame_id = get_frame_id (fi);
+           {
+             struct frame_id frame_id = get_frame_id (fi);
 
-         print_frame_local_vars (fi, 1, gdb_stdout);
+             print_frame_local_vars (fi, 1, gdb_stdout);
 
-         /* print_frame_local_vars invalidates FI.  */
-         fi = frame_find_by_id (frame_id);
-         if (fi == NULL)
-           {
-             trailing = NULL;
-             warning (_("Unable to restore previously selected frame."));
-             break;
+             /* print_frame_local_vars invalidates FI.  */
+             fi = frame_find_by_id (frame_id);
+             if (fi == NULL)
+               {
+                 trailing = NULL;
+                 warning (_("Unable to restore previously selected frame."));
+                 break;
+               }
            }
-       }
 
          /* Save the last frame to check for error conditions.  */
          trailing = fi;
@@ -2644,6 +2667,15 @@ Usage: func <name>\n"));
                        _("Show printing of non-scalar frame arguments"),
                        NULL, NULL, NULL, &setprintlist, &showprintlist);
 
+  add_setshow_boolean_cmd ("frame-arguments", no_class,
+                          &print_raw_frame_arguments, _("\
+Set whether to print frame arguments in raw form."), _("\
+Show whether to print frame arguments in raw form."), _("\
+If set, frame arguments are printed in raw form, bypassing any\n\
+pretty-printers for that value."),
+                          NULL, NULL,
+                          &setprintrawlist, &showprintrawlist);
+
   add_setshow_auto_boolean_cmd ("disassemble-next-line", class_stack,
                                &disassemble_next_line, _("\
 Set whether to disassemble next source line or insn when execution stops."),
This page took 0.025833 seconds and 4 git commands to generate.