GDB (xrefs)
/tmp/gdb-7.10/gdb/tracefile.h
Go to the documentation of this file.
1 #ifndef TRACEFILE_H
2 #define TRACEFILE_H 1
3 
4 #include "tracepoint.h"
5 
6 struct trace_file_writer;
7 
8 /* Operations to write trace frames to a specific trace format. */
9 
11 {
12  /* Write a new trace frame. The tracepoint number of this trace
13  frame is TPNUM. */
14  void (*start) (struct trace_file_writer *self, uint16_t tpnum);
15 
16  /* Write an 'R' block. Buffer BUF contains its contents and SIZE is
17  its size. */
18  void (*write_r_block) (struct trace_file_writer *self,
19  gdb_byte *buf, int32_t size);
20 
21  /* Write an 'M' block, the header and memory contents respectively.
22  The header of 'M' block is composed of the start address and the
23  length of memory collection, and the memory contents contain
24  the collected memory contents in tracing.
25  For extremely large M block, GDB is unable to get its contents
26  and write them into trace file in one go, due to the limitation
27  of the remote target or the size of internal buffer, we split
28  the operation to 'M' block to two operations. */
29  /* Write the head of 'M' block. ADDR is the start address of
30  collected memory and LENGTH is the length of memory contents. */
31  void (*write_m_block_header) (struct trace_file_writer *self,
32  uint64_t addr, uint16_t length);
33  /* Write the memory contents of 'M' block. Buffer BUF contains
34  its contents and LENGTH is its length. This method can be called
35  multiple times to write large memory contents of a single 'M'
36  block. */
37  void (*write_m_block_memory) (struct trace_file_writer *self,
38  gdb_byte *buf, uint16_t length);
39 
40  /* Write a 'V' block. NUM is the trace variable number and VAL is
41  the value of the trace variable. */
42  void (*write_v_block) (struct trace_file_writer *self, int32_t num,
43  uint64_t val);
44 
45  /* The end of the trace frame. */
46  void (*end) (struct trace_file_writer *self);
47 };
48 
49 /* Operations to write trace buffers to a specific trace format. */
50 
52 {
53  /* Destructor. Releases everything from SELF (but not SELF
54  itself). */
55  void (*dtor) (struct trace_file_writer *self);
56 
57  /* Save the data to file or directory NAME of desired format in
58  target side. Return true for success, otherwise return
59  false. */
60  int (*target_save) (struct trace_file_writer *self,
61  const char *name);
62 
63  /* Write the trace buffers to file or directory NAME. */
64  void (*start) (struct trace_file_writer *self,
65  const char *name);
66 
67  /* Write the trace header. */
68  void (*write_header) (struct trace_file_writer *self);
69 
70  /* Write the type of block about registers. SIZE is the size of
71  all registers on the target. */
72  void (*write_regblock_type) (struct trace_file_writer *self,
73  int size);
74 
75  /* Write trace status TS. */
76  void (*write_status) (struct trace_file_writer *self,
77  struct trace_status *ts);
78 
79  /* Write the uploaded TSV. */
80  void (*write_uploaded_tsv) (struct trace_file_writer *self,
81  struct uploaded_tsv *tsv);
82 
83  /* Write the uploaded tracepoint TP. */
84  void (*write_uploaded_tp) (struct trace_file_writer *self,
85  struct uploaded_tp *tp);
86 
87  /* Write to mark the end of the definition part. */
88  void (*write_definition_end) (struct trace_file_writer *self);
89 
90  /* Write the data of trace buffer without parsing. The content is
91  in BUF and length is LEN. */
92  void (*write_trace_buffer) (struct trace_file_writer *self,
93  gdb_byte *buf, LONGEST len);
94 
95  /* Operations to write trace frames. The user of this field is
96  responsible to parse the data of trace buffer. Either field
97  'write_trace_buffer' or field ' frame_ops' is NULL. */
99 
100  /* The end of writing trace buffers. */
101  void (*end) (struct trace_file_writer *self);
102 };
103 
104 /* Trace file writer for a given format. */
105 
107 {
108  const struct trace_file_write_ops *ops;
109 };
110 
111 extern struct trace_file_writer *tfile_trace_file_writer_new (void);
112 
113 extern void init_tracefile_ops (struct target_ops *ops);
114 
115 extern void tracefile_fetch_registers (struct regcache *regcache, int regno);
116 
117 #endif /* TRACEFILE_H */
void(* write_r_block)(struct trace_file_writer *self, gdb_byte *buf, int32_t size)
Definition: tracefile.h:18
void(* write_m_block_memory)(struct trace_file_writer *self, gdb_byte *buf, uint16_t length)
Definition: tracefile.h:37
void init_tracefile_ops(struct target_ops *ops)
Definition: tracefile.c:501
const struct trace_file_write_ops * ops
Definition: tracefile.h:108
void(* write_status)(struct trace_file_writer *self, struct trace_status *ts)
Definition: tracefile.h:76
struct trace_file_writer * tfile_trace_file_writer_new(void)
void(* start)(struct trace_file_writer *self, const char *name)
Definition: tracefile.h:64
void(* write_regblock_type)(struct trace_file_writer *self, int size)
Definition: tracefile.h:72
const struct trace_frame_write_ops * frame_ops
Definition: tracefile.h:98
const char *const name
Definition: aarch64-tdep.c:68
void(* end)(struct trace_file_writer *self)
Definition: tracefile.h:46
void(* write_uploaded_tsv)(struct trace_file_writer *self, struct uploaded_tsv *tsv)
Definition: tracefile.h:80
void(* write_v_block)(struct trace_file_writer *self, int32_t num, uint64_t val)
Definition: tracefile.h:42
const char const char int
Definition: command.h:229
bfd_byte gdb_byte
Definition: common-types.h:38
void(* write_header)(struct trace_file_writer *self)
Definition: tracefile.h:68
void(* dtor)(struct trace_file_writer *self)
Definition: tracefile.h:55
void(* write_definition_end)(struct trace_file_writer *self)
Definition: tracefile.h:88
void(* start)(struct trace_file_writer *self, uint16_t tpnum)
Definition: tracefile.h:14
void(* end)(struct trace_file_writer *self)
Definition: tracefile.h:101
void(* write_m_block_header)(struct trace_file_writer *self, uint64_t addr, uint16_t length)
Definition: tracefile.h:31
void(* write_uploaded_tp)(struct trace_file_writer *self, struct uploaded_tp *tp)
Definition: tracefile.h:84
void tracefile_fetch_registers(struct regcache *regcache, int regno)
Definition: tracefile.c:385
void(* write_trace_buffer)(struct trace_file_writer *self, gdb_byte *buf, LONGEST len)
Definition: tracefile.h:92
size_t size
Definition: go32-nat.c:242
int(* target_save)(struct trace_file_writer *self, const char *name)
Definition: tracefile.h:60
long long LONGEST
Definition: common-types.h:52
const ULONGEST const LONGEST len
Definition: target.h:309