This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] Reset trace local state when opening trace file


This patch is to reset the GDB local trace state in ctf_open and
tfile_open, say, when opening trace file.  This patch fixes the
fails mentioned in patch 1/2.

The whole series are tested on x86-linux with both native and
gdbserver.

gdb:

2013-05-28  Yao Qi  <yao@codesourcery.com>

	* ctf.c (ctf_open): Call trace_reset_local_state.
	* tracepoint.c (start_tracing): Move some code to ...
	(trace_reset_local_state): ... here.  New.
	(tfile_open): Call trace_reset_local_state.
	* tracepoint.h (trace_reset_local_state): Declare.
---
 gdb/ctf.c        |    2 ++
 gdb/tracepoint.c |   17 +++++++++++++----
 gdb/tracepoint.h |    1 +
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/gdb/ctf.c b/gdb/ctf.c
index 13df089..c99d26d 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1201,6 +1201,8 @@ ctf_open (char *dirname, int from_tty)
 
   merge_uploaded_trace_state_variables (&uploaded_tsvs);
   merge_uploaded_tracepoints (&uploaded_tps);
+
+  trace_reset_local_state ();
 }
 
 /* This is the implementation of target_ops method to_close.  Destroy
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index ba59ab0..998483e 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1720,6 +1720,16 @@ process_tracepoint_on_disconnect (void)
 	       " GDB is disconnected\n"));
 }
 
+/* Reset local state of tracing.  */
+
+void
+trace_reset_local_state (void)
+{
+  set_traceframe_num (-1);
+  set_tracepoint_num (-1);
+  set_traceframe_context (NULL);
+  clear_traceframe_info ();
+}
 
 void
 start_tracing (char *notes)
@@ -1842,11 +1852,8 @@ start_tracing (char *notes)
   target_trace_start ();
 
   /* Reset our local state.  */
-  set_traceframe_num (-1);
-  set_tracepoint_num (-1);
-  set_traceframe_context (NULL);
+  trace_reset_local_state ();
   current_trace_status()->running = 1;
-  clear_traceframe_info ();
 }
 
 /* The tstart command requests the target to start a new trace run.
@@ -4282,6 +4289,8 @@ tfile_open (char *filename, int from_tty)
   merge_uploaded_trace_state_variables (&uploaded_tsvs);
 
   merge_uploaded_tracepoints (&uploaded_tps);
+
+  trace_reset_local_state ();
 }
 
 /* Interpret the given line from the definitions part of the trace
diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h
index 18762ca..7a60ef2 100644
--- a/gdb/tracepoint.h
+++ b/gdb/tracepoint.h
@@ -389,6 +389,7 @@ extern void merge_uploaded_trace_state_variables (struct uploaded_tsv **utsvp);
 
 extern void query_if_trace_running (int from_tty);
 extern void disconnect_tracing (void);
+extern void trace_reset_local_state (void);
 
 extern void start_tracing (char *notes);
 extern void stop_tracing (char *notes);
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]