/* Process record and replay target for GDB, the GNU debugger.
- Copyright (C) 2013 Free Software Foundation, Inc.
+ Copyright (C) 2013-2014 Free Software Foundation, Inc.
This file is part of GDB.
static unsigned int record_full_insn_max_num
= DEFAULT_RECORD_FULL_INSN_MAX_NUM;
/* Actual count of insns presently in execution log. */
-static int record_full_insn_num = 0;
+static unsigned int record_full_insn_num = 0;
/* Count of insns logged so far (may be larger
than count of insns presently in execution log). */
static ULONGEST record_full_insn_count;
struct regcache *,
int regno);
static struct target_ops *record_full_beneath_to_xfer_partial_ops;
-static LONGEST
- (*record_full_beneath_to_xfer_partial) (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset,
- LONGEST len);
+static target_xfer_partial_ftype *record_full_beneath_to_xfer_partial;
static int
(*record_full_beneath_to_insert_breakpoint) (struct gdbarch *,
struct bp_target_info *);
static void record_full_goto_insn (struct record_full_entry *entry,
enum exec_direction_kind dir);
-static void record_full_save (char *recfilename);
+static void record_full_save (const char *recfilename);
/* Alloc and free functions for record_full_reg, record_full_mem, and
record_full_end entries. */
static void
record_full_check_insn_num (int set_terminal)
{
- if (record_full_insn_max_num)
+ if (record_full_insn_num == record_full_insn_max_num)
{
- gdb_assert (record_full_insn_num <= record_full_insn_max_num);
- if (record_full_insn_num == record_full_insn_max_num)
+ /* Ask user what to do. */
+ if (record_full_stop_at_limit)
{
- /* Ask user what to do. */
- if (record_full_stop_at_limit)
- {
- int q;
-
- if (set_terminal)
- target_terminal_ours ();
- q = yquery (_("Do you want to auto delete previous execution "
- "log entries when record/replay buffer becomes "
- "full (record full stop-at-limit)?"));
- if (set_terminal)
- target_terminal_inferior ();
- if (q)
- record_full_stop_at_limit = 0;
- else
- error (_("Process record: stopped by user."));
- }
+ int q;
+
+ if (set_terminal)
+ target_terminal_ours ();
+ q = yquery (_("Do you want to auto delete previous execution "
+ "log entries when record/replay buffer becomes "
+ "full (record full stop-at-limit)?"));
+ if (set_terminal)
+ target_terminal_inferior ();
+ if (q)
+ record_full_stop_at_limit = 0;
+ else
+ error (_("Process record: stopped by user."));
}
}
}
record_full_arch_list_head->prev = record_full_list;
record_full_list = record_full_arch_list_tail;
- if (record_full_insn_num == record_full_insn_max_num
- && record_full_insn_max_num)
+ if (record_full_insn_num == record_full_insn_max_num)
record_full_list_release_first ();
else
record_full_insn_num++;
struct regcache *,
int regno);
static struct target_ops *tmp_to_xfer_partial_ops;
-static LONGEST (*tmp_to_xfer_partial) (struct target_ops *ops,
- enum target_object object,
- const char *annex,
- gdb_byte *readbuf,
- const gdb_byte *writebuf,
- ULONGEST offset,
- LONGEST len);
+static target_xfer_partial_ftype *tmp_to_xfer_partial;
static int (*tmp_to_insert_breakpoint) (struct gdbarch *,
struct bp_target_info *);
static int (*tmp_to_remove_breakpoint) (struct gdbarch *,
record_full_arch_list_head->prev = record_full_list;
record_full_list = record_full_arch_list_tail;
- if (record_full_insn_num == record_full_insn_max_num
- && record_full_insn_max_num)
+ if (record_full_insn_num == record_full_insn_max_num)
record_full_list_release_first ();
else
record_full_insn_num++;
record_full_arch_list_head->prev = record_full_list;
record_full_list = record_full_arch_list_tail;
- if (record_full_insn_num == record_full_insn_max_num
- && record_full_insn_max_num)
+ if (record_full_insn_num == record_full_insn_max_num)
record_full_list_release_first ();
else
record_full_insn_num++;
static gdb_byte *
record_full_get_bookmark (char *args, int from_tty)
{
- gdb_byte *ret = NULL;
+ char *ret = NULL;
/* Return stringified form of instruction count. */
if (record_full_list && record_full_list->type == record_full_end)
fprintf_unfiltered (gdb_stdlog,
"record_full_get_bookmark returns NULL\n");
}
- return ret;
+ return (gdb_byte *) ret;
}
/* "to_goto_bookmark" method for process record and prec over core. */
static void
-record_full_goto_bookmark (gdb_byte *bookmark, int from_tty)
+record_full_goto_bookmark (gdb_byte *raw_bookmark, int from_tty)
{
+ char *bookmark = (char *) raw_bookmark;
+
if (record_debug)
fprintf_unfiltered (gdb_stdlog,
"record_full_goto_bookmark receives %s\n", bookmark);
/* Pass along to cmd_record_full_goto. */
}
- cmd_record_goto ((char *) bookmark, from_tty);
+ cmd_record_goto (bookmark, from_tty);
return;
}
pulongest (record_full_insn_count));
/* Display log count. */
- printf_filtered (_("Log contains %d instructions.\n"),
+ printf_filtered (_("Log contains %u instructions.\n"),
record_full_insn_num);
}
else
printf_filtered (_("No instructions have been logged.\n"));
/* Display max log size. */
- printf_filtered (_("Max logged instructions is %d.\n"),
+ printf_filtered (_("Max logged instructions is %u.\n"),
record_full_insn_max_num);
}
registers_changed ();
reinit_frame_cache ();
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+ print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
}
/* The "to_goto_record_begin" target method. */
xmalloc
(sizeof (struct record_full_core_buf_entry));
entry->p = p;
- if (!bfd_malloc_and_get_section (p->bfd,
- p->the_bfd_section,
- &entry->buf))
+ if (!bfd_malloc_and_get_section
+ (p->the_bfd_section->owner,
+ p->the_bfd_section,
+ &entry->buf))
{
xfree (entry);
return 0;
if (record_full_insn_num > record_full_insn_max_num)
{
record_full_insn_max_num = record_full_insn_num;
- warning (_("Auto increase record/replay buffer limit to %d."),
+ warning (_("Auto increase record/replay buffer limit to %u."),
record_full_insn_max_num);
}
printf_filtered (_("Restored records from core file %s.\n"),
bfd_get_filename (core_bfd));
- print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC);
+ print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC, 1);
}
/* bfdcore_write -- write bytes into a core file section. */
format, with an extra section for our data. */
static void
-record_full_save (char *recfilename)
+record_full_save (const char *recfilename)
{
struct record_full_entry *cur_record_full_list;
uint32_t magic;
set_record_full_insn_max_num (char *args, int from_tty,
struct cmd_list_element *c)
{
- if (record_full_insn_num > record_full_insn_max_num
- && record_full_insn_max_num)
+ if (record_full_insn_num > record_full_insn_max_num)
{
/* Count down record_full_insn_num while releasing records from list. */
while (record_full_insn_num > record_full_insn_max_num)
_("Set record/replay buffer limit."),
_("Show record/replay buffer limit."), _("\
Set the maximum number of instructions to be stored in the\n\
-record/replay buffer. Zero means unlimited. Default is 200000."),
+record/replay buffer. A value of either \"unlimited\" or zero means no\n\
+limit. Default is 200000."),
set_record_full_insn_max_num,
NULL, &set_record_full_cmdlist,
&show_record_full_cmdlist);