Fix setting breakpoints or stepping on line 65535
[deliverable/binutils-gdb.git] / gdb / tracefile.h
CommitLineData
7951c4eb
YQ
1#ifndef TRACEFILE_H
2#define TRACEFILE_H 1
3
7951c4eb 4#include "tracepoint.h"
f6ac5f3d 5#include "target.h"
3b3dac9b 6#include "process-stratum-target.h"
7951c4eb
YQ
7
8struct trace_file_writer;
9
10/* Operations to write trace frames to a specific trace format. */
11
12struct trace_frame_write_ops
13{
14 /* Write a new trace frame. The tracepoint number of this trace
15 frame is TPNUM. */
16 void (*start) (struct trace_file_writer *self, uint16_t tpnum);
17
18 /* Write an 'R' block. Buffer BUF contains its contents and SIZE is
19 its size. */
20 void (*write_r_block) (struct trace_file_writer *self,
21 gdb_byte *buf, int32_t size);
22
23 /* Write an 'M' block, the header and memory contents respectively.
24 The header of 'M' block is composed of the start address and the
25 length of memory collection, and the memory contents contain
26 the collected memory contents in tracing.
27 For extremely large M block, GDB is unable to get its contents
28 and write them into trace file in one go, due to the limitation
29 of the remote target or the size of internal buffer, we split
30 the operation to 'M' block to two operations. */
31 /* Write the head of 'M' block. ADDR is the start address of
32 collected memory and LENGTH is the length of memory contents. */
33 void (*write_m_block_header) (struct trace_file_writer *self,
34 uint64_t addr, uint16_t length);
35 /* Write the memory contents of 'M' block. Buffer BUF contains
36 its contents and LENGTH is its length. This method can be called
37 multiple times to write large memory contents of a single 'M'
38 block. */
39 void (*write_m_block_memory) (struct trace_file_writer *self,
40 gdb_byte *buf, uint16_t length);
41
42 /* Write a 'V' block. NUM is the trace variable number and VAL is
43 the value of the trace variable. */
44 void (*write_v_block) (struct trace_file_writer *self, int32_t num,
45 uint64_t val);
46
47 /* The end of the trace frame. */
48 void (*end) (struct trace_file_writer *self);
49};
50
51/* Operations to write trace buffers to a specific trace format. */
52
53struct trace_file_write_ops
54{
55 /* Destructor. Releases everything from SELF (but not SELF
56 itself). */
57 void (*dtor) (struct trace_file_writer *self);
58
59 /* Save the data to file or directory NAME of desired format in
60 target side. Return true for success, otherwise return
61 false. */
62 int (*target_save) (struct trace_file_writer *self,
63 const char *name);
64
65 /* Write the trace buffers to file or directory NAME. */
66 void (*start) (struct trace_file_writer *self,
67 const char *name);
68
69 /* Write the trace header. */
70 void (*write_header) (struct trace_file_writer *self);
71
72 /* Write the type of block about registers. SIZE is the size of
73 all registers on the target. */
74 void (*write_regblock_type) (struct trace_file_writer *self,
75 int size);
76
77 /* Write trace status TS. */
78 void (*write_status) (struct trace_file_writer *self,
79 struct trace_status *ts);
80
81 /* Write the uploaded TSV. */
82 void (*write_uploaded_tsv) (struct trace_file_writer *self,
83 struct uploaded_tsv *tsv);
84
85 /* Write the uploaded tracepoint TP. */
86 void (*write_uploaded_tp) (struct trace_file_writer *self,
87 struct uploaded_tp *tp);
88
18d3cec5
MK
89 /* Write target description. */
90 void (*write_tdesc) (struct trace_file_writer *self);
91
7951c4eb
YQ
92 /* Write to mark the end of the definition part. */
93 void (*write_definition_end) (struct trace_file_writer *self);
94
95 /* Write the data of trace buffer without parsing. The content is
96 in BUF and length is LEN. */
97 void (*write_trace_buffer) (struct trace_file_writer *self,
98 gdb_byte *buf, LONGEST len);
99
100 /* Operations to write trace frames. The user of this field is
101 responsible to parse the data of trace buffer. Either field
102 'write_trace_buffer' or field ' frame_ops' is NULL. */
103 const struct trace_frame_write_ops *frame_ops;
104
105 /* The end of writing trace buffers. */
106 void (*end) (struct trace_file_writer *self);
107};
108
109/* Trace file writer for a given format. */
110
111struct trace_file_writer
112{
113 const struct trace_file_write_ops *ops;
114};
115
116extern struct trace_file_writer *tfile_trace_file_writer_new (void);
117
f6ac5f3d
PA
118/* Base class for tracefile related targets. */
119
3b3dac9b 120class tracefile_target : public process_stratum_target
f6ac5f3d
PA
121{
122public:
3b3dac9b 123 tracefile_target () = default;
f6ac5f3d
PA
124
125 int get_trace_status (trace_status *ts) override;
57810aa7
PA
126 bool has_all_memory () override;
127 bool has_memory () override;
128 bool has_stack () override;
129 bool has_registers () override;
f3d11a9a 130 bool has_execution (ptid_t) override { return false; }
57810aa7 131 bool thread_alive (ptid_t ptid) override;
f6ac5f3d 132};
12e03cd0 133
48b6e87e
YQ
134extern void tracefile_fetch_registers (struct regcache *regcache, int regno);
135
7951c4eb 136#endif /* TRACEFILE_H */
This page took 0.684788 seconds and 4 git commands to generate.