/* Branch trace support for GDB, the GNU debugger.
- Copyright (C) 2013-2020 Free Software Foundation, Inc.
+ Copyright (C) 2013-2021 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
const struct frame_unwind *get_tailcall_unwinder () override;
- void commit_resume () override;
void resume (ptid_t, int, enum gdb_signal) override;
ptid_t wait (ptid_t, struct target_waitstatus *, target_wait_flags) override;
do \
{ \
if (record_debug != 0) \
- fprintf_unfiltered (gdb_stdlog, \
+ fprintf_unfiltered (gdb_stdlog, \
"[record-btrace] " msg "\n", ##args); \
} \
while (0)
DEBUG ("attach thread observer");
gdb::observers::new_thread.attach (record_btrace_enable_warn,
- record_btrace_thread_observer_token);
+ record_btrace_thread_observer_token,
+ "record-btrace");
}
/* Disable automatic tracing of new threads. */
record_btrace_auto_enable ();
- push_target (&record_btrace_ops);
+ current_inferior ()->push_target (&record_btrace_ops);
record_btrace_async_inferior_event_handler
= create_async_event_handler (record_btrace_handle_async_inferior_event,
- NULL);
+ NULL, "record-btrace");
record_btrace_generating_corefile = 0;
format = btrace_format_short_string (record_btrace_conf.format);
record_preopen ();
- if (!target_has_execution)
+ if (!target_has_execution ())
error (_("The program is not being run."));
for (thread_info *tp : current_inferior ()->non_exited_threads ())
struct target_ops *beneath = this->beneath ();
/* Do not stop recording, just clean up GDB side. */
- unpush_target (this);
+ current_inferior ()->unpush_target (this);
/* Forward disconnect. */
beneath->disconnect (args, from_tty);
gdb_pretty_print_disassembler disasm (gdbarch, uiout);
for (btrace_insn_iterator it = *begin; btrace_insn_cmp (&it, end) != 0;
- btrace_insn_next (&it, 1))
+ btrace_insn_next (&it, 1))
{
const struct btrace_insn *insn;
{
case TARGET_OBJECT_MEMORY:
{
- struct target_section *section;
+ const struct target_section *section;
/* We do not allow writing memory in general. */
if (writebuf != NULL)
const struct frame_unwind record_btrace_frame_unwind =
{
+ "record-btrace",
NORMAL_FRAME,
record_btrace_frame_unwind_stop_reason,
record_btrace_frame_this_id,
const struct frame_unwind record_btrace_tailcall_frame_unwind =
{
+ "record-btrace tailcall",
TAILCALL_FRAME,
record_btrace_frame_unwind_stop_reason,
record_btrace_frame_this_id,
}
}
-/* The commit_resume method of target record-btrace. */
-
-void
-record_btrace_target::commit_resume ()
-{
- if ((::execution_direction != EXEC_REVERSE)
- && !record_is_replaying (minus_one_ptid))
- beneath ()->commit_resume ();
-}
-
/* Cancel resuming TP. */
static void
std::vector<thread_info *> moving;
std::vector<thread_info *> no_history;
+ /* Clear this, if needed we'll re-mark it below. */
+ clear_async_event_handler (record_btrace_async_inferior_event_handler);
+
DEBUG ("wait %s (0x%x)", target_pid_to_str (ptid).c_str (),
(unsigned) options);
void
_initialize_record_btrace ()
{
- add_prefix_cmd ("btrace", class_obscure, cmd_record_btrace_start,
- _("Start branch trace recording."), &record_btrace_cmdlist,
- "record btrace ", 0, &record_cmdlist);
- add_alias_cmd ("b", "btrace", class_obscure, 1, &record_cmdlist);
+ cmd_list_element *record_btrace_cmd
+ = add_prefix_cmd ("btrace", class_obscure, cmd_record_btrace_start,
+ _("Start branch trace recording."),
+ &record_btrace_cmdlist, 0, &record_cmdlist);
+ add_alias_cmd ("b", record_btrace_cmd, class_obscure, 1, &record_cmdlist);
- add_cmd ("bts", class_obscure, cmd_record_btrace_bts_start,
- _("\
+ cmd_list_element *record_btrace_bts_cmd
+ = add_cmd ("bts", class_obscure, cmd_record_btrace_bts_start,
+ _("\
Start branch trace recording in Branch Trace Store (BTS) format.\n\n\
The processor stores a from/to record for each branch into a cyclic buffer.\n\
This format may not be available on all processors."),
- &record_btrace_cmdlist);
- add_alias_cmd ("bts", "btrace bts", class_obscure, 1, &record_cmdlist);
+ &record_btrace_cmdlist);
+ add_alias_cmd ("bts", record_btrace_bts_cmd, class_obscure, 1,
+ &record_cmdlist);
- add_cmd ("pt", class_obscure, cmd_record_btrace_pt_start,
- _("\
+ cmd_list_element *record_btrace_pt_cmd
+ = add_cmd ("pt", class_obscure, cmd_record_btrace_pt_start,
+ _("\
Start branch trace recording in Intel Processor Trace format.\n\n\
This format may not be available on all processors."),
- &record_btrace_cmdlist);
- add_alias_cmd ("pt", "btrace pt", class_obscure, 1, &record_cmdlist);
+ &record_btrace_cmdlist);
+ add_alias_cmd ("pt", record_btrace_pt_cmd, class_obscure, 1, &record_cmdlist);
add_basic_prefix_cmd ("btrace", class_support,
_("Set record options."), &set_record_btrace_cmdlist,
- "set record btrace ", 0, &set_record_cmdlist);
+ 0, &set_record_cmdlist);
add_show_prefix_cmd ("btrace", class_support,
_("Show record options."), &show_record_btrace_cmdlist,
- "show record btrace ", 0, &show_record_cmdlist);
+ 0, &show_record_cmdlist);
add_setshow_enum_cmd ("replay-memory-access", no_class,
replay_memory_access_types, &replay_memory_access, _("\
workarounds for a similar cpu that GDB supports.\n\n\
When set to \"none\", errata workarounds are disabled."),
&set_record_btrace_cpu_cmdlist,
- "set record btrace cpu ", 1,
+ 1,
&set_record_btrace_cmdlist);
add_cmd ("auto", class_support, cmd_set_record_btrace_cpu_auto, _("\
add_basic_prefix_cmd ("bts", class_support,
_("Set record btrace bts options."),
&set_record_btrace_bts_cmdlist,
- "set record btrace bts ", 0,
+ 0,
&set_record_btrace_cmdlist);
add_show_prefix_cmd ("bts", class_support,
_("Show record btrace bts options."),
&show_record_btrace_bts_cmdlist,
- "show record btrace bts ", 0,
+ 0,
&show_record_btrace_cmdlist);
add_setshow_uinteger_cmd ("buffer-size", no_class,
add_basic_prefix_cmd ("pt", class_support,
_("Set record btrace pt options."),
&set_record_btrace_pt_cmdlist,
- "set record btrace pt ", 0,
+ 0,
&set_record_btrace_cmdlist);
add_show_prefix_cmd ("pt", class_support,
_("Show record btrace pt options."),
&show_record_btrace_pt_cmdlist,
- "show record btrace pt ", 0,
+ 0,
&show_record_btrace_cmdlist);
add_setshow_uinteger_cmd ("buffer-size", no_class,