/* Branch trace support for GDB, the GNU debugger.
- Copyright (C) 2013-2021 Free Software Foundation, Inc.
+ Copyright (C) 2013-2022 Free Software Foundation, Inc.
Contributed by Intel Corp. <markus.t.metzger@intel.com>
return &tp->btrace;
}
-/* Enable branch tracing for one thread. Warn on errors. */
+/* The new thread observer. */
static void
-record_btrace_enable_warn (struct thread_info *tp)
+record_btrace_on_new_thread (struct thread_info *tp)
{
/* Ignore this thread if its inferior is not recorded by us. */
target_ops *rec = tp->inf->target_at (record_stratum);
{
DEBUG ("attach thread observer");
- gdb::observers::new_thread.attach (record_btrace_enable_warn,
+ gdb::observers::new_thread.attach (record_btrace_on_new_thread,
record_btrace_thread_observer_token,
"record-btrace");
}
if (size > 0)
{
suffix = record_btrace_adjust_size (&size);
- printf_unfiltered (_("Buffer size: %u%s.\n"), size, suffix);
+ printf_filtered (_("Buffer size: %u%s.\n"), size, suffix);
}
}
if (size > 0)
{
suffix = record_btrace_adjust_size (&size);
- printf_unfiltered (_("Buffer size: %u%s.\n"), size, suffix);
+ printf_filtered (_("Buffer size: %u%s.\n"), size, suffix);
}
}
static void
record_btrace_print_conf (const struct btrace_config *conf)
{
- printf_unfiltered (_("Recording format: %s.\n"),
- btrace_format_string (conf->format));
+ printf_filtered (_("Recording format: %s.\n"),
+ btrace_format_string (conf->format));
switch (conf->format)
{
gaps = btinfo->ngaps;
}
- printf_unfiltered (_("Recorded %u instructions in %u functions (%u gaps) "
- "for thread %s (%s).\n"), insns, calls, gaps,
- print_thread_id (tp),
- target_pid_to_str (tp->ptid).c_str ());
+ printf_filtered (_("Recorded %u instructions in %u functions (%u gaps) "
+ "for thread %s (%s).\n"), insns, calls, gaps,
+ print_thread_id (tp),
+ target_pid_to_str (tp->ptid).c_str ());
if (btrace_is_replaying (tp))
- printf_unfiltered (_("Replay in progress. At instruction %u.\n"),
- btrace_insn_number (btinfo->replay));
+ printf_filtered (_("Replay in progress. At instruction %u.\n"),
+ btrace_insn_number (btinfo->replay));
}
/* Print a decode error. */
if (symtab == NULL)
return btrace_mk_line_range (NULL, 0, 0);
- ltable = SYMTAB_LINETABLE (symtab);
+ ltable = symtab->linetable ();
if (ltable == NULL)
return btrace_mk_line_range (symtab, 0, 0);
else
{
if (size < 0)
- printf_unfiltered (_("At the start of the branch trace record.\n"));
+ printf_filtered (_("At the start of the branch trace record.\n"));
else
- printf_unfiltered (_("At the end of the branch trace record.\n"));
+ printf_filtered (_("At the end of the branch trace record.\n"));
}
btrace_set_insn_history (btinfo, &begin, &end);
else
{
if (size < 0)
- printf_unfiltered (_("At the start of the branch trace record.\n"));
+ printf_filtered (_("At the start of the branch trace record.\n"));
else
- printf_unfiltered (_("At the end of the branch trace record.\n"));
+ printf_filtered (_("At the end of the branch trace record.\n"));
}
btrace_set_call_history (btinfo, &begin, &end);
struct btrace_thread_info *btinfo;
DEBUG ("resuming thread %s (%s): %x (%s)", print_thread_id (tp),
- target_pid_to_str (tp->ptid).c_str (), flag,
+ tp->ptid.to_string ().c_str (), flag,
btrace_thread_flag_to_str (flag));
btinfo = &tp->btrace;
{
enum btrace_thread_flag flag, cflag;
- DEBUG ("resume %s: %s%s", target_pid_to_str (ptid).c_str (),
+ DEBUG ("resume %s: %s%s", ptid.to_string ().c_str (),
::execution_direction == EXEC_REVERSE ? "reverse-" : "",
step ? "step" : "cont");
DEBUG ("cancel resume thread %s (%s): %x (%s)",
print_thread_id (tp),
- target_pid_to_str (tp->ptid).c_str (), flags.raw (),
+ tp->ptid.to_string ().c_str (), flags.raw (),
btrace_thread_flag_to_str (flags));
tp->btrace.flags &= ~(BTHR_MOVE | BTHR_STOP);
btinfo->flags &= ~(BTHR_MOVE | BTHR_STOP);
DEBUG ("stepping thread %s (%s): %x (%s)", print_thread_id (tp),
- target_pid_to_str (tp->ptid).c_str (), flags.raw (),
+ tp->ptid.to_string ().c_str (), flags.raw (),
btrace_thread_flag_to_str (flags));
/* We can't step without an execution 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 (),
+ DEBUG ("wait %s (0x%x)", ptid.to_string ().c_str (),
(unsigned) options);
/* As long as we're not replaying, just forward the request. */
{
*status = btrace_step_no_resumed ();
- DEBUG ("wait ended by %s: %s", target_pid_to_str (null_ptid).c_str (),
+ DEBUG ("wait ended by %s: %s", null_ptid.to_string ().c_str (),
status->to_string ().c_str ());
return null_ptid;
DEBUG ("wait ended by thread %s (%s): %s",
print_thread_id (eventing),
- target_pid_to_str (eventing->ptid).c_str (),
+ eventing->ptid.to_string ().c_str (),
status->to_string ().c_str ());
return eventing->ptid;
void
record_btrace_target::stop (ptid_t ptid)
{
- DEBUG ("stop %s", target_pid_to_str (ptid).c_str ());
+ DEBUG ("stop %s", ptid.to_string ().c_str ());
/* As long as we're not replaying, just forward the request. */
if ((::execution_direction != EXEC_REVERSE)
switch (record_btrace_cpu_state)
{
case CS_AUTO:
- printf_unfiltered (_("btrace cpu is 'auto'.\n"));
+ printf_filtered (_("btrace cpu is 'auto'.\n"));
return;
case CS_NONE:
- printf_unfiltered (_("btrace cpu is 'none'.\n"));
+ printf_filtered (_("btrace cpu is 'none'.\n"));
return;
case CS_CPU:
{
case CV_INTEL:
if (record_btrace_cpu.stepping == 0)
- printf_unfiltered (_("btrace cpu is 'intel: %u/%u'.\n"),
- record_btrace_cpu.family,
- record_btrace_cpu.model);
+ printf_filtered (_("btrace cpu is 'intel: %u/%u'.\n"),
+ record_btrace_cpu.family,
+ record_btrace_cpu.model);
else
- printf_unfiltered (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
- record_btrace_cpu.family,
- record_btrace_cpu.model,
- record_btrace_cpu.stepping);
+ printf_filtered (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
+ record_btrace_cpu.family,
+ record_btrace_cpu.model,
+ record_btrace_cpu.stepping);
return;
}
}