From: Stan Shebs <stan@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Don't trace if all tracepoints disabled
Date: Fri, 26 Mar 2010 20:53:00 -0000 [thread overview]
Message-ID: <4BAD1ED2.5090501@codesourcery.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
This patch simply requires that there be at least one enabled tracepoint
before a trace run will start. While it's not necessarily wrong to have
a tracepoint-less trace run, this could save a user or two from massive
puzzlement as to why there are no trace frames accumulating. :-) While
this seems uncontroversial, I'm going to hold off commit to allow comments.
Stan
2010-03-26 Stan Shebs <stan@codesourcery.com>
* tracepoint.c (start_tracing): Check tracepoints before sending
commands to target, don't start if all tracepoints disabled.
[-- Attachment #2: tstartdis-patch-1 --]
[-- Type: text/plain, Size: 2218 bytes --]
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.159
diff -p -r1.159 tracepoint.c
*** tracepoint.c 26 Mar 2010 15:26:29 -0000 1.159
--- tracepoint.c 26 Mar 2010 20:46:05 -0000
*************** start_tracing (void)
*** 1449,1472 ****
int ix;
struct breakpoint *t;
struct trace_state_variable *tsv;
! int any_downloaded = 0;
!
! target_trace_init ();
tp_vec = all_tracepoints ();
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)
{
--- 1449,1491 ----
int ix;
struct breakpoint *t;
struct trace_state_variable *tsv;
! 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;
}
VEC_free (breakpoint_p, tp_vec);
!
/* Send down all the trace state variables too. */
for (ix = 0; VEC_iterate (tsv_s, tvariables, ix, tsv); ++ix)
{
next reply other threads:[~2010-03-26 20:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-26 20:53 Stan Shebs [this message]
2010-03-26 23:56 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BAD1ED2.5090501@codesourcery.com \
--to=stan@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox