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."));
97 record_start (
const char *method,
const char *format,
int from_tty)
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."));
146 DEBUG (
"error reading memory at addr %s len = %ld.\n",
289 "this operation.\n"));
293 if (!from_tty ||
query (
_(
"Delete the log from this point forward " 294 "and begin to record the running message " 312 "logs are deleted.\n"));
323 "by an apporpriate subcommand.\n"));
358 const char *recfilename;
359 char recfilename_buffer[40];
363 if (args != NULL && *args != 0)
368 xsnprintf (recfilename_buffer,
sizeof (recfilename_buffer),
370 recfilename = recfilename_buffer;
383 if (arg == NULL || *arg ==
'\0')
384 error (
_(
"Command requires an argument (insn number to go to)."));
408 if (arg != NULL && *arg !=
'\0')
409 error (
_(
"Junk after argument: %s."), arg);
420 if (arg != NULL && *arg !=
'\0')
421 error (
_(
"Junk after argument: %s."), arg);
433 const char *begin, *end, *pos;
439 error (
_(
"Expected positive number, got: %s."), pos);
443 *arg += (end - begin);
459 error (
_(
"Expected positive number, got: %s."), pos);
461 long result = strtol (pos, &end, 10);
472 error (
_(
"Junk after argument: %s."), arg);
477 static gdb_disassembly_flags
480 gdb_disassembly_flags modifiers;
494 error (
_(
"Missing modifier."));
496 for (; *args; ++args)
521 error (
_(
"Invalid modifier: %c."), *args);
564 if (arg == NULL || *arg == 0 || strcmp (arg,
"+") == 0)
566 else if (strcmp (arg,
"-") == 0)
587 else if (*arg ==
'-')
635 error (
_(
"Missing modifier."));
637 for (; *args; ++args)
657 error (
_(
"Invalid modifier: %c."), *args);
683 if (arg == NULL || *arg == 0 || strcmp (arg,
"+") == 0)
685 else if (strcmp (arg,
"-") == 0)
706 else if (*arg ==
'-')
745 unsigned int new_value = *command_var;
748 *command_var = *setting;
749 error (
_(
"integer %u out of range"), new_value);
753 *setting = *command_var;
786 _(
"Set debugging of record/replay feature."),
787 _(
"Show debugging of record/replay feature."),
788 _(
"When enabled, debugging output for " 789 "record/replay feature is displayed."),
795 Set number of instructions to print in \"record instruction-history\"."),
_(
"\ 796 Show number of instructions to print in \"record instruction-history\"."),
_(
"\ 797 A size of \"unlimited\" means unlimited instructions. The default is 10."),
803 Set number of function to print in \"record function-call-history\"."),
_(
"\ 804 Show number of functions to print in \"record function-call-history\"."),
_(
"\ 805 A size of \"unlimited\" means unlimited lines. The default is 10."),
810 _(
"Start recording."),
829 _(
"Save the execution log to a file.\n\ 830 Argument is optional filename.\n\ 831 Default filename is 'gdb_record.<process_id>'."),
836 _(
"Delete the rest of execution log and start recording it anew."),
842 _(
"Stop the record/replay target."),
847 Restore the program to its state at instruction number N.\n\ 848 Argument is instruction number, as shown by 'info record'."),
852 _(
"Go to the beginning of the execution log."),
857 _(
"Go to the end of the execution log."),
861 Print disassembled instructions stored in the execution log.\n\ 862 With a /m or /s modifier, source lines are included (if available).\n\ 863 With a /r modifier, raw instructions in hex are included.\n\ 864 With a /f modifier, function names are omitted.\n\ 865 With a /p modifier, current position markers are omitted.\n\ 866 With no argument, disassembles ten more instructions after the previous \ 868 \"record instruction-history -\" disassembles ten instructions before a \ 869 previous disassembly.\n\ 870 One argument specifies an instruction number as shown by 'info record', and \ 871 ten instructions are disassembled after that instruction.\n\ 872 Two arguments with comma between them specify starting and ending instruction \ 873 numbers to disassemble.\n\ 874 If the second argument is preceded by '+' or '-', it specifies the distance \ 875 from the first argument.\n\ 876 The number of instructions to disassemble can be defined with \"set record \ 877 instruction-history-size\"."),
881 Prints the execution history at function granularity.\n\ 882 It prints one line for each sequence of instructions that belong to the same \ 884 Without modifiers, it prints the function name.\n\ 885 With a /l modifier, the source file and line number range is included.\n\ 886 With a /i modifier, the instruction number range is included.\n\ 887 With a /c modifier, the output is indented based on the call stack depth.\n\ 888 With no argument, prints ten more lines after the previous ten-line print.\n\ 889 \"record function-call-history -\" prints ten lines before a previous ten-line \ 891 One argument specifies a function number as shown by 'info record', and \ 892 ten lines are printed after that function.\n\ 893 Two arguments with comma between them specify a range of functions to print.\n\ 894 If the second argument is preceded by '+' or '-', it specifies the distance \ 895 from the first argument.\n\ 896 The number of functions to print can be defined with \"set record \ 897 function-call-history-size\"."),
void target_goto_record_begin(void)
struct cmd_list_element * show_record_cmdlist
int breakpoint_inserted_here_p(const address_space *aspace, CORE_ADDR pc)
static gdb_disassembly_flags get_insn_history_modifiers(const char **arg)
void target_insn_history_from(ULONGEST from, int size, gdb_disassembly_flags flags)
int ptid_get_pid(const ptid_t &ptid)
struct cmd_list_element * record_goto_cmdlist
struct cmd_list_element * info_record_cmdlist
static void cmd_record_goto_end(const char *arg, int from_tty)
static void no_chunk(const char *arg)
void record_goto(const char *arg)
int query(const char *ctlstr,...)
void(* to_stop_recording)(struct target_ops *) TARGET_DEFAULT_IGNORE()
struct cmd_list_element * set_record_cmdlist
static void set_record_call_history_size(const char *args, int from_tty, struct cmd_list_element *c)
void record_preopen(void)
void target_detach(const char *args, int from_tty)
void record_disconnect(struct target_ops *t, const char *args, int from_tty)
int unpush_target(struct target_ops *t)
int target_supports_delete_record(void)
unsigned int record_debug
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
void filename_completer(struct cmd_list_element *ignore, completion_tracker &tracker, const char *text, const char *word)
struct cmd_list_element * cmdlist
static void cmd_record_insn_history(const char *arg, int from_tty)
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 target_insn_history_range(ULONGEST begin, ULONGEST end, gdb_disassembly_flags flags)
static int command_size_to_target_size(unsigned int size)
void target_insn_history(int size, gdb_disassembly_flags flags)
void printf_filtered(const char *format,...)
static void info_record_command(const char *args, int from_tty)
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
void record_start(const char *method, const char *format, int from_tty)
static void cmd_record_save(const char *args, int from_tty)
void execute_command(const char *, int)
struct cmd_list_element * add_prefix_cmd(const char *name, enum command_class theclass, cmd_const_cfunc_ftype *fun, const char *doc, struct cmd_list_element **prefixlist, const char *prefixname, int allow_unknown, struct cmd_list_element **list)
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_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
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 void cmd_record_start(const char *args, int from_tty)
struct cmd_list_element * infolist
struct cmd_list_element * setlist
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_const_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_goto(const char *arg, int from_tty)
void observer_notify_record_changed(struct inferior *inferior, int started, const char *method, const char *format)
#define DEBUG(msg, args...)
void record_stop(int from_tty)
int record_read_memory(struct gdbarch *gdbarch, CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
std::string execute_command_to_string(const char *p, int from_tty)
static unsigned int record_call_history_size
void set_cmd_completer(struct cmd_list_element *cmd, completer_ftype *completer)
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 set_record_insn_history_size(const char *args, int from_tty, struct cmd_list_element *c)
static void record_unpush(struct target_ops *t)
static void show_record_command(const char *args, int from_tty)
static unsigned int record_insn_history_size_setshow_var
static struct target_ops * require_record_target(void)
struct target_ops * find_record_target(void)
void _initialize_record(void)
static void cmd_record_stop(const char *args, int from_tty)
void target_mourn_inferior(ptid_t ptid)
void record_detach(struct target_ops *t, const char *args, int from_tty)
void target_goto_record_end(void)
static void cmd_record_call_history(const char *arg, int from_tty)
ULONGEST strtoulst(const char *num, const char **trailer, int base)
void target_goto_record(ULONGEST insn)
void printf_unfiltered(const char *format,...)
int target_record_is_replaying(ptid_t ptid)
struct cmd_list_element * setdebuglist
void target_save_record(const char *filename)
int record_check_stopped_by_breakpoint(const address_space *aspace, CORE_ADDR pc, enum target_stop_reason *reason)
void cmd_show_list(struct cmd_list_element *list, int from_tty, const char *prefix)
static int get_context_size(const char **arg)
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *old, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
static unsigned int record_call_history_size_setshow_var
void record_mourn_inferior(struct target_ops *t)
void target_call_history_range(ULONGEST begin, ULONGEST end, int flags)
void record_kill(struct target_ops *t)
struct cmd_list_element * record_cmdlist
void help_list(struct cmd_list_element *list, const char *cmdtype, enum command_class theclass, struct ui_file *stream)
static int get_call_history_modifiers(const char **arg)
int xsnprintf(char *str, size_t size, const char *format,...)
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
static void cmd_record_delete(const char *args, int from_tty)
int hardware_breakpoint_inserted_here_p(const address_space *aspace, CORE_ADDR pc)
static void set_record_command(const char *args, int from_tty)
void target_call_history(int size, int flags)
static void cmd_record_goto_begin(const char *arg, int from_tty)
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)
static ULONGEST get_insn_number(const char **arg)
static unsigned int record_insn_history_size
void error(const char *fmt,...)
static void validate_history_size(unsigned int *command_var, unsigned int *setting)
struct target_ops * find_target_at(enum strata stratum)
LONGEST parse_and_eval_long(const char *exp)