This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Handle double tstart and tstop
- From: Stan Shebs <stan at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 31 Mar 2010 12:38:12 -0700
- Subject: [PATCH] Handle double tstart and tstop
This patch makes tstart and tstop a little more informative in the cases
of starting when something is running already, or stopping when nothing
is running. It seems fairly obvious, but as a user behavior change, I
invite feedback before committing.
This patch does not change the normal behavior of tstart/tstop, which is
to say nothing. If there is sufficient popular demand, I'll add
normal-behavior start and stop messages, a la run or attach.
Stan
2010-03-31 Stan Shebs <stan@codesourcery.com>
* tracepoint.c (trace_start_command): Confirm if trace is running.
(trace_stop_command): Error if trace not running.
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.165
diff -p -r1.165 tracepoint.c
*** tracepoint.c 31 Mar 2010 17:59:48 -0000 1.165
--- tracepoint.c 31 Mar 2010 19:24:45 -0000
*************** trace_start_command (char *args, int fro
*** 1538,1543 ****
--- 1538,1550 ----
{
dont_repeat (); /* Like "run", dangerous to repeat accidentally. */
+ if (current_trace_status ()->running)
+ {
+ if (from_tty
+ && !query (_("A trace is running already. Start a new run? ")))
+ error (_("New trace run not started."));
+ }
+
start_tracing ();
}
*************** trace_start_command (char *args, int fro
*** 1545,1550 ****
--- 1552,1560 ----
static void
trace_stop_command (char *args, int from_tty)
{
+ if (!current_trace_status ()->running)
+ error (_("Trace is not running."));
+
stop_tracing ();
}