]>
Commit | Line | Data |
---|---|---|
7951c4eb YQ |
1 | #ifndef TRACEFILE_H |
2 | #define TRACEFILE_H 1 | |
3 | ||
7951c4eb YQ |
4 | #include "tracepoint.h" |
5 | ||
6 | struct trace_file_writer; | |
7 | ||
8 | /* Operations to write trace frames to a specific trace format. */ | |
9 | ||
10 | struct trace_frame_write_ops | |
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 | ||
51 | struct trace_file_write_ops | |
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 | ||
18d3cec5 MK |
87 | /* Write target description. */ |
88 | void (*write_tdesc) (struct trace_file_writer *self); | |
89 | ||
7951c4eb YQ |
90 | /* Write to mark the end of the definition part. */ |
91 | void (*write_definition_end) (struct trace_file_writer *self); | |
92 | ||
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); | |
97 | ||
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; | |
102 | ||
103 | /* The end of writing trace buffers. */ | |
104 | void (*end) (struct trace_file_writer *self); | |
105 | }; | |
106 | ||
107 | /* Trace file writer for a given format. */ | |
108 | ||
109 | struct trace_file_writer | |
110 | { | |
111 | const struct trace_file_write_ops *ops; | |
112 | }; | |
113 | ||
114 | extern struct trace_file_writer *tfile_trace_file_writer_new (void); | |
115 | ||
12e03cd0 YQ |
116 | extern void init_tracefile_ops (struct target_ops *ops); |
117 | ||
48b6e87e YQ |
118 | extern void tracefile_fetch_registers (struct regcache *regcache, int regno); |
119 | ||
7951c4eb | 120 | #endif /* TRACEFILE_H */ |