Let tracefile has_memory and has_all_memory.
authorYao Qi <yao@codesourcery.com>
Mon, 10 Feb 2014 07:28:33 +0000 (15:28 +0800)
committerYao Qi <yao@codesourcery.com>
Sun, 23 Feb 2014 03:44:27 +0000 (11:44 +0800)
At present, tfile target thinks it has memory but ctf doesn't.
This is an oversight when I added ctf target support.  This patch
moves the implementations of to_has_all_memory and to_has_memory to
upper layer.  After this change, both tfile and ctf target think
they have memory.

gdb:

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

* tracefile-tfile.c (tfile_has_all_memory): Remove.
(tfile_has_memory): Remove.
(init_tfile_ops): Don't set fields to_has_all_memory and
to_has_memory of tfile_ops.
* tracefile.c (tracefile_has_all_memory): New function.
(tracefile_has_memory): New function.
(init_tracefile_ops): Initialize fields to_has_all_memory and
to_has_memory of 'ops'.

gdb/ChangeLog
gdb/tracefile-tfile.c
gdb/tracefile.c

index a5f4710..d7c3310 100644 (file)
@@ -1,5 +1,16 @@
 2014-02-23  Yao Qi  <yao@codesourcery.com>
 
+       * tracefile-tfile.c (tfile_has_all_memory): Remove.
+       (tfile_has_memory): Remove.
+       (init_tfile_ops): Don't set fields to_has_all_memory and
+       to_has_memory of tfile_ops.
+       * tracefile.c (tracefile_has_all_memory): New function.
+       (tracefile_has_memory): New function.
+       (init_tracefile_ops): Initialize fields to_has_all_memory and
+       to_has_memory of 'ops'.
+
+2014-02-23  Yao Qi  <yao@codesourcery.com>
+
        * ctf.c (ctf_has_stack, ctf_has_registers): Remove.
        (ctf_thread_alive, ctf_get_trace_status): Remove.
        (init_ctf_ops): Don't set some fields of ctf_ops.  Call
index 2daa560..3ef109e 100644 (file)
@@ -1012,18 +1012,6 @@ tfile_get_trace_state_variable_value (struct target_ops *self,
   return found;
 }
 
-static int
-tfile_has_all_memory (struct target_ops *ops)
-{
-  return 1;
-}
-
-static int
-tfile_has_memory (struct target_ops *ops)
-{
-  return 1;
-}
-
 /* Callback for traceframe_walk_blocks.  Builds a traceframe_info
    object for the tfile target's current traceframe.  */
 
@@ -1105,8 +1093,6 @@ init_tfile_ops (void)
   tfile_ops.to_trace_find = tfile_trace_find;
   tfile_ops.to_get_trace_state_variable_value
     = tfile_get_trace_state_variable_value;
-  tfile_ops.to_has_all_memory = tfile_has_all_memory;
-  tfile_ops.to_has_memory = tfile_has_memory;
   tfile_ops.to_traceframe_info = tfile_traceframe_info;
 }
 
index 7972290..508f898 100644 (file)
@@ -376,6 +376,22 @@ trace_save_ctf (const char *dirname, int target_does_save)
   do_cleanups (back_to);
 }
 
+/* This is the implementation of target_ops method to_has_all_memory.  */
+
+static int
+tracefile_has_all_memory (struct target_ops *ops)
+{
+  return 1;
+}
+
+/* This is the implementation of target_ops method to_has_memory.  */
+
+static int
+tracefile_has_memory (struct target_ops *ops)
+{
+  return 1;
+}
+
 /* This is the implementation of target_ops method to_has_stack.
    The target has a stack when GDB has already selected one trace
    frame.  */
@@ -424,6 +440,8 @@ init_tracefile_ops (struct target_ops *ops)
 {
   ops->to_stratum = process_stratum;
   ops->to_get_trace_status = tracefile_get_trace_status;
+  ops->to_has_all_memory = tracefile_has_all_memory;
+  ops->to_has_memory = tracefile_has_memory;
   ops->to_has_stack = tracefile_has_stack;
   ops->to_has_registers = tracefile_has_registers;
   ops->to_thread_alive = tracefile_thread_alive;