gdb/
authorYao Qi <yao@codesourcery.com>
Thu, 8 Aug 2013 05:10:10 +0000 (05:10 +0000)
committerYao Qi <yao@codesourcery.com>
Thu, 8 Aug 2013 05:10:10 +0000 (05:10 +0000)
* frame.h (read_frame_local): Declare.
* mi/mi-cmd-stack.c (list_args_or_locals): Call
read_frame_local.
* stack.c (read_frame_local): New.

gdb/testsuite/

* gdb.trace/mi-trace-unavailable.exp: Don't set
"print entry-values" to "no".
(test_trace_unavailable): Set various values to
"print entry-values" to test that the output of
'-stack-list-locals' is not affected, and then set
set "print entry-values" to "no".

gdb/ChangeLog
gdb/frame.h
gdb/mi/mi-cmd-stack.c
gdb/stack.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/mi-trace-unavailable.exp

index 2bc0dc9c4fa949f5893bd3bb7cc845d74187fbc5..3de17da92318198e2839dde8f5f5be460ec13c98 100644 (file)
@@ -1,3 +1,10 @@
+2013-08-08  Yao Qi  <yao@codesourcery.com>
+
+       * frame.h (read_frame_local): Declare.
+       * mi/mi-cmd-stack.c (list_args_or_locals): Call
+       read_frame_local.
+       * stack.c (read_frame_local): New.
+
 2013-08-08  Yao Qi  <yao@codesourcery.com>
 
        * mi/mi-cmd-stack.c: Update comments to function
index 31b9cb7209f02bca360f8f4d17ccb84f41d5c725..f02addf4bbb640eb271a4bfd6db39e5adec94fff 100644 (file)
@@ -714,6 +714,8 @@ struct frame_arg
 extern void read_frame_arg (struct symbol *sym, struct frame_info *frame,
                            struct frame_arg *argp,
                            struct frame_arg *entryargp);
+extern void read_frame_local (struct symbol *sym, struct frame_info *frame,
+                             struct frame_arg *argp);
 
 extern void args_info (char *, int);
 
index 9294e4609e3ea6e5246dbd282193d7b87574536a..e542fc19432dbff065f4ca3ce43316a70becf3ad 100644 (file)
@@ -602,7 +602,10 @@ list_args_or_locals (enum what_to_list what, enum print_values values,
                      && TYPE_CODE (type) != TYPE_CODE_UNION)
                    {
                case PRINT_ALL_VALUES:
-                     read_frame_arg (sym2, fi, &arg, &entryarg);
+                 if (SYMBOL_IS_ARGUMENT (sym))
+                   read_frame_arg (sym2, fi, &arg, &entryarg);
+                 else
+                   read_frame_local (sym2, fi, &arg);
                    }
                  break;
                }
index d89ff89bdd63e56c866f3afbc523da24c0565144..7d97dc83287973ea8191d2662ce49ecc785de7c4 100644 (file)
@@ -301,6 +301,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.  */
index 5f38aa00ef0748318480ce7c24bd45a51c2c7a9f..5fb44e755dcf9c5907cb425c6cbeed57af25203f 100644 (file)
@@ -1,3 +1,12 @@
+2013-08-08  Yao Qi  <yao@codesourcery.com>
+
+       * gdb.trace/mi-trace-unavailable.exp: Don't set
+       "print entry-values" to "no".
+       (test_trace_unavailable): Set various values to
+       "print entry-values" to test that the output of
+       '-stack-list-locals' is not affected, and then set
+       set "print entry-values" to "no".
+
 2013-08-07  Doug Evans  <dje@google.com>
 
        * gdb.python/py-value-cc.cc: Renamed from py-value.cc.
index 42f6e326c2e2e33ca832d00f89e04a7f22e97359..d96ec8b185e40096a5999435466e68269a681bb5 100644 (file)
@@ -75,9 +75,6 @@ mi_gdb_test "-trace-save ${tracefile}.tf" ".*\\^done" \
 mi_gdb_test "-trace-save -ctf ${tracefile}.ctf" ".*\\^done" \
     "save ctf trace file"
 
-mi_gdb_test "-gdb-set print entry-values no" {\^done} \
-    "-gdb-set print entry-values no"
-
 proc test_trace_unavailable { data_source } {
     global decimal
 
@@ -89,6 +86,22 @@ proc test_trace_unavailable { data_source } {
            ".*\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
            "-trace-find frame-number 0"
 
+       # The "print entry-values" option shouldn't affect the output of
+       # '-stack-list-locals'.
+       foreach entry_values { no only preferred if-needed both compact default } {
+           mi_gdb_test "-gdb-set print entry-values $entry_values" {\^done} ""
+
+           with_test_prefix "$entry_values" {
+               # Test MI command '-stack-list-locals'.
+               mi_gdb_test "-stack-list-locals --simple-values" \
+                   ".*\\^done,locals=\\\[\{name=\"array\",type=\"unsigned char \\\[2\\\]\"\},\{name=\"i\",type=\"int\",value=\"<unavailable>\"\}\\\]" \
+                   "-stack-list-locals --simple-values"
+           }
+       }
+
+       mi_gdb_test "-gdb-set print entry-values no" {\^done} \
+           "-gdb-set print entry-values no"
+
        # Test MI command '-stack-list-locals'.
        mi_gdb_test "-stack-list-locals --simple-values" \
            ".*\\^done,locals=\\\[\{name=\"array\",type=\"unsigned char \\\[2\\\]\"\},\{name=\"i\",type=\"int\",value=\"<unavailable>\"\}\\\]" \