4 #include "tracepoint.h"
6 struct trace_file_writer
;
8 /* Operations to write trace frames to a specific trace format. */
10 struct trace_frame_write_ops
12 /* Write a new trace frame. The tracepoint number of this trace
14 void (*start
) (struct trace_file_writer
*self
, uint16_t tpnum
);
16 /* Write an 'R' block. Buffer BUF contains its contents and SIZE is
18 void (*write_r_block
) (struct trace_file_writer
*self
,
19 gdb_byte
*buf
, int32_t size
);
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'
37 void (*write_m_block_memory
) (struct trace_file_writer
*self
,
38 gdb_byte
*buf
, uint16_t length
);
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
,
45 /* The end of the trace frame. */
46 void (*end
) (struct trace_file_writer
*self
);
49 /* Operations to write trace buffers to a specific trace format. */
51 struct trace_file_write_ops
53 /* Destructor. Releases everything from SELF (but not SELF
55 void (*dtor
) (struct trace_file_writer
*self
);
57 /* Save the data to file or directory NAME of desired format in
58 target side. Return true for success, otherwise return
60 int (*target_save
) (struct trace_file_writer
*self
,
63 /* Write the trace buffers to file or directory NAME. */
64 void (*start
) (struct trace_file_writer
*self
,
67 /* Write the trace header. */
68 void (*write_header
) (struct trace_file_writer
*self
);
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
,
75 /* Write trace status TS. */
76 void (*write_status
) (struct trace_file_writer
*self
,
77 struct trace_status
*ts
);
79 /* Write the uploaded TSV. */
80 void (*write_uploaded_tsv
) (struct trace_file_writer
*self
,
81 struct uploaded_tsv
*tsv
);
83 /* Write the uploaded tracepoint TP. */
84 void (*write_uploaded_tp
) (struct trace_file_writer
*self
,
85 struct uploaded_tp
*tp
);
87 /* Write target description. */
88 void (*write_tdesc
) (struct trace_file_writer
*self
);
90 /* Write to mark the end of the definition part. */
91 void (*write_definition_end
) (struct trace_file_writer
*self
);
93 /* Write the data of trace buffer without parsing. The content is
94 in BUF and length is LEN. */
95 void (*write_trace_buffer
) (struct trace_file_writer
*self
,
96 gdb_byte
*buf
, LONGEST len
);
98 /* Operations to write trace frames. The user of this field is
99 responsible to parse the data of trace buffer. Either field
100 'write_trace_buffer' or field ' frame_ops' is NULL. */
101 const struct trace_frame_write_ops
*frame_ops
;
103 /* The end of writing trace buffers. */
104 void (*end
) (struct trace_file_writer
*self
);
107 /* Trace file writer for a given format. */
109 struct trace_file_writer
111 const struct trace_file_write_ops
*ops
;
114 extern struct trace_file_writer
*tfile_trace_file_writer_new (void);
116 extern void init_tracefile_ops (struct target_ops
*ops
);
118 extern void tracefile_fetch_registers (struct regcache
*regcache
, int regno
);
120 #endif /* TRACEFILE_H */