GDB (xrefs)
Loading...
Searching...
No Matches
tracefile.h
Go to the documentation of this file.
1#ifndef TRACEFILE_H
2#define TRACEFILE_H 1
3
4#include "tracepoint.h"
5#include "target.h"
7
9
10/* Operations to write trace frames to a specific trace format. */
11
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. */
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. */
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
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. */
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. */
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
89 /* Write target description. */
90 void (*write_tdesc) (struct trace_file_writer *self);
91
92 /* Write to mark the end of the definition part. */
94
95 /* Write the data of trace buffer without parsing. The content is
96 in BUF and length is LEN. */
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. */
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
112{
114};
115
117
118/* Base class for tracefile related targets. */
119
121{
122public:
123 tracefile_target () = default;
124
125 int get_trace_status (trace_status *ts) override;
126 bool has_all_memory () override;
127 bool has_memory () override;
128 bool has_stack () override;
129 bool has_registers () override;
130 bool has_execution (inferior *inf) override { return false; }
131 bool thread_alive (ptid_t ptid) override;
132};
133
134extern void tracefile_fetch_registers (struct regcache *regcache, int regno);
135
136#endif /* TRACEFILE_H */
const char *const name
bool has_registers() override
Definition tracefile.c:449
bool has_execution(inferior *inf) override
Definition tracefile.h:130
bool has_stack() override
Definition tracefile.c:439
bool has_all_memory() override
Definition tracefile.c:421
bool has_memory() override
Definition tracefile.c:429
tracefile_target()=default
int get_trace_status(trace_status *ts) override
Definition tracefile.c:467
bool thread_alive(ptid_t ptid) override
Definition tracefile.c:458
size_t size
Definition go32-nat.c:239
Definition gnu-nat.c:153
void(* start)(struct trace_file_writer *self, const char *name)
Definition tracefile.h:66
void(* write_header)(struct trace_file_writer *self)
Definition tracefile.h:70
void(* write_definition_end)(struct trace_file_writer *self)
Definition tracefile.h:93
void(* write_uploaded_tsv)(struct trace_file_writer *self, struct uploaded_tsv *tsv)
Definition tracefile.h:82
void(* dtor)(struct trace_file_writer *self)
Definition tracefile.h:57
void(* end)(struct trace_file_writer *self)
Definition tracefile.h:106
void(* write_regblock_type)(struct trace_file_writer *self, int size)
Definition tracefile.h:74
void(* write_trace_buffer)(struct trace_file_writer *self, gdb_byte *buf, LONGEST len)
Definition tracefile.h:97
void(* write_uploaded_tp)(struct trace_file_writer *self, struct uploaded_tp *tp)
Definition tracefile.h:86
int(* target_save)(struct trace_file_writer *self, const char *name)
Definition tracefile.h:62
const struct trace_frame_write_ops * frame_ops
Definition tracefile.h:103
void(* write_tdesc)(struct trace_file_writer *self)
Definition tracefile.h:90
void(* write_status)(struct trace_file_writer *self, struct trace_status *ts)
Definition tracefile.h:78
const struct trace_file_write_ops * ops
Definition tracefile.h:113
void(* write_m_block_header)(struct trace_file_writer *self, uint64_t addr, uint16_t length)
Definition tracefile.h:33
void(* write_r_block)(struct trace_file_writer *self, gdb_byte *buf, int32_t size)
Definition tracefile.h:20
void(* write_v_block)(struct trace_file_writer *self, int32_t num, uint64_t val)
Definition tracefile.h:44
void(* write_m_block_memory)(struct trace_file_writer *self, gdb_byte *buf, uint16_t length)
Definition tracefile.h:39
void(* end)(struct trace_file_writer *self)
Definition tracefile.h:48
void(* start)(struct trace_file_writer *self, uint16_t tpnum)
Definition tracefile.h:16
struct trace_file_writer * tfile_trace_file_writer_new(void)
void tracefile_fetch_registers(struct regcache *regcache, int regno)
Definition tracefile.c:380