26#include "gdbsupport/common-utils.h"
57#define DEBUG(msg, args...) \
59 gdb_printf (gdb_stdlog, "record: " msg "\n", ##args)
78 error (_(
"No recording is currently active.\n"
79 "Use the \"record full\" or \"record btrace\" command first."));
91 error (_(
"The process is already being recorded. Use \"record stop\" to "
92 "stop recording first."));
105 error (_(
"Invalid format."));
107 else if (strcmp (method,
"full") == 0)
112 error (_(
"Invalid format."));
114 else if (strcmp (method,
"btrace") == 0)
118 else if (strcmp (format,
"bts") == 0)
120 else if (strcmp (format,
"pt") == 0)
123 error (_(
"Invalid format."));
126 error (_(
"Invalid method."));
141 CORE_ADDR memaddr, gdb_byte *myaddr,
147 DEBUG (
"error reading memory at addr %s len = %ld.\n",
261 gdb_printf (file, _(
"Debugging of process record target is %s.\n"),
283 gdb_printf (_(
"Already at end of record list.\n"));
289 gdb_printf (_(
"The current record target does not support "
290 "this operation.\n"));
294 if (!from_tty ||
query (_(
"Delete the log from this point forward "
295 "and begin to record the running message "
312 gdb_printf (_(
"Process record is stopped and all execution "
313 "logs are deleted.\n"));
329 gdb_printf (_(
"No recording is currently active.\n"));
342 const char *recfilename;
343 char recfilename_buffer[40];
347 if (args != NULL && *args != 0)
352 xsnprintf (recfilename_buffer,
sizeof (recfilename_buffer),
354 recfilename = recfilename_buffer;
367 if (arg == NULL || *arg ==
'\0')
368 error (_(
"Command requires an argument (insn number to go to)."));
392 if (arg != NULL && *arg !=
'\0')
393 error (_(
"Junk after argument: %s."), arg);
404 if (arg != NULL && *arg !=
'\0')
405 error (_(
"Junk after argument: %s."), arg);
417 const char *begin, *end, *pos;
420 pos = skip_spaces (begin);
423 error (_(
"Expected positive number, got: %s."), pos);
425 number = strtoulst (pos, &end, 10);
427 *arg += (end - begin);
440 pos = skip_spaces (*arg);
443 error (_(
"Expected positive number, got: %s."), pos);
445 long result = strtol (pos, &end, 10);
456 error (_(
"Junk after argument: %s."), arg);
461static gdb_disassembly_flags
464 gdb_disassembly_flags modifiers;
478 error (_(
"Missing modifier."));
480 for (; *args; ++args)
508 error (_(
"Invalid modifier: %c."), *args);
512 args = skip_spaces (args);
532 gdb_assert (
size <= INT_MAX ||
size == UINT_MAX);
534 if (
size == UINT_MAX)
551 if (arg == NULL || *arg == 0 || strcmp (arg,
"+") == 0)
553 else if (strcmp (arg,
"-") == 0)
563 arg = skip_spaces (++arg);
574 else if (*arg ==
'-')
605static record_print_flags
608 record_print_flags modifiers = 0;
609 const char *args = *arg;
619 error (_(
"Missing modifier."));
621 for (; *args; ++args)
641 error (_(
"Invalid modifier: %c."), *args);
645 args = skip_spaces (args);
665 if (arg == NULL || *arg == 0 || strcmp (arg,
"+") == 0)
667 else if (strcmp (arg,
"-") == 0)
677 arg = skip_spaces (++arg);
688 else if (*arg ==
'-')
725 if (*command_var != UINT_MAX && *command_var > INT_MAX)
727 unsigned int new_value = *command_var;
731 error (_(
"integer %u out of range"), new_value);
769 _(
"Set debugging of record/replay feature."),
770 _(
"Show debugging of record/replay feature."),
771 _(
"When enabled, debugging output for "
772 "record/replay feature is displayed."),
778Set number of instructions to print in \"record instruction-history\"."), _(
"\
779Show number of instructions to print in \"record instruction-history\"."), _(
"\
780A size of \"unlimited\" means unlimited instructions. The default is 10."),
786Set number of function to print in \"record function-call-history\"."), _(
"\
787Show number of functions to print in \"record function-call-history\"."), _(
"\
788A size of \"unlimited\" means unlimited lines. The default is 10."),
794 _(
"Start recording."),
802 _(
"Set record options."),
803 _(
"Show record options."),
818 _(
"Save the execution log to a file.\n\
819Usage: record save [FILENAME]\n\
820Default filename is 'gdb_record.PROCESS_ID'."),
826 _(
"Delete the rest of execution log and start recording it \
834 _(
"Stop the record/replay target."),
839Restore the program to its state at instruction number N.\n\
840Argument is instruction number, as shown by 'info record'."),
845 _(
"Go to the beginning of the execution log."),
851 _(
"Go to the end of the execution log."),
855Print disassembled instructions stored in the execution log.\n\
856With a /m or /s modifier, source lines are included (if available).\n\
857With a /r modifier, raw instructions in hex are included.\n\
858With a /f modifier, function names are omitted.\n\
859With a /p modifier, current position markers are omitted.\n\
860With no argument, disassembles ten more instructions after the previous \
862\"record instruction-history -\" disassembles ten instructions before a \
863previous disassembly.\n\
864One argument specifies an instruction number as shown by 'info record', and \
865ten instructions are disassembled after that instruction.\n\
866Two arguments with comma between them specify starting and ending instruction \
867numbers to disassemble.\n\
868If the second argument is preceded by '+' or '-', it specifies the distance \
869from the first argument.\n\
870The number of instructions to disassemble can be defined with \"set record \
871instruction-history-size\"."),
875Prints the execution history at function granularity.\n\
876It prints one line for each sequence of instructions that belong to the same \
878Without modifiers, it prints the function name.\n\
879With a /l modifier, the source file and line number range is included.\n\
880With a /i modifier, the instruction number range is included.\n\
881With a /c modifier, the output is indented based on the call stack depth.\n\
882With no argument, prints ten more lines after the previous ten-line print.\n\
883\"record function-call-history -\" prints ten lines before a previous ten-line \
885One argument specifies a function number as shown by 'info record', and \
886ten lines are printed after that function.\n\
887Two arguments with comma between them specify a range of functions to print.\n\
888If the second argument is preceded by '+' or '-', it specifies the distance \
889from the first argument.\n\
890The number of functions to print can be defined with \"set record \
891function-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
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_uinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const literal_def *extra_literals, 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)
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)
void interps_notify_record_changed(inferior *inf, int started, const char *method, const char *format)
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