Accept "set foo unlimited" in integer/uinteger/zuinteger_unlimited commands.
[deliverable/binutils-gdb.git] / gdb / record-full.c
index 14f440093044f3b8b75bbc23d365f710ea2537fb..03d287d0f03d849b74f197046bb756046385de2d 100644 (file)
@@ -156,7 +156,7 @@ struct record_full_entry
 
 /* If true, query if PREC cannot record memory
    change of next instruction.  */
-int record_memory_query = 0;
+int record_full_memory_query = 0;
 
 struct record_full_core_buf_entry
 {
@@ -199,7 +199,7 @@ static int record_full_stop_at_limit = 1;
 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;
@@ -483,7 +483,7 @@ record_full_get_loc (struct record_full_entry *rec)
 /* Record the value of a register NUM to record_full_arch_list.  */
 
 int
-record_arch_list_add_reg (struct regcache *regcache, int regnum)
+record_full_arch_list_add_reg (struct regcache *regcache, int regnum)
 {
   struct record_full_entry *rec;
 
@@ -506,7 +506,7 @@ record_arch_list_add_reg (struct regcache *regcache, int regnum)
    length is LEN to record_full_arch_list.  */
 
 int
-record_arch_list_add_mem (CORE_ADDR addr, int len)
+record_full_arch_list_add_mem (CORE_ADDR addr, int len)
 {
   struct record_full_entry *rec;
 
@@ -537,7 +537,7 @@ record_arch_list_add_mem (CORE_ADDR addr, int len)
    record_full_arch_list.  */
 
 int
-record_arch_list_add_end (void)
+record_full_arch_list_add_end (void)
 {
   struct record_full_entry *rec;
 
@@ -557,28 +557,24 @@ record_arch_list_add_end (void)
 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."));
        }
     }
 }
@@ -659,8 +655,7 @@ record_full_message (struct regcache *regcache, enum gdb_signal signal)
   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++;
@@ -701,7 +696,7 @@ record_full_message_wrapper_safe (struct regcache *regcache,
 static int record_full_gdb_operation_disable = 0;
 
 struct cleanup *
-record_gdb_operation_disable_set (void)
+record_full_gdb_operation_disable_set (void)
 {
   struct cleanup *old_cleanups = NULL;
 
@@ -1021,7 +1016,7 @@ record_full_open (char *name, int from_tty)
 /* "to_close" target method.  Close the process record target.  */
 
 static void
-record_full_close (int quitting)
+record_full_close (void)
 {
   struct record_full_core_buf_entry *entry;
 
@@ -1189,7 +1184,7 @@ record_full_wait_1 (struct target_ops *ops,
                    ptid_t ptid, struct target_waitstatus *status,
                    int options)
 {
-  struct cleanup *set_cleanups = record_gdb_operation_disable_set ();
+  struct cleanup *set_cleanups = record_full_gdb_operation_disable_set ();
 
   if (record_debug)
     fprintf_unfiltered (gdb_stdlog,
@@ -1523,56 +1518,6 @@ record_full_stopped_by_watchpoint (void)
     return record_full_beneath_to_stopped_by_watchpoint ();
 }
 
-/* "to_disconnect" method for process record target.  */
-
-static void
-record_full_disconnect (struct target_ops *target, char *args, int from_tty)
-{
-  if (record_debug)
-    fprintf_unfiltered (gdb_stdlog,
-                       "Process record: record_full_disconnect\n");
-
-  unpush_target (&record_full_ops);
-  target_disconnect (args, from_tty);
-}
-
-/* "to_detach" method for process record target.  */
-
-static void
-record_full_detach (struct target_ops *ops, char *args, int from_tty)
-{
-  if (record_debug)
-    fprintf_unfiltered (gdb_stdlog, "Process record: record_full_detach\n");
-
-  unpush_target (&record_full_ops);
-  target_detach (args, from_tty);
-}
-
-/* "to_mourn_inferior" method for process record target.  */
-
-static void
-record_full_mourn_inferior (struct target_ops *ops)
-{
-  if (record_debug)
-    fprintf_unfiltered (gdb_stdlog, "Process record: "
-                                   "record_full_mourn_inferior\n");
-
-  unpush_target (&record_full_ops);
-  target_mourn_inferior ();
-}
-
-/* Close process record target before killing the inferior process.  */
-
-static void
-record_full_kill (struct target_ops *ops)
-{
-  if (record_debug)
-    fprintf_unfiltered (gdb_stdlog, "Process record: record_full_kill\n");
-
-  unpush_target (&record_full_ops);
-  target_kill ();
-}
-
 static int
 record_full_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
 {
@@ -1599,7 +1544,7 @@ record_full_registers_change (struct regcache *regcache, int regnum)
 
       for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
        {
-         if (record_arch_list_add_reg (regcache, i))
+         if (record_full_arch_list_add_reg (regcache, i))
            {
              record_full_list_release (record_full_arch_list_tail);
              error (_("Process record: failed to record execution log."));
@@ -1608,13 +1553,13 @@ record_full_registers_change (struct regcache *regcache, int regnum)
     }
   else
     {
-      if (record_arch_list_add_reg (regcache, regnum))
+      if (record_full_arch_list_add_reg (regcache, regnum))
        {
          record_full_list_release (record_full_arch_list_tail);
          error (_("Process record: failed to record execution log."));
        }
     }
-  if (record_arch_list_add_end ())
+  if (record_full_arch_list_add_end ())
     {
       record_full_list_release (record_full_arch_list_tail);
       error (_("Process record: failed to record execution log."));
@@ -1623,8 +1568,7 @@ record_full_registers_change (struct regcache *regcache, int regnum)
   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++;
@@ -1721,7 +1665,7 @@ record_full_xfer_partial (struct target_ops *ops, enum target_object object,
       /* Record registers change to list as an instruction.  */
       record_full_arch_list_head = NULL;
       record_full_arch_list_tail = NULL;
-      if (record_arch_list_add_mem (offset, len))
+      if (record_full_arch_list_add_mem (offset, len))
        {
          record_full_list_release (record_full_arch_list_tail);
          if (record_debug)
@@ -1730,7 +1674,7 @@ record_full_xfer_partial (struct target_ops *ops, enum target_object object,
                                "execution log.");
          return -1;
        }
-      if (record_arch_list_add_end ())
+      if (record_full_arch_list_add_end ())
        {
          record_full_list_release (record_full_arch_list_tail);
          if (record_debug)
@@ -1743,8 +1687,7 @@ record_full_xfer_partial (struct target_ops *ops, enum target_object object,
       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++;
@@ -1831,7 +1774,7 @@ record_full_insert_breakpoint (struct gdbarch *gdbarch,
       struct cleanup *old_cleanups;
       int ret;
 
-      old_cleanups = record_gdb_operation_disable_set ();
+      old_cleanups = record_full_gdb_operation_disable_set ();
       ret = record_full_beneath_to_insert_breakpoint (gdbarch, bp_tgt);
       do_cleanups (old_cleanups);
 
@@ -1871,7 +1814,7 @@ record_full_remove_breakpoint (struct gdbarch *gdbarch,
              struct cleanup *old_cleanups;
              int ret;
 
-             old_cleanups = record_gdb_operation_disable_set ();
+             old_cleanups = record_full_gdb_operation_disable_set ();
              ret = record_full_beneath_to_remove_breakpoint (gdbarch, bp_tgt);
              do_cleanups (old_cleanups);
 
@@ -2008,14 +1951,14 @@ record_full_info (void)
                       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);
 }
 
@@ -2117,10 +2060,10 @@ init_record_full_ops (void)
   record_full_ops.to_close = record_full_close;
   record_full_ops.to_resume = record_full_resume;
   record_full_ops.to_wait = record_full_wait;
-  record_full_ops.to_disconnect = record_full_disconnect;
-  record_full_ops.to_detach = record_full_detach;
-  record_full_ops.to_mourn_inferior = record_full_mourn_inferior;
-  record_full_ops.to_kill = record_full_kill;
+  record_full_ops.to_disconnect = record_disconnect;
+  record_full_ops.to_detach = record_detach;
+  record_full_ops.to_mourn_inferior = record_mourn_inferior;
+  record_full_ops.to_kill = record_kill;
   record_full_ops.to_create_inferior = find_default_create_inferior;
   record_full_ops.to_store_registers = record_full_store_registers;
   record_full_ops.to_xfer_partial = record_full_xfer_partial;
@@ -2636,7 +2579,7 @@ record_full_restore (void)
   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);
     }
 
@@ -2717,7 +2660,7 @@ record_full_save (char *recfilename)
   gdbarch = get_regcache_arch (regcache);
 
   /* Disable the GDB operation record.  */
-  set_cleanups = record_gdb_operation_disable_set ();
+  set_cleanups = record_full_gdb_operation_disable_set ();
 
   /* Reverse execute to the begin of record list.  */
   while (1)
@@ -2897,7 +2840,7 @@ static void
 record_full_goto_insn (struct record_full_entry *entry,
                       enum exec_direction_kind dir)
 {
-  struct cleanup *set_cleanups = record_gdb_operation_disable_set ();
+  struct cleanup *set_cleanups = record_full_gdb_operation_disable_set ();
   struct regcache *regcache = get_current_regcache ();
   struct gdbarch *gdbarch = get_regcache_arch (regcache);
 
@@ -2930,8 +2873,7 @@ static void
 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)
@@ -3029,7 +2971,8 @@ delete the oldest recorded instruction to make room for each new one."),
                            _("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);
@@ -3043,7 +2986,7 @@ record/replay buffer.  Zero means unlimited.  Default is 200000."),
   deprecate_cmd (c, "show record full insn-number-max");
 
   add_setshow_boolean_cmd ("memory-query", no_class,
-                          &record_memory_query, _("\
+                          &record_full_memory_query, _("\
 Set whether query if PREC cannot record memory change of next instruction."),
                            _("\
 Show whether query if PREC cannot record memory change of next instruction."),
This page took 0.046558 seconds and 4 git commands to generate.