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 8/8] Call target_traceframe_info when traceframe is selected.


As we migrate to the new to_xfer_partial interface, some of previous
tweaks become unnecessary, first, we can check whether traceframe is
selected before call target_traceframe_info.  Then, we don't have to
check traceframe is selected in each target implementation, so this
patch below is reverted.

  [PATCH] Send qXfer:traceframe-info:read when traceframe is selected.
  https://sourceware.org/ml/gdb-patches/2013-10/msg00752.html

Third, to_traceframe_info is only called when traceframe is selected,
that means it is only called when target is remote, tfile or ctf, so
this patch can be partially reverted,

  https://sourceware.org/ml/gdb-patches/2013-04/msg00000.html

gdb:

2014-02-12  Yao Qi  <yao@codesourcery.com>

	* tracepoint.c (get_traceframe_info): Call
	target_traceframe_info if traceframe is selected.

	Revert two patches:

	2013-10-25  Yao Qi  <yao@codesourcery.com>

	* remote.c (remote_traceframe_info): Return early if
	traceframe is not selected.

	2013-07-19  Yao Qi  <yao@codesourcery.com>

	* target.c (update_current_target): Change the default action
	of 'to_traceframe_info' from tcomplain to return_zero.
	* target.h (struct target_ops) <to_traceframe_info>: Add more
	comments.
---
 gdb/remote.c     |    5 -----
 gdb/target.c     |    2 +-
 gdb/target.h     |   15 +++------------
 gdb/tracepoint.c |    2 +-
 4 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index eff4c44..4504512 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -11241,11 +11241,6 @@ remote_traceframe_info (void)
 {
   char *text;
 
-  /* If current traceframe is not selected, don't bother the remote
-     stub.  */
-  if (get_traceframe_number () < 0)
-    return NULL;
-
   text = target_read_stralloc (&current_target,
 			       TARGET_OBJECT_TRACEFRAME_INFO, NULL);
   if (text != NULL)
diff --git a/gdb/target.c b/gdb/target.c
index f08dad0..0c19c5a 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -917,7 +917,7 @@ update_current_target (void)
 	    tcomplain);
   de_fault (to_traceframe_info,
 	    (struct traceframe_info * (*) (void))
-	    return_null);
+	    tcomplain);
   de_fault (to_supports_evaluation_of_breakpoint_conditions,
 	    (int (*) (void))
 	    return_zero);
diff --git a/gdb/target.h b/gdb/target.h
index 9fa56f2..5d1955b 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -815,18 +815,9 @@ struct target_ops
       (const char *id);
 
     /* Return a traceframe info object describing the current
-       traceframe's contents.  If the target doesn't support
-       traceframe info, return NULL.  If the current traceframe is not
-       selected (the current traceframe number is -1), the target can
-       choose to return either NULL or an empty traceframe info.  If
-       NULL is returned, for example in remote target, GDB will read
-       from the live inferior.  If an empty traceframe info is
-       returned, for example in tfile target, which means the
-       traceframe info is available, but the requested memory is not
-       available in it.  GDB will try to see if the requested memory
-       is available in the read-only sections.  This method should not
-       cache data; higher layers take care of caching, invalidating,
-       and re-fetching when necessary.  */
+       traceframe's contents.  This method should not cache data;
+       higher layers take care of caching, invalidating, and
+       re-fetching when necessary.  */
     struct traceframe_info *(*to_traceframe_info) (void);
 
     /* Ask the target to use or not to use agent according to USE.  Return 1
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index c1dcb1e..1132167 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4290,7 +4290,7 @@ parse_traceframe_info (const char *tframe_info)
 struct traceframe_info *
 get_traceframe_info (void)
 {
-  if (traceframe_info == NULL)
+  if (traceframe_info == NULL && get_traceframe_number () >= 0)
     traceframe_info = target_traceframe_info ();
 
   return traceframe_info;
-- 
1.7.7.6


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