56 #define DEBUG(msg, args...) \
58 fprintf_unfiltered (gdb_stdlog, "record: " msg "\n", ##args)
77 error (
_(
"No record target is currently active.\n"
78 "Use one of the \"target record-<tab><tab>\" commands first."));
90 error (
_(
"The process is already being recorded. Use \"record stop\" to "
91 "stop recording first."));
104 DEBUG (
"error reading memory at addr %s len = %ld.\n",
105 paddress (gdbarch, memaddr), (
long) len);
246 "this operation.\n"));
250 if (!from_tty ||
query (
_(
"Delete the log from this point forward "
251 "and begin to record the running message "
269 "logs are deleted.\n"));
280 "by an apporpriate subcommand.\n"));
315 char *recfilename, recfilename_buffer[40];
319 if (args != NULL && *args != 0)
324 xsnprintf (recfilename_buffer,
sizeof (recfilename_buffer),
326 recfilename = recfilename_buffer;
339 if (arg == NULL || *arg ==
'\0')
340 error (
_(
"Command requires an argument (insn number to go to)."));
364 if (arg != NULL && *arg !=
'\0')
365 error (
_(
"Junk after argument: %s."), arg);
376 if (arg != NULL && *arg !=
'\0')
377 error (
_(
"Junk after argument: %s."), arg);
389 const char *begin, *end, *pos;
395 error (
_(
"Expected positive number, got: %s."), pos);
399 *arg += (end - begin);
415 error (
_(
"Expected positive number, got: %s."), pos);
417 return strtol (pos, arg, 10);
426 error (
_(
"Junk after argument: %s."), arg);
448 error (
_(
"Missing modifier."));
450 for (; *args; ++args)
474 error (
_(
"Invalid modifier: %c."), *args);
519 if (arg == NULL || *arg == 0 || strcmp (arg,
"+") == 0)
521 else if (strcmp (arg,
"-") == 0)
542 else if (*arg ==
'-')
590 error (
_(
"Missing modifier."));
592 for (; *args; ++args)
612 error (
_(
"Invalid modifier: %c."), *args);
638 if (arg == NULL || *arg == 0 || strcmp (arg,
"+") == 0)
640 else if (strcmp (arg,
"-") == 0)
661 else if (*arg ==
'-')
700 unsigned int new_value = *command_var;
703 *command_var = *setting;
704 error (
_(
"integer %u out of range"), new_value);
708 *setting = *command_var;
744 _(
"Set debugging of record/replay feature."),
745 _(
"Show debugging of record/replay feature."),
746 _(
"When enabled, debugging output for "
747 "record/replay feature is displayed."),
753 Set number of instructions to print in \"record instruction-history\"."),
_(
"\
754 Show number of instructions to print in \"record instruction-history\"."),
_(
"\
755 A size of \"unlimited\" means unlimited instructions. The default is 10."),
757 &set_record_cmdlist, &show_record_cmdlist);
761 Set number of function to print in \"record function-call-history\"."),
_(
"\
762 Show number of functions to print in \"record function-call-history\"."),
_(
"\
763 A size of \"unlimited\" means unlimited lines. The default is 10."),
765 &set_record_cmdlist, &show_record_cmdlist);
768 _(
"Start recording."),
769 &record_cmdlist,
"record ", 0, &
cmdlist);
774 _(
"Set record options"), &set_record_cmdlist,
778 _(
"Show record options"), &show_record_cmdlist,
782 _(
"Info record options"), &info_record_cmdlist,
787 _(
"Save the execution log to a file.\n\
788 Argument is optional filename.\n\
789 Default filename is 'gdb_record.<process_id>'."),
794 _(
"Delete the rest of execution log and start recording it anew."),
800 _(
"Stop the record/replay target."),
805 Restore the program to its state at instruction number N.\n\
806 Argument is instruction number, as shown by 'info record'."),
807 &record_goto_cmdlist,
"record goto ", 1, &record_cmdlist);
810 _(
"Go to the beginning of the execution log."),
811 &record_goto_cmdlist);
815 _(
"Go to the end of the execution log."),
816 &record_goto_cmdlist);
819 Print disassembled instructions stored in the execution log.\n\
820 With a /m modifier, source lines are included (if available).\n\
821 With a /r modifier, raw instructions in hex are included.\n\
822 With a /f modifier, function names are omitted.\n\
823 With a /p modifier, current position markers are omitted.\n\
824 With no argument, disassembles ten more instructions after the previous \
826 \"record instruction-history -\" disassembles ten instructions before a \
827 previous disassembly.\n\
828 One argument specifies an instruction number as shown by 'info record', and \
829 ten instructions are disassembled after that instruction.\n\
830 Two arguments with comma between them specify starting and ending instruction \
831 numbers to disassemble.\n\
832 If the second argument is preceded by '+' or '-', it specifies the distance \
833 from the first argument.\n\
834 The number of instructions to disassemble can be defined with \"set record \
835 instruction-history-size\"."),
839 Prints the execution history at function granularity.\n\
840 It prints one line for each sequence of instructions that belong to the same \
842 Without modifiers, it prints the function name.\n\
843 With a /l modifier, the source file and line number range is included.\n\
844 With a /i modifier, the instruction number range is included.\n\
845 With a /c modifier, the output is indented based on the call stack depth.\n\
846 With no argument, prints ten more lines after the previous ten-line print.\n\
847 \"record function-call-history -\" prints ten lines before a previous ten-line \
849 One argument specifies a function number as shown by 'info record', and \
850 ten lines are printed after that function.\n\
851 Two arguments with comma between them specify a range of functions to print.\n\
852 If the second argument is preceded by '+' or '-', it specifies the distance \
853 from the first argument.\n\
854 The number of functions to print can be defined with \"set record \
855 function-call-history-size\"."),
void target_goto_record_begin(void)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
static void cmd_record_goto_begin(char *arg, int from_tty)
static void cmd_record_delete(char *args, int from_tty)
#define DISASSEMBLY_SOURCE
void 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_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
#define DISASSEMBLY_OMIT_FNAME
#define DISASSEMBLY_OMIT_PC
static void cmd_record_call_history(char *arg, int from_tty)
int hardware_breakpoint_inserted_here_p(struct address_space *aspace, CORE_ADDR pc)
void record_goto(const char *arg)
static void show_record_command(char *args, int from_tty)
int query(const char *ctlstr,...)
void(* to_stop_recording)(struct target_ops *) TARGET_DEFAULT_IGNORE()
static void cmd_record_insn_history(char *arg, int from_tty)
void record_preopen(void)
void target_detach(const char *args, int from_tty)
struct ui_file * gdb_stdout
void record_disconnect(struct target_ops *t, const char *args, int from_tty)
static void no_chunk(char *arg)
int unpush_target(struct target_ops *t)
int target_supports_delete_record(void)
unsigned int record_debug
static void set_record_command(char *args, int from_tty)
struct cmd_list_element * cmdlist
void target_insn_history_from(ULONGEST from, int size, int flags)
void(* to_info_record)(struct target_ops *) TARGET_DEFAULT_IGNORE()
void target_call_history_from(ULONGEST begin, int size, int flags)
char * skip_spaces(char *chp)
void execute_command(char *, int)
static int command_size_to_target_size(unsigned int size)
void printf_filtered(const char *format,...)
int breakpoint_inserted_here_p(struct address_space *aspace, CORE_ADDR pc)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
initialize_file_ftype _initialize_record
mach_port_t kern_return_t mach_port_t msgports 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
static int get_call_history_modifiers(char **arg)
int target_record_is_replaying(void)
struct cmd_list_element * infolist
struct cmd_list_element * setlist
static void cmd_record_goto(char *arg, int from_tty)
static void info_record_command(char *args, int from_tty)
#define DEBUG(msg, args...)
void initialize_file_ftype(void)
int record_read_memory(struct gdbarch *gdbarch, CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static void set_record_insn_history_size(char *args, int from_tty, struct cmd_list_element *c)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static unsigned int record_call_history_size
const char * skip_spaces_const(const char *chp)
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
void 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_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
static void cmd_record_start(char *args, int from_tty)
struct cmd_list_element * showlist
struct cmd_list_element * add_com_alias(const char *name, const char *oldname, enum command_class theclass, int abbrev_flag)
static void record_unpush(struct target_ops *t)
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, cmd_cfunc_ftype *fun, const char *doc, struct cmd_list_element **list)
static unsigned int record_insn_history_size_setshow_var
static int get_context_size(char **arg)
static struct target_ops * require_record_target(void)
struct target_ops * find_record_target(void)
static void cmd_record_goto_end(char *arg, int from_tty)
void observer_notify_record_changed(struct inferior *inferior, int started)
void target_mourn_inferior(void)
void record_detach(struct target_ops *t, const char *args, int from_tty)
void target_goto_record_end(void)
static int get_insn_history_modifiers(char **arg)
struct cmd_list_element * add_alias_cmd(const char *name, const char *oldname, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
ULONGEST strtoulst(const char *num, const char **trailer, int base)
void target_goto_record(ULONGEST insn)
void printf_unfiltered(const char *format,...)
struct cmd_list_element * setdebuglist
void target_save_record(const char *filename)
static void cmd_record_save(char *args, int from_tty)
static void cmd_record_stop(char *args, int from_tty)
void cmd_show_list(struct cmd_list_element *list, int from_tty, const char *prefix)
static unsigned int record_call_history_size_setshow_var
void record_mourn_inferior(struct target_ops *t)
#define DISASSEMBLY_FILENAME
void target_call_history_range(ULONGEST begin, ULONGEST end, int flags)
int ptid_get_pid(ptid_t ptid)
static void record_stop(struct target_ops *t)
void record_kill(struct target_ops *t)
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
int xsnprintf(char *str, size_t size, const char *format,...)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
void target_call_history(int size, int flags)
#define DISASSEMBLY_RAW_INSN
struct inferior * current_inferior(void)
const char * to_shortname
void target_delete_record(void)
unsigned long long ULONGEST
void target_disconnect(const char *args, int from_tty)
struct cmd_list_element * showdebuglist
static void show_record_debug(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
int record_check_stopped_by_breakpoint(struct address_space *aspace, CORE_ADDR pc, enum target_stop_reason *reason)
static ULONGEST get_insn_number(char **arg)
static void set_record_call_history_size(char *args, int from_tty, struct cmd_list_element *c)
static unsigned int record_insn_history_size
void target_insn_history_range(ULONGEST begin, ULONGEST end, int flags)
void target_insn_history(int size, int flags)
void error(const char *fmt,...)
static void validate_history_size(unsigned int *command_var, unsigned int *setting)
const ULONGEST const LONGEST len
struct target_ops * find_target_at(enum strata stratum)
LONGEST parse_and_eval_long(const char *exp)