From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15865 invoked by alias); 26 Mar 2010 20:53:51 -0000 Received: (qmail 15854 invoked by uid 22791); 26 Mar 2010 20:53:50 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Mar 2010 20:53:45 +0000 Received: (qmail 23308 invoked from network); 26 Mar 2010 20:53:43 -0000 Received: from unknown (HELO macbook-2.local) (stan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 26 Mar 2010 20:53:43 -0000 Message-ID: <4BAD1ED2.5090501@codesourcery.com> Date: Fri, 26 Mar 2010 20:53:00 -0000 From: Stan Shebs User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [PATCH] Don't trace if all tracepoints disabled Content-Type: multipart/mixed; boundary="------------020605030001040901030606" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00918.txt.bz2 This is a multi-part message in MIME format. --------------020605030001040901030606 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 561 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 * tracepoint.c (start_tracing): Check tracepoints before sending commands to target, don't start if all tracepoints disabled. --------------020605030001040901030606 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="tstartdis-patch-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="tstartdis-patch-1" Content-length: 2218 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) { --------------020605030001040901030606--