26#include "gdbsupport/common-utils.h"
56#define DEBUG(msg, args...) \
58 gdb_printf (gdb_stdlog, "record: " msg "\n", ##args)
77 error (_(
"No recording is currently active.\n"
78 "Use the \"record full\" or \"record btrace\" command first."));
90 error (_(
"The process is already being recorded. Use \"record stop\" to "
91 "stop recording first."));
104 error (_(
"Invalid format."));
106 else if (strcmp (method,
"full") == 0)
111 error (_(
"Invalid format."));
113 else if (strcmp (method,
"btrace") == 0)
117 else if (strcmp (format,
"bts") == 0)
119 else if (strcmp (format,
"pt") == 0)
122 error (_(
"Invalid format."));
125 error (_(
"Invalid method."));
140 CORE_ADDR memaddr, gdb_byte *myaddr,
146 DEBUG (
"error reading memory at addr %s len = %ld.\n",
260 gdb_printf (file, _(
"Debugging of process record target is %s.\n"),
282 gdb_printf (_(
"Already at end of record list.\n"));
288 gdb_printf (_(
"The current record target does not support "
289 "this operation.\n"));
293 if (!from_tty ||
query (_(
"Delete the log from this point forward "
294 "and begin to record the running message "
311 gdb_printf (_(
"Process record is stopped and all execution "
312 "logs are deleted.\n"));
328 gdb_printf (_(
"No recording is currently active.\n"));
341 const char *recfilename;
342 char recfilename_buffer[40];
346 if (args != NULL && *args != 0)
351 xsnprintf (recfilename_buffer,
sizeof (recfilename_buffer),
353 recfilename = recfilename_buffer;
366 if (arg == NULL || *arg ==
'\0')
367 error (_(
"Command requires an argument (insn number to go to)."));
391 if (arg != NULL && *arg !=
'\0')
392 error (_(
"Junk after argument: %s."), arg);
403 if (arg != NULL && *arg !=
'\0')
404 error (_(
"Junk after argument: %s."), arg);
416 const char *begin, *end, *pos;
419 pos = skip_spaces (begin);
422 error (_(
"Expected positive number, got: %s."), pos);
424 number = strtoulst (pos, &end, 10);
426 *arg += (end - begin);
439 pos = skip_spaces (*arg);
442 error (_(
"Expected positive number, got: %s."), pos);
444 long result = strtol (pos, &end, 10);
455 error (_(
"Junk after argument: %s."), arg);
460static gdb_disassembly_flags
463 gdb_disassembly_flags modifiers;
477 error (_(
"Missing modifier."));
479 for (; *args; ++args)
507 error (_(
"Invalid modifier: %c."), *args);
511 args = skip_spaces (args);
550 if (arg == NULL || *arg == 0 || strcmp (arg,
"+") == 0)
552 else if (strcmp (arg,
"-") == 0)
562 arg = skip_spaces (++arg);
573 else if (*arg ==
'-')
604static record_print_flags
607 record_print_flags modifiers = 0;
608 const char *args = *arg;
618 error (_(
"Missing modifier."));
620 for (; *args; ++args)
640 error (_(
"Invalid modifier: %c."), *args);
644 args = skip_spaces (args);
664 if (arg == NULL || *arg == 0 || strcmp (arg,
"+") == 0)
666 else if (strcmp (arg,
"-") == 0)
676 arg = skip_spaces (++arg);
687 else if (*arg ==
'-')
726 unsigned int new_value = *command_var;
730 error (_(
"integer %u out of range"), new_value);
768 _(
"Set debugging of record/replay feature."),
769 _(
"Show debugging of record/replay feature."),
770 _(
"When enabled, debugging output for "
771 "record/replay feature is displayed."),
777Set number of instructions to print in \"record instruction-history\"."), _(
"\
778Show number of instructions to print in \"record instruction-history\"."), _(
"\
779A size of \"unlimited\" means unlimited instructions. The default is 10."),
785Set number of function to print in \"record function-call-history\"."), _(
"\
786Show number of functions to print in \"record function-call-history\"."), _(
"\
787A size of \"unlimited\" means unlimited lines. The default is 10."),
793 _(
"Start recording."),
801 _(
"Set record options."),
802 _(
"Show record options."),
817 _(
"Save the execution log to a file.\n\
818Usage: record save [FILENAME]\n\
819Default filename is 'gdb_record.PROCESS_ID'."),
825 _(
"Delete the rest of execution log and start recording it \
833 _(
"Stop the record/replay target."),
838Restore the program to its state at instruction number N.\n\
839Argument is instruction number, as shown by 'info record'."),
844 _(
"Go to the beginning of the execution log."),
850 _(
"Go to the end of the execution log."),
854Print disassembled instructions stored in the execution log.\n\
855With a /m or /s modifier, source lines are included (if available).\n\
856With a /r modifier, raw instructions in hex are included.\n\
857With a /f modifier, function names are omitted.\n\
858With a /p modifier, current position markers are omitted.\n\
859With no argument, disassembles ten more instructions after the previous \
861\"record instruction-history -\" disassembles ten instructions before a \
862previous disassembly.\n\
863One argument specifies an instruction number as shown by 'info record', and \
864ten instructions are disassembled after that instruction.\n\
865Two arguments with comma between them specify starting and ending instruction \
866numbers to disassemble.\n\
867If the second argument is preceded by '+' or '-', it specifies the distance \
868from the first argument.\n\
869The number of instructions to disassemble can be defined with \"set record \
870instruction-history-size\"."),
874Prints the execution history at function granularity.\n\
875It prints one line for each sequence of instructions that belong to the same \
877Without modifiers, it prints the function name.\n\
878With a /l modifier, the source file and line number range is included.\n\
879With a /i modifier, the instruction number range is included.\n\
880With a /c modifier, the output is indented based on the call stack depth.\n\
881With no argument, prints ten more lines after the previous ten-line print.\n\
882\"record function-call-history -\" prints ten lines before a previous ten-line \
884One argument specifies a function number as shown by 'info record', and \
885ten lines are printed after that function.\n\
886Two arguments with comma between them specify a range of functions to print.\n\
887If the second argument is preceded by '+' or '-', it specifies the distance \
888from the first argument.\n\
889The number of functions to print can be defined with \"set record \
890function-call-history-size\"."),
int hardware_breakpoint_inserted_here_p(const address_space *aspace, CORE_ADDR pc)
int breakpoint_inserted_here_p(const address_space *aspace, CORE_ADDR pc)
int unpush_target(struct target_ops *t)
struct cmd_list_element * showlist
struct cmd_list_element * infolist
struct cmd_list_element * cmdlist
struct cmd_list_element * setlist
struct cmd_list_element * showdebuglist
struct cmd_list_element * setdebuglist
set_show_commands add_setshow_uinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *target, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
cmd_list_element * add_com_alias(const char *name, cmd_list_element *target, command_class theclass, int abbrev_flag)
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
set_show_commands add_setshow_prefix_cmd(const char *name, command_class theclass, const char *set_doc, const char *show_doc, cmd_list_element **set_subcommands_list, cmd_list_element **show_subcommands_list, cmd_list_element **set_list, cmd_list_element **show_list)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_simple_func_ftype *fun, const char *doc, struct cmd_list_element **subcommands, int allow_unknown, struct cmd_list_element **list)
set_show_commands add_setshow_zuinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
void filename_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
LONGEST parse_and_eval_long(const char *exp)
void execute_command_to_string(std::string &res, const char *p, int from_tty, bool term_out)
void execute_command(const char *, int)
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
struct inferior * current_inferior(void)
observable< struct inferior *, int, const char *, const char * > record_changed
void record_detach(struct target_ops *t, inferior *inf, int from_tty)
static unsigned int record_call_history_size
unsigned int record_debug
struct cmd_list_element * set_record_cmdlist
static unsigned int record_insn_history_size
static void cmd_record_goto_end(const char *arg, int from_tty)
struct cmd_list_element * info_record_cmdlist
static void cmd_record_stop(const char *args, int from_tty)
static void no_chunk(const char *arg)
void record_goto(const char *arg)
int record_read_memory(struct gdbarch *gdbarch, CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static void set_record_call_history_size(const char *args, int from_tty, struct cmd_list_element *c)
static gdb_disassembly_flags get_insn_history_modifiers(const char **arg)
static unsigned int record_call_history_size_setshow_var
struct cmd_list_element * show_record_cmdlist
static record_print_flags get_call_history_modifiers(const char **arg)
static void record_unpush(struct target_ops *t)
static struct cmd_list_element * record_goto_cmdlist
#define DEBUG(msg, args...)
void record_disconnect(struct target_ops *t, const char *args, int from_tty)
static void cmd_record_save(const char *args, int from_tty)
static void show_record_debug(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void cmd_record_call_history(const char *arg, int from_tty)
static int command_size_to_target_size(unsigned int size)
static void cmd_record_goto_begin(const char *arg, int from_tty)
static void cmd_record_insn_history(const char *arg, int from_tty)
struct cmd_list_element * record_cmdlist
void record_stop(int from_tty)
static int get_context_size(const char **arg)
struct target_ops * find_record_target(void)
void record_preopen(void)
static void cmd_record_start(const char *args, int from_tty)
static ULONGEST get_insn_number(const char **arg)
void record_mourn_inferior(struct target_ops *t)
static void cmd_record_delete(const char *args, int from_tty)
static void info_record_command(const char *args, int from_tty)
static void validate_history_size(unsigned int *command_var, unsigned int *setting)
void record_kill(struct target_ops *t)
static void set_record_insn_history_size(const char *args, int from_tty, struct cmd_list_element *c)
int record_check_stopped_by_breakpoint(const address_space *aspace, CORE_ADDR pc, enum target_stop_reason *reason)
void _initialize_record()
static void cmd_record_goto(const char *arg, int from_tty)
static struct target_ops * require_record_target(void)
void record_start(const char *method, const char *format, int from_tty)
static unsigned int record_insn_history_size_setshow_var
@ RECORD_PRINT_INSN_RANGE
@ RECORD_PRINT_INDENT_CALLS
virtual void info_record() TARGET_DEFAULT_IGNORE()
virtual strata stratum() const =0
const char * shortname() const
virtual void stop_recording() TARGET_DEFAULT_IGNORE()
void target_goto_record(ULONGEST insn)
void target_call_history_from(ULONGEST begin, int size, record_print_flags flags)
int target_supports_delete_record()
void target_insn_history_range(ULONGEST begin, ULONGEST end, gdb_disassembly_flags flags)
void target_insn_history(int size, gdb_disassembly_flags flags)
void target_goto_record_end(void)
void target_call_history(int size, record_print_flags flags)
int target_record_is_replaying(ptid_t ptid)
void target_insn_history_from(ULONGEST from, int size, gdb_disassembly_flags flags)
void target_detach(inferior *inf, int from_tty)
void target_call_history_range(ULONGEST begin, ULONGEST end, record_print_flags flags)
void target_save_record(const char *filename)
void target_disconnect(const char *args, int from_tty)
struct target_ops * find_target_at(enum strata stratum)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
void target_goto_record_begin(void)
void target_delete_record(void)
void target_mourn_inferior(ptid_t ptid)
int query(const char *ctlstr,...)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
void gdb_printf(struct ui_file *stream, const char *format,...)
@ TARGET_STOPPED_BY_SW_BREAKPOINT
@ TARGET_STOPPED_BY_HW_BREAKPOINT
@ TARGET_STOPPED_BY_NO_REASON