diff options
author | Yao Qi <yao@codesourcery.com> | 2014-02-10 15:22:55 +0800 |
---|---|---|
committer | Yao Qi <yao@codesourcery.com> | 2014-02-23 11:44:26 +0800 |
commit | 12e03cd06ada8ca7e62fa52aa84946256c1bc654 (patch) | |
tree | ca9fbe72a206a1312185655f2e706914938cef7e /gdb/tracefile-tfile.c | |
parent | 11395323794268a9945dd31eb46905e975d87b3d (diff) | |
download | gdb-12e03cd06ada8ca7e62fa52aa84946256c1bc654.zip gdb-12e03cd06ada8ca7e62fa52aa84946256c1bc654.tar.gz gdb-12e03cd06ada8ca7e62fa52aa84946256c1bc654.tar.bz2 |
Share some code between ctf and tfile target.
This patch move the duplicated code between tfile and ctf
targets into file tracefile.c. The common part of target_ops
fields are set in init_tracefile_ops.
gdb:
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
init_tracefile_ops.
* tracefile-tfile.c (tfile_get_trace_status): Remove.
(tfile_has_stack, tfile_has_registers): Remove.
(tfile_thread_alive): Remove.
(init_tfile_ops): Don't set some fields of tfile_ops. Call
init_tracefile_ops.
* tracefile.c (tracefile_has_stack): New function.
(tracefile_has_registers): New function.
(tracefile_thread_alive): New function.
(tracefile_get_trace_status): New function.
(init_tracefile_ops): New function.
* tracefile.h (init_tracefile_ops): Declare.
Diffstat (limited to 'gdb/tracefile-tfile.c')
-rw-r--r-- | gdb/tracefile-tfile.c | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 0f4aa93..2daa560 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -561,17 +561,6 @@ tfile_files_info (struct target_ops *t) printf_filtered ("\t`%s'\n", trace_filename); } -/* The trace status for a file is that tracing can never be run. */ - -static int -tfile_get_trace_status (struct target_ops *self, struct trace_status *ts) -{ - /* Other bits of trace status were collected as part of opening the - trace files, so nothing to do here. */ - - return -1; -} - static void tfile_get_tracepoint_status (struct target_ops *self, struct breakpoint *tp, struct uploaded_tp *utp) @@ -1035,24 +1024,6 @@ tfile_has_memory (struct target_ops *ops) return 1; } -static int -tfile_has_stack (struct target_ops *ops) -{ - return get_traceframe_number () != -1; -} - -static int -tfile_has_registers (struct target_ops *ops) -{ - return get_traceframe_number () != -1; -} - -static int -tfile_thread_alive (struct target_ops *ops, ptid_t ptid) -{ - return 1; -} - /* Callback for traceframe_walk_blocks. Builds a traceframe_info object for the tfile target's current traceframe. */ @@ -1119,6 +1090,8 @@ tfile_traceframe_info (struct target_ops *self) static void init_tfile_ops (void) { + init_tracefile_ops (&tfile_ops); + tfile_ops.to_shortname = "tfile"; tfile_ops.to_longname = "Local trace dump file"; tfile_ops.to_doc @@ -1128,19 +1101,13 @@ init_tfile_ops (void) tfile_ops.to_fetch_registers = tfile_fetch_registers; tfile_ops.to_xfer_partial = tfile_xfer_partial; tfile_ops.to_files_info = tfile_files_info; - tfile_ops.to_get_trace_status = tfile_get_trace_status; tfile_ops.to_get_tracepoint_status = tfile_get_tracepoint_status; 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_stratum = process_stratum; tfile_ops.to_has_all_memory = tfile_has_all_memory; tfile_ops.to_has_memory = tfile_has_memory; - tfile_ops.to_has_stack = tfile_has_stack; - tfile_ops.to_has_registers = tfile_has_registers; tfile_ops.to_traceframe_info = tfile_traceframe_info; - tfile_ops.to_thread_alive = tfile_thread_alive; - tfile_ops.to_magic = OPS_MAGIC; } extern initialize_file_ftype _initialize_tracefile_tfile; |