diff options
author | Stan Shebs <shebs@codesourcery.com> | 2010-03-31 17:59:49 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 2010-03-31 17:59:49 +0000 |
commit | 8bf6485c1cee41f31564e1097199ff67a3615ebe (patch) | |
tree | b7579caf3a6e8a889331ba48e7b6bfcb9acc1d29 | |
parent | f3c8116cd2e02ccb2bd1bfc131554027b2efe190 (diff) | |
download | gdb-8bf6485c1cee41f31564e1097199ff67a3615ebe.zip gdb-8bf6485c1cee41f31564e1097199ff67a3615ebe.tar.gz gdb-8bf6485c1cee41f31564e1097199ff67a3615ebe.tar.bz2 |
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.
* gdb.trace/save-trace.exp: Test save/restore of default-collect
and tracepoint conditionals.
(gdb_verify_tracepoints): Delete unused return.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/breakpoint.c | 22 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.trace/save-trace.exp | 14 | ||||
-rw-r--r-- | gdb/tracepoint.c | 17 | ||||
-rw-r--r-- | gdb/tracepoint.h | 1 |
6 files changed, 62 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 00092e8b..7d5c47e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 2bded96..dfd93f8 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e0e2ffe..04c5e79 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -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 diff --git a/gdb/testsuite/gdb.trace/save-trace.exp b/gdb/testsuite/gdb.trace/save-trace.exp index 0a20b12..87f76ab 100644 --- a/gdb/testsuite/gdb.trace/save-trace.exp +++ b/gdb/testsuite/gdb.trace/save-trace.exp @@ -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"; diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index ae0e040..acba11f 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -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: diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h index 578ae6b7..ba9ae81 100644 --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h @@ -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, |