|| 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
 
+2013-08-09  Yao Qi  <yao@codesourcery.com>
+
+       * gdb.trace/collection.exp (gdb_collect_args_test): Set
+       "only" and "both" to 'print entry-values' before selecting
+       trace frame.
+
 2013-08-08  Yao Qi  <yao@codesourcery.com>
 
        * gdb.trace/mi-trace-unavailable.exp: Don't set
 
     # Begin the test.
     run_trace_experiment $msg args_test_func
 
+    # Frame arguments and their entry values are displayed correctly with
+    # various values of "print entry-values" when a trace frame is
+    # selected.
+
+    gdb_test "tfind -1" ".*" ""
+    gdb_test_no_output "set print entry-values only" ""
+    gdb_test "tfind 0" \
+       " \\(argc@entry=\[^,\]*, argi@entry=\[^,\]*, argf@entry=\[^,\]*, argd@entry=\[^,\]*, argstruct@entry=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \
+       "collect $msg: tfind 0 with entry-values only"
+
+    gdb_test "tfind -1" ".*" ""
+    gdb_test_no_output "set print entry-values both" ""
+    gdb_test "tfind 0" \
+       " \\(argc=\[^,\]*, argc@entry=\[^,\]*, argi=\[^,\]*, argi@entry=\[^,\]*, argf=\[^,\]*, argf@entry=\[^,\]*, argd=\[^,\]*, argd@entry=\[^,\]*, argstruct=\[^,\]*, argstruct@entry=\[^,\]*, argarray=\[^,\]*, argarray@entry=\[^,\]*\\) .*" \
+       "collect $msg: tfind 0 with entry-values both"
+
     gdb_test "print argc" \
            "\\$\[0-9\]+ = 1 '.001'$cr" \
            "collect $msg: collected arg char"