gdb: fix python/lib/gdb/__init__.py formatting
[deliverable/binutils-gdb.git] / gdb / record-full.c
index 247573cc5c6403fe39816506b12df770cd0d5fad..9e157c6e04892b2db66cd62540b288d5a7295ae2 100644 (file)
@@ -903,7 +903,6 @@ static struct async_event_handler *record_full_async_inferior_event_token;
 static void
 record_full_async_inferior_event_handler (gdb_client_data data)
 {
-  clear_async_event_handler (record_full_async_inferior_event_token);
   inferior_event_handler (INF_REG_EVENT);
 }
 
@@ -925,7 +924,7 @@ record_full_core_open_1 (const char *name, int from_tty)
 
   record_full_core_sections = build_section_table (core_bfd);
 
-  push_target (&record_full_core_ops);
+  current_inferior ()->push_target (&record_full_core_ops);
   record_full_restore ();
 }
 
@@ -948,7 +947,7 @@ record_full_open_1 (const char *name, int from_tty)
     error (_("Process record: the current architecture doesn't support "
             "record function."));
 
-  push_target (&record_full_ops);
+  current_inferior ()->push_target (&record_full_ops);
 }
 
 static void record_full_init_record_breakpoints (void);
@@ -1237,17 +1236,17 @@ record_full_wait_1 (struct target_ops *ops,
 
                      if (!record_full_message_wrapper_safe (regcache,
                                                             GDB_SIGNAL_0))
-                       {
+                       {
                           status->kind = TARGET_WAITKIND_STOPPED;
                           status->value.sig = GDB_SIGNAL_0;
                           break;
-                       }
+                       }
+
+                     process_stratum_target *proc_target
+                       = current_inferior ()->process_target ();
 
                      if (gdbarch_software_single_step_p (gdbarch))
                        {
-                         process_stratum_target *proc_target
-                           = current_inferior ()->process_target ();
-
                          /* Try to insert the software single step breakpoint.
                             If insert success, set step to 0.  */
                          set_executing (proc_target, inferior_ptid, false);
@@ -1264,7 +1263,9 @@ record_full_wait_1 (struct target_ops *ops,
                                            "issuing one more step in the "
                                            "target beneath\n");
                      ops->beneath ()->resume (ptid, step, GDB_SIGNAL_0);
-                     ops->beneath ()->commit_resume ();
+                     proc_target->commit_resumed_state = true;
+                     proc_target->commit_resumed ();
+                     proc_target->commit_resumed_state = false;
                      continue;
                    }
                }
@@ -1454,6 +1455,8 @@ record_full_base_target::wait (ptid_t ptid, struct target_waitstatus *status,
 {
   ptid_t return_ptid;
 
+  clear_async_event_handler (record_full_async_inferior_event_token);
+
   return_ptid = record_full_wait_1 (this, ptid, status, options);
   if (status->kind != TARGET_WAITKIND_IGNORE)
     {
@@ -1716,21 +1719,6 @@ struct record_full_breakpoint
    active.  */
 static std::vector<record_full_breakpoint> record_full_breakpoints;
 
-static void
-record_full_sync_record_breakpoints (struct bp_location *loc, void *data)
-{
-  if (loc->loc_type != bp_loc_software_breakpoint)
-      return;
-
-  if (loc->inserted)
-    {
-      record_full_breakpoints.emplace_back
-       (loc->target_info.placed_address_space,
-        loc->target_info.placed_address,
-        1);
-    }
-}
-
 /* Sync existing breakpoints to record_full_breakpoints.  */
 
 static void
@@ -1738,7 +1726,16 @@ record_full_init_record_breakpoints (void)
 {
   record_full_breakpoints.clear ();
 
-  iterate_over_bp_locations (record_full_sync_record_breakpoints);
+  for (bp_location *loc : all_bp_locations ())
+    {
+      if (loc->loc_type != bp_loc_software_breakpoint)
+       continue;
+
+      if (loc->inserted)
+       record_full_breakpoints.emplace_back
+         (loc->target_info.placed_address_space,
+          loc->target_info.placed_address, 1);
+    }
 }
 
 /* Behavior is conditional on RECORD_FULL_IS_REPLAY.  We will not actually
@@ -2077,7 +2074,7 @@ record_full_core_target::kill ()
   if (record_debug)
     fprintf_unfiltered (gdb_stdlog, "Process record: record_full_core_kill\n");
 
-  unpush_target (this);
+  current_inferior ()->unpush_target (this);
 }
 
 /* "fetch_registers" method for prec over corefile.  */
@@ -2791,84 +2788,91 @@ _initialize_record_full ()
 
   add_prefix_cmd ("full", class_obscure, cmd_record_full_start,
                  _("Start full execution recording."), &record_full_cmdlist,
-                 "record full ", 0, &record_cmdlist);
+                 0, &record_cmdlist);
 
-  c = add_cmd ("restore", class_obscure, cmd_record_full_restore,
+  cmd_list_element *record_full_restore_cmd
+    = add_cmd ("restore", class_obscure, cmd_record_full_restore,
               _("Restore the execution log from a file.\n\
 Argument is filename.  File must be created with 'record save'."),
               &record_full_cmdlist);
-  set_cmd_completer (c, filename_completer);
+  set_cmd_completer (record_full_restore_cmd, filename_completer);
 
   /* Deprecate the old version without "full" prefix.  */
-  c = add_alias_cmd ("restore", "full restore", class_obscure, 1,
+  c = add_alias_cmd ("restore", record_full_restore_cmd, class_obscure, 1,
                     &record_cmdlist);
   set_cmd_completer (c, filename_completer);
   deprecate_cmd (c, "record full restore");
 
   add_basic_prefix_cmd ("full", class_support,
                        _("Set record options."), &set_record_full_cmdlist,
-                       "set record full ", 0, &set_record_cmdlist);
+                       0, &set_record_cmdlist);
 
   add_show_prefix_cmd ("full", class_support,
                       _("Show record options."), &show_record_full_cmdlist,
-                      "show record full ", 0, &show_record_cmdlist);
+                      0, &show_record_cmdlist);
 
   /* Record instructions number limit command.  */
-  add_setshow_boolean_cmd ("stop-at-limit", no_class,
-                          &record_full_stop_at_limit, _("\
+  set_show_commands set_record_full_stop_at_limit_cmds
+    = add_setshow_boolean_cmd ("stop-at-limit", no_class,
+                              &record_full_stop_at_limit, _("\
 Set whether record/replay stops when record/replay buffer becomes full."), _("\
 Show whether record/replay stops when record/replay buffer becomes full."),
                           _("Default is ON.\n\
 When ON, if the record/replay buffer becomes full, ask user what to do.\n\
 When OFF, if the record/replay buffer becomes full,\n\
 delete the oldest recorded instruction to make room for each new one."),
-                          NULL, NULL,
-                          &set_record_full_cmdlist, &show_record_full_cmdlist);
+                              NULL, NULL,
+                              &set_record_full_cmdlist,
+                              &show_record_full_cmdlist);
 
-  c = add_alias_cmd ("stop-at-limit", "full stop-at-limit", no_class, 1,
+  c = add_alias_cmd ("stop-at-limit",
+                    set_record_full_stop_at_limit_cmds.set, no_class, 1,
                     &set_record_cmdlist);
   deprecate_cmd (c, "set record full stop-at-limit");
 
-  c = add_alias_cmd ("stop-at-limit", "full stop-at-limit", no_class, 1,
+  c = add_alias_cmd ("stop-at-limit",
+                    set_record_full_stop_at_limit_cmds.show, no_class, 1,
                     &show_record_cmdlist);
   deprecate_cmd (c, "show record full stop-at-limit");
 
-  add_setshow_uinteger_cmd ("insn-number-max", no_class,
-                           &record_full_insn_max_num,
-                           _("Set record/replay buffer limit."),
-                           _("Show record/replay buffer limit."), _("\
+  set_show_commands record_full_insn_number_max_cmds
+    = add_setshow_uinteger_cmd ("insn-number-max", no_class,
+                               &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.  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);
+                               set_record_full_insn_max_num,
+                               NULL, &set_record_full_cmdlist,
+                               &show_record_full_cmdlist);
 
-  c = add_alias_cmd ("insn-number-max", "full insn-number-max", no_class, 1,
-                    &set_record_cmdlist);
+  c = add_alias_cmd ("insn-number-max", record_full_insn_number_max_cmds.set,
+                    no_class, 1, &set_record_cmdlist);
   deprecate_cmd (c, "set record full insn-number-max");
 
-  c = add_alias_cmd ("insn-number-max", "full insn-number-max", no_class, 1,
-                    &show_record_cmdlist);
+  c = add_alias_cmd ("insn-number-max", record_full_insn_number_max_cmds.show,
+                    no_class, 1, &show_record_cmdlist);
   deprecate_cmd (c, "show record full insn-number-max");
 
-  add_setshow_boolean_cmd ("memory-query", no_class,
-                          &record_full_memory_query, _("\
+  set_show_commands record_full_memory_query_cmds
+    = add_setshow_boolean_cmd ("memory-query", no_class,
+                              &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."),
-                          _("\
+                              _("\
 Default is OFF.\n\
 When ON, query if PREC cannot record memory change of next instruction."),
-                          NULL, NULL,
-                          &set_record_full_cmdlist,
-                          &show_record_full_cmdlist);
+                              NULL, NULL,
+                              &set_record_full_cmdlist,
+                              &show_record_full_cmdlist);
 
-  c = add_alias_cmd ("memory-query", "full memory-query", no_class, 1,
-                    &set_record_cmdlist);
+  c = add_alias_cmd ("memory-query", record_full_memory_query_cmds.set,
+                    no_class, 1, &set_record_cmdlist);
   deprecate_cmd (c, "set record full memory-query");
 
-  c = add_alias_cmd ("memory-query", "full memory-query", no_class, 1,
-                    &show_record_cmdlist);
+  c = add_alias_cmd ("memory-query", record_full_memory_query_cmds.show,
+                    no_class, 1,&show_record_cmdlist);
   deprecate_cmd (c, "show record full memory-query");
 }
This page took 0.026828 seconds and 4 git commands to generate.