28 #define TRACE_WRITE_R_BLOCK(writer, buf, size) \
29 writer->ops->frame_ops->write_r_block ((writer), (buf), (size))
30 #define TRACE_WRITE_M_BLOCK_HEADER(writer, addr, size) \
31 writer->ops->frame_ops->write_m_block_header ((writer), (addr), \
33 #define TRACE_WRITE_M_BLOCK_MEMORY(writer, buf, size) \
34 writer->ops->frame_ops->write_m_block_memory ((writer), (buf), \
36 #define TRACE_WRITE_V_BLOCK(writer, num, val) \
37 writer->ops->frame_ops->write_v_block ((writer), (num), (val))
65 #define MAX_TRACE_UPLOAD 2000
75 error (
_(
"Target failed to save trace data to '%s'."),
84 writer->
ops->
start (writer, filename);
108 for (utsv = uploaded_tsvs; utsv; utsv = utsv->
next)
115 for (utp = uploaded_tps; utp; utp = utp->
next)
118 for (utp = uploaded_tps; utp; utp = utp->
next)
142 error (
_(
"Failure to get requested trace buffer data"));
180 for (block = 0; block < tf_size; )
189 error (
_(
"Failure to get requested trace buffer data"));
203 error (
_(
"Failure to get requested trace"
218 error (
_(
"Failure to get requested trace"
228 mlen = (
unsigned short)
238 for (j = 0; j < mlen; )
240 unsigned int read_length;
245 read_length = mlen - j;
251 error (
_(
"Failure to get requested"
252 " trace buffer data"));
258 gotten += read_length;
272 error (
_(
"Failure to get requested"
273 " trace buffer data"));
286 error (
_(
"Unknown block type '%c' (0x%x) in"
288 block_type, block_type);
302 writer->
ops->
end (writer);
308 int target_does_save = 0;
310 char *filename = NULL;
312 int generate_ctf = 0;
321 for (; *argv; ++argv)
323 if (strcmp (*argv,
"-r") == 0)
324 target_does_save = 1;
325 if (strcmp (*argv,
"-ctf") == 0)
327 else if (**argv ==
'-')
328 error (
_(
"unknown option `%s'"), *argv);
343 trace_save (filename, writer, target_does_save);
347 generate_ctf ?
"directory" :
"file", filename);
362 trace_save (filename, writer, target_does_save);
377 trace_save (dirname, writer, target_does_save);
405 if (pc_regno < 0 || pc_regno >= gdbarch_num_regs (gdbarch))
408 if (regno == -1 || regno == pc_regno)
418 warning (
_(
"Tracepoint %d has multiple "
419 "locations, cannot infer $pc"),
426 warning (
_(
"Tracepoint %d does while-stepping, "
519 Save the trace data to a file.\n\
520 Use the '-ctf' option to save the data to CTF format.\n\
521 Use the '-r' option to direct the target to save directly to the file,\n\
522 using its own filesystem."));
void error_no_arg(const char *why)
struct gdbarch * target_gdbarch(void)
struct cleanup * make_cleanup_freeargv(char **arg)
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
struct gdbarch * get_regcache_arch(const struct regcache *regcache)
#define target_upload_trace_state_variables(utsvp)
const struct trace_file_write_ops * ops
int(* to_has_memory)(struct target_ops *)
void warning(const char *fmt,...)
void(* write_status)(struct trace_file_writer *self, struct trace_status *ts)
int(* to_has_stack)(struct target_ops *)
void free_uploaded_tps(struct uploaded_tp **utpp)
#define target_get_raw_trace_data(buf, offset, len)
#define TRACE_WRITE_M_BLOCK_HEADER(writer, addr, size)
static int tracefile_has_registers(struct target_ops *ops)
static int tracefile_has_stack(struct target_ops *ops)
int gdbarch_num_regs(struct gdbarch *gdbarch)
struct tracepoint * get_tracepoint(int num)
void(* start)(struct trace_file_writer *self, const char *name)
#define target_get_tracepoint_status(tp, utp)
void free_uploaded_tsvs(struct uploaded_tsv **utsvp)
void(* write_regblock_type)(struct trace_file_writer *self, int size)
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
void printf_filtered(const char *format,...)
const struct trace_frame_write_ops * frame_ops
static void trace_save_command(char *args, int from_tty)
struct trace_status * current_trace_status(void)
void trace_save_ctf(const char *dirname, int target_does_save)
struct bp_location * next
void initialize_file_ftype(void)
struct uploaded_tsv * next
void(* end)(struct trace_file_writer *self)
#define TRACE_WRITE_V_BLOCK(writer, num, val)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
struct uploaded_tp * next
static int tracefile_has_all_memory(struct target_ops *ops)
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
void init_tracefile_ops(struct target_ops *ops)
int get_traceframe_number(void)
void(* write_uploaded_tsv)(struct trace_file_writer *self, struct uploaded_tsv *tsv)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
initialize_file_ftype _initialize_tracefile
#define TRACE_WRITE_R_BLOCK(writer, buf, size)
static int tracefile_thread_alive(struct target_ops *ops, ptid_t ptid)
static void trace_save(const char *filename, struct trace_file_writer *writer, int target_does_save)
#define target_get_trace_status(ts)
const char const char int
int get_tracepoint_number(void)
void tracefile_fetch_registers(struct regcache *regcache, int regno)
void(* write_header)(struct trace_file_writer *self)
void(* dtor)(struct trace_file_writer *self)
static int tracefile_get_trace_status(struct target_ops *self, struct trace_status *ts)
#define TRACE_WRITE_M_BLOCK_MEMORY(writer, buf, size)
void(* write_definition_end)(struct trace_file_writer *self)
struct trace_file_writer * ctf_trace_file_writer_new(void)
char ** gdb_buildargv(const char *s)
int(* to_get_trace_status)(struct target_ops *, struct trace_status *ts) TARGET_DEFAULT_RETURN(-1)
void regcache_raw_supply(struct regcache *regcache, int regnum, const void *buf)
void(* start)(struct trace_file_writer *self, uint16_t tpnum)
void trace_save_tfile(const char *filename, int target_does_save)
unsigned long long ULONGEST
static void trace_file_writer_xfree(void *arg)
int register_size(struct gdbarch *gdbarch, int regnum)
void(* end)(struct trace_file_writer *self)
int(* to_has_all_memory)(struct target_ops *)
int gdbarch_pc_regnum(struct gdbarch *gdbarch)
int(* to_thread_alive)(struct target_ops *, ptid_t ptid) TARGET_DEFAULT_RETURN(0)
struct trace_file_writer * tfile_trace_file_writer_new(void)
void(* write_uploaded_tp)(struct trace_file_writer *self, struct uploaded_tp *tp)
LONGEST extract_signed_integer(const gdb_byte *, int, enum bfd_endian)
void(* write_trace_buffer)(struct trace_file_writer *self, gdb_byte *buf, LONGEST len)
int(* to_has_registers)(struct target_ops *)
void error(const char *fmt,...)
static int tracefile_has_memory(struct target_ops *ops)
struct cmd_list_element * add_com(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc)
int(* target_save)(struct trace_file_writer *self, const char *name)
void do_cleanups(struct cleanup *old_chain)
#define target_upload_tracepoints(utpp)