2010-03-17 Stan Shebs <stan@codesourcery.com>
authorStan Shebs <shebs@codesourcery.com>
Thu, 18 Mar 2010 01:09:26 +0000 (01:09 +0000)
committerStan Shebs <shebs@codesourcery.com>
Thu, 18 Mar 2010 01:09:26 +0000 (01:09 +0000)
* infcall.c: Include tracepoint.h.
(call_function_by_hand): Disallow calls in tfind mode.
* infcmd.c: Include tracepoint.h.
(ensure_not_tfind_mode): New function.
(continue_1): Call it.
(step_1) Ditto.
(jump_command): Ditto.
(signal_command): Ditto.
(advance_command): Ditto.
(until_command): Ditto.
(finish_command): Ditto.
* tracepoint.h (disconnect_or_stop_tracing): Declare.

gdb/ChangeLog
gdb/infcall.c
gdb/infcmd.c
gdb/tracepoint.h

index af86e48..2b5e242 100644 (file)
@@ -1,5 +1,18 @@
 2010-03-17 Stan Shebs  <stan@codesourcery.com>
 
+       * infcall.c: Include tracepoint.h.
+       (call_function_by_hand): Disallow calls in tfind mode.
+       * infcmd.c: Include tracepoint.h.
+       (ensure_not_tfind_mode): New function.
+       (continue_1): Call it.
+       (step_1) Ditto.
+       (jump_command): Ditto.
+       (signal_command): Ditto.
+       (advance_command): Ditto.
+       (until_command): Ditto.
+       (finish_command): Ditto.
+       * tracepoint.h (disconnect_or_stop_tracing): Declare.
+
        * ax-gdb.h (struct axs_value): New field optimized_out.
        (gen_trace_for_var): Add gdbarch argument.
        * ax-gdb.c (gen_trace_static_fields): New function.
index 2d8bd2c..d6a8de3 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "defs.h"
 #include "breakpoint.h"
+#include "tracepoint.h"
 #include "target.h"
 #include "regcache.h"
 #include "inferior.h"
@@ -453,6 +454,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
   if (!target_has_execution)
     noprocess ();
 
+  if (get_traceframe_number () >= 0)
+    error (_("May not call functions while looking at trace frames."));
+
   frame = get_current_frame ();
   gdbarch = get_frame_arch (frame);
 
index 29cf427..8cc516d 100644 (file)
@@ -54,8 +54,7 @@
 #include "gdbthread.h"
 #include "valprint.h"
 #include "inline-frame.h"
-
-extern void disconnect_or_stop_tracing (int from_tty);
+#include "tracepoint.h"
 
 /* Functions exported for general use, in inferior.h: */
 
@@ -648,10 +647,23 @@ ensure_valid_thread (void)
 Cannot execute this command without a live selected thread."));
 }
 
+/* If the user is looking at trace frames, any resumption of execution
+   is likely to mix up recorded and live target data. So simply
+   disallow those commands.  */
+
+void
+ensure_not_tfind_mode (void)
+{
+  if (get_traceframe_number () >= 0)
+    error (_("\
+Cannot execute this command while looking at trace frames."));
+}
+
 void
 continue_1 (int all_threads)
 {
   ERROR_NO_INFERIOR;
+  ensure_not_tfind_mode ();
 
   if (non_stop && all_threads)
     {
@@ -825,6 +837,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
   int thread = -1;
 
   ERROR_NO_INFERIOR;
+  ensure_not_tfind_mode ();
   ensure_valid_thread ();
   ensure_not_running ();
 
@@ -1046,6 +1059,7 @@ jump_command (char *arg, int from_tty)
   int async_exec = 0;
 
   ERROR_NO_INFERIOR;
+  ensure_not_tfind_mode ();
   ensure_valid_thread ();
   ensure_not_running ();
 
@@ -1148,6 +1162,7 @@ signal_command (char *signum_exp, int from_tty)
 
   dont_repeat ();              /* Too dangerous.  */
   ERROR_NO_INFERIOR;
+  ensure_not_tfind_mode ();
   ensure_valid_thread ();
   ensure_not_running ();
 
@@ -1262,6 +1277,8 @@ until_command (char *arg, int from_tty)
   if (!target_has_execution)
     error (_("The program is not running."));
 
+  ensure_not_tfind_mode ();
+
   /* Find out whether we must run in the background. */
   if (arg != NULL)
     async_exec = strip_bg_char (&arg);
@@ -1293,6 +1310,8 @@ advance_command (char *arg, int from_tty)
   if (!target_has_execution)
     error (_("The program is not running."));
 
+  ensure_not_tfind_mode ();
+
   if (arg == NULL)
     error_no_arg (_("a location"));
 
@@ -1546,6 +1565,8 @@ finish_command (char *arg, int from_tty)
 
   int async_exec = 0;
 
+  ensure_not_tfind_mode ();
+
   /* Find out whether we must run in the background.  */
   if (arg != NULL)
     async_exec = strip_bg_char (&arg);
index 819a67a..c273f25 100644 (file)
@@ -162,4 +162,6 @@ extern struct breakpoint *create_tracepoint_from_upload (struct uploaded_tp *utp
 extern void merge_uploaded_tracepoints (struct uploaded_tp **utpp);
 extern void merge_uploaded_trace_state_variables (struct uploaded_tsv **utsvp);
 
+extern void disconnect_or_stop_tracing (int from_tty);
+
 #endif /* TRACEPOINT_H */