diff options
Diffstat (limited to 'gdb/record-btrace.c')
-rw-r--r-- | gdb/record-btrace.c | 87 |
1 files changed, 29 insertions, 58 deletions
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 2d71b72..5112181 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -132,10 +132,7 @@ public: bool can_execute_reverse () override; bool stopped_by_sw_breakpoint () override; - bool supports_stopped_by_sw_breakpoint () override; - bool stopped_by_hw_breakpoint () override; - bool supports_stopped_by_hw_breakpoint () override; enum exec_direction_kind execution_direction () override; void prepare_to_generate_core () override; @@ -396,12 +393,12 @@ record_btrace_target_open (const char *args, int from_tty) if (!target_has_execution ()) error (_("The program is not being run.")); - for (thread_info *tp : current_inferior ()->non_exited_threads ()) - if (args == NULL || *args == 0 || number_is_in_list (args, tp->global_num)) + for (thread_info &tp : current_inferior ()->non_exited_threads ()) + if (args == NULL || *args == 0 || number_is_in_list (args, tp.global_num)) { - btrace_enable (tp, &record_btrace_conf); + btrace_enable (&tp, &record_btrace_conf); - btrace_disable.add_thread (tp); + btrace_disable.add_thread (&tp); } record_btrace_push_target (); @@ -418,9 +415,9 @@ record_btrace_target::stop_recording () record_btrace_auto_disable (); - for (thread_info *tp : current_inferior ()->non_exited_threads ()) - if (tp->btrace.target != NULL) - btrace_disable (tp); + for (thread_info &tp : current_inferior ()->non_exited_threads ()) + if (tp.btrace.target != NULL) + btrace_disable (&tp); } /* The disconnect method of target record-btrace. */ @@ -452,8 +449,8 @@ record_btrace_target::close () /* We should have already stopped recording. Tear down btrace in case we have not. */ - for (thread_info *tp : current_inferior ()->non_exited_threads ()) - btrace_teardown (tp); + for (thread_info &tp : current_inferior ()->non_exited_threads ()) + btrace_teardown (&tp); } /* The async method of target record-btrace. */ @@ -1461,8 +1458,8 @@ bool record_btrace_target::record_is_replaying (ptid_t ptid) { process_stratum_target *proc_target = current_inferior ()->process_target (); - for (thread_info *tp : all_non_exited_threads (proc_target, ptid)) - if (btrace_is_replaying (tp)) + for (thread_info &tp : all_non_exited_threads (proc_target, ptid)) + if (btrace_is_replaying (&tp)) return true; return false; @@ -2222,18 +2219,18 @@ record_btrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal) { gdb_assert (inferior_ptid.matches (ptid)); - for (thread_info *tp : all_non_exited_threads (proc_target, ptid)) + for (thread_info &tp : all_non_exited_threads (proc_target, ptid)) { - if (tp->ptid.matches (inferior_ptid)) - record_btrace_resume_thread (tp, flag); + if (tp.ptid.matches (inferior_ptid)) + record_btrace_resume_thread (&tp, flag); else - record_btrace_resume_thread (tp, cflag); + record_btrace_resume_thread (&tp, cflag); } } else { - for (thread_info *tp : all_non_exited_threads (proc_target, ptid)) - record_btrace_resume_thread (tp, flag); + for (thread_info &tp : all_non_exited_threads (proc_target, ptid)) + record_btrace_resume_thread (&tp, flag); } /* Async support. */ @@ -2581,7 +2578,7 @@ record_btrace_maybe_mark_async_event const std::vector<thread_info *> &no_history) { bool more_moving = !moving.empty (); - bool more_no_history = !no_history.empty ();; + bool more_no_history = !no_history.empty (); if (!more_moving && !more_no_history) return; @@ -2619,9 +2616,9 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status, /* Keep a work list of moving threads. */ process_stratum_target *proc_target = current_inferior ()->process_target (); - for (thread_info *tp : all_non_exited_threads (proc_target, ptid)) - if ((tp->btrace.flags & (BTHR_MOVE | BTHR_STOP)) != 0) - moving.push_back (tp); + for (thread_info &tp : all_non_exited_threads (proc_target, ptid)) + if ((tp.btrace.flags & (BTHR_MOVE | BTHR_STOP)) != 0) + moving.push_back (&tp); if (moving.empty ()) { @@ -2702,8 +2699,8 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status, /* Stop all other threads. */ if (!target_is_non_stop_p ()) { - for (thread_info *tp : current_inferior ()->non_exited_threads ()) - record_btrace_cancel_resume (tp); + for (thread_info &tp : current_inferior ()->non_exited_threads ()) + record_btrace_cancel_resume (&tp); } /* In async mode, we need to announce further events. */ @@ -2742,10 +2739,10 @@ record_btrace_target::stop (ptid_t ptid) process_stratum_target *proc_target = current_inferior ()->process_target (); - for (thread_info *tp : all_non_exited_threads (proc_target, ptid)) + for (thread_info &tp : all_non_exited_threads (proc_target, ptid)) { - tp->btrace.flags &= ~BTHR_MOVE; - tp->btrace.flags |= BTHR_STOP; + tp.btrace.flags &= ~BTHR_MOVE; + tp.btrace.flags |= BTHR_STOP; } } } @@ -2773,18 +2770,6 @@ record_btrace_target::stopped_by_sw_breakpoint () return this->beneath ()->stopped_by_sw_breakpoint (); } -/* The supports_stopped_by_sw_breakpoint method of target - record-btrace. */ - -bool -record_btrace_target::supports_stopped_by_sw_breakpoint () -{ - if (record_is_replaying (minus_one_ptid)) - return true; - - return this->beneath ()->supports_stopped_by_sw_breakpoint (); -} - /* The stopped_by_sw_breakpoint method of target record-btrace. */ bool @@ -2800,18 +2785,6 @@ record_btrace_target::stopped_by_hw_breakpoint () return this->beneath ()->stopped_by_hw_breakpoint (); } -/* The supports_stopped_by_hw_breakpoint method of target - record-btrace. */ - -bool -record_btrace_target::supports_stopped_by_hw_breakpoint () -{ - if (record_is_replaying (minus_one_ptid)) - return true; - - return this->beneath ()->supports_stopped_by_hw_breakpoint (); -} - /* The update_thread_list method of target record-btrace. */ void @@ -2945,8 +2918,8 @@ record_btrace_target::goto_record (ULONGEST insn_number) void record_btrace_target::record_stop_replaying () { - for (thread_info *tp : current_inferior ()->non_exited_threads ()) - record_btrace_stop_replaying (tp); + for (thread_info &tp : current_inferior ()->non_exited_threads ()) + record_btrace_stop_replaying (&tp); } /* The execution_direction target method. */ @@ -3213,9 +3186,7 @@ set_record_pt_event_tracing_value (const char *args, int from_tty, /* Initialize btrace commands. */ -void _initialize_record_btrace (); -void -_initialize_record_btrace () +INIT_GDB_FILE (record_btrace) { cmd_list_element *record_btrace_cmd = add_prefix_cmd ("btrace", class_obscure, cmd_record_btrace_start, |