aboutsummaryrefslogtreecommitdiff
path: root/gdb/tracepoint.c
diff options
context:
space:
mode:
authorStan Shebs <shebs@codesourcery.com>2010-03-29 17:41:38 +0000
committerStan Shebs <shebs@codesourcery.com>2010-03-29 17:41:38 +0000
commit76a2b9588c3dd301f12d5e7d071c3a0dc11047c0 (patch)
tree4b52b245eab9ca1c4ead0a2fbede7af7ab8f6030 /gdb/tracepoint.c
parenta8121990c1dc9e6c91bc469f4bc387b0db50c6ae (diff)
downloadgdb-76a2b9588c3dd301f12d5e7d071c3a0dc11047c0.zip
gdb-76a2b9588c3dd301f12d5e7d071c3a0dc11047c0.tar.gz
gdb-76a2b9588c3dd301f12d5e7d071c3a0dc11047c0.tar.bz2
2010-03-29 Stan Shebs <stan@codesourcery.com>
* tracepoint.c (start_tracing): Check tracepoints before sending commands to target, don't start if all tracepoints disabled.
Diffstat (limited to 'gdb/tracepoint.c')
-rw-r--r--gdb/tracepoint.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index daa2161..498c18e 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1449,24 +1449,43 @@ start_tracing (void)
int ix;
struct breakpoint *t;
struct trace_state_variable *tsv;
- int any_downloaded = 0;
-
- target_trace_init ();
+ int any_enabled = 0;
tp_vec = all_tracepoints ();
+
+ /* No point in tracing without any tracepoints... */
+ if (VEC_length (breakpoint_p, tp_vec) == 0)
+ {
+ VEC_free (breakpoint_p, tp_vec);
+ error (_("No tracepoints defined, not starting trace"));
+ }
+
+ for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
+ {
+ if (t->enable_state == bp_enabled)
+ {
+ any_enabled = 1;
+ break;
+ }
+ }
+
+ /* No point in tracing with only disabled tracepoints. */
+ if (!any_enabled)
+ {
+ VEC_free (breakpoint_p, tp_vec);
+ error (_("No tracepoints enabled, not starting trace"));
+ }
+
+ target_trace_init ();
+
for (ix = 0; VEC_iterate (breakpoint_p, tp_vec, ix, t); ix++)
{
t->number_on_target = 0;
target_download_tracepoint (t);
t->number_on_target = t->number;
- any_downloaded = 1;
}
VEC_free (breakpoint_p, tp_vec);
-
- /* No point in tracing without any tracepoints... */
- if (!any_downloaded)
- error ("No tracepoints downloaded, not starting trace");
-
+
/* Send down all the trace state variables too. */
for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
{