OSDN Git Service

2010-03-31 Stan Shebs <stan@codesourcery.com>
authorshebs <shebs>
Thu, 1 Apr 2010 02:59:48 +0000 (02:59 +0000)
committershebs <shebs>
Thu, 1 Apr 2010 02:59:48 +0000 (02:59 +0000)
* breakpoint.c (tracepoint_save_command): Include variables,
  conditionals, tracepoint types, and default-collect.
* tracepoint.c (save_trace_state_variables): New function.
* tracepoint.h (save_trace_state_variables): Declare it.

* gdb.trace/save-trace.exp: Test save/restore of default-collect
and tracepoint conditionals.
(gdb_verify_tracepoints): Delete unused return.

gdb/ChangeLog
gdb/breakpoint.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/save-trace.exp
gdb/tracepoint.c
gdb/tracepoint.h

index 00092e8..7d5c47e 100644 (file)
@@ -1,3 +1,10 @@
+2010-03-31  Stan Shebs  <stan@codesourcery.com>
+
+       * breakpoint.c (tracepoint_save_command): Include variables,
+       conditionals, tracepoint types, and default-collect.
+       * tracepoint.c (save_trace_state_variables): New function.
+       * tracepoint.h (save_trace_state_variables): Declare it.
+
 2010-03-31  Pierre Muller  <muller@ics.u-strasbg.fr>
 
        * src/gdb/remote.c (end_thread): ARI fix: Use xstrdup instead of strdup.
index 2bded96..dfd93f8 100644 (file)
@@ -10649,17 +10649,29 @@ tracepoint_save_command (char *args, int from_tty)
     error (_("Unable to open file '%s' for saving tracepoints (%s)"),
           args, safe_strerror (errno));
   make_cleanup_ui_file_delete (fp);
-  
+
+  save_trace_state_variables (fp);
+
   ALL_TRACEPOINTS (tp)
   {
+    if (tp->type == bp_fast_tracepoint)
+      fprintf_unfiltered (fp, "ftrace");
+    else
+      fprintf_unfiltered (fp, "trace");
+
     if (tp->addr_string)
-      fprintf_unfiltered (fp, "trace %s\n", tp->addr_string);
+      fprintf_unfiltered (fp, " %s", tp->addr_string);
     else
       {
        sprintf_vma (tmp, tp->loc->address);
-       fprintf_unfiltered (fp, "trace *0x%s\n", tmp);
+       fprintf_unfiltered (fp, " *0x%s", tmp);
       }
 
+    if (tp->cond_string)
+      fprintf_unfiltered (fp, " if %s", tp->cond_string);
+
+    fprintf_unfiltered (fp, "\n");
+
     if (tp->pass_count)
       fprintf_unfiltered (fp, "  passcount %d\n", tp->pass_count);
 
@@ -10682,6 +10694,10 @@ tracepoint_save_command (char *args, int from_tty)
        fprintf_unfiltered (fp, "  end\n");
       }
   }
+
+  if (*default_collect)
+    fprintf_unfiltered (fp, "set default-collect %s\n", default_collect);
+
   do_cleanups (cleanup);
   if (from_tty)
     printf_filtered (_("Tracepoints saved to file '%s'.\n"), args);
index e0e2ffe..04c5e79 100644 (file)
@@ -1,3 +1,9 @@
+2010-03-31  Stan Shebs  <stan@codesourcery.com>
+
+       * gdb.trace/save-trace.exp: Test save/restore of default-collect
+       and tracepoint conditionals.
+       (gdb_verify_tracepoints): Delete unused return.
+
 2010-03-26  Keith Seitz  <keiths@redhat.com>
 
        * gdb.java/jmisc.exp (ptype jmisc): Allow the constructor to
index 0a20b12..87f76ab 100644 (file)
@@ -73,6 +73,10 @@ foreach x { 1 2 3 4 5 6 } {
             "Setting tracepoint $trcpt.* to $x" \
             "10.x: set passcount for tracepoint $trcpt"
 
+    gdb_test "condition $trcpt $x - 1 == $x / 2" \
+            "" \
+            "10.x: set condition for tracepoint $trcpt"
+
     gdb_trace_setactions "10.x: set actions for tracepoint $x" \
            "" \
            "collect q$x" "^$" \
@@ -81,6 +85,9 @@ foreach x { 1 2 3 4 5 6 } {
            "end" "^$"
 }
 
+gdb_test "set default-collect gdb_char_test, gdb_long_test - 100" \
+    "" \
+    "10: set default-collect"
 
 proc gdb_verify_tracepoints { testname } {
     global gdb_prompt;
@@ -91,7 +98,7 @@ proc gdb_verify_tracepoints { testname } {
     set result "pass";
     send_gdb "info tracepoints\n";
     gdb_expect 10 {
-       -re "\[0-9\]+\[\t \]+tracepoint\[\t \]+keep y\[\t \]+0x\[0-9a-fA-F\]+ in gdb_recursion_test\[^\r\n\]+" {
+       -re "\[0-9\]+\[\t \]+tracepoint\[\t \]+keep y\[\t \]+0x\[0-9a-fA-F\]+ in gdb_recursion_test\[^\r\n\]+\r\n\[ \t]+trace only if \[0-9\] - 1 == \[0-9\] / 2" {
 #          if { $expect_out(1,string) != $ourstate } {
 #              set result "fail";
 #          }
@@ -110,7 +117,10 @@ proc gdb_verify_tracepoints { testname } {
        }
     }
     $result $testname;
-    return $result;
+
+    gdb_test "show default-collect" \
+       "The list of expressions to collect by default is \"gdb_char_test, gdb_long_test - 100\"..*" \
+       "10: show default-collect"
 }
 
 gdb_verify_tracepoints "10.x: verify trace setup";
index ae0e040..acba11f 100644 (file)
@@ -479,6 +479,23 @@ tvariables_info (char *args, int from_tty)
   tvariables_info_1 ();
 }
 
+/* Stash definitions of tsvs into the given file.  */
+
+void
+save_trace_state_variables (struct ui_file *fp)
+{
+  struct trace_state_variable *tsv;
+  int ix;
+
+  for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
+    {
+      fprintf_unfiltered (fp, "tvariable $%s", tsv->name);
+      if (tsv->initial_value)
+       fprintf_unfiltered (fp, " = %s", plongest (tsv->initial_value));
+      fprintf_unfiltered (fp, "\n");
+    }
+}
+
 /* ACTIONS functions: */
 
 /* The three functions:
index 578ae6b..ba9ae81 100644 (file)
@@ -207,6 +207,7 @@ extern void stop_tracing (void);
 extern void trace_status_mi (int on_stop);
 
 extern void tvariables_info_1 (void);
+extern void save_trace_state_variables (struct ui_file *fp);
 
 extern void tfind_1 (enum trace_find_type type, int num,
                     ULONGEST addr1, ULONGEST addr2,