do \
{ \
if (record_debug != 0) \
- fprintf_unfiltered (gdb_stdlog, \
- "[record-btrace] " msg "\n", ##args); \
+ gdb_printf (gdb_stdlog, \
+ "[record-btrace] " msg "\n", ##args); \
} \
while (0)
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_filtered (_("Buffer size: %u%s.\n"), size, suffix);
+ gdb_printf (_("Buffer size: %u%s.\n"), size, suffix);
}
}
if (size > 0)
{
suffix = record_btrace_adjust_size (&size);
- printf_filtered (_("Buffer size: %u%s.\n"), size, suffix);
+ gdb_printf (_("Buffer size: %u%s.\n"), size, suffix);
}
}
static void
record_btrace_print_conf (const struct btrace_config *conf)
{
- printf_filtered (_("Recording format: %s.\n"),
- btrace_format_string (conf->format));
+ gdb_printf (_("Recording format: %s.\n"),
+ btrace_format_string (conf->format));
switch (conf->format)
{
gaps = btinfo->ngaps;
}
- 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 ());
+ gdb_printf (_("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_filtered (_("Replay in progress. At instruction %u.\n"),
- btrace_insn_number (btinfo->replay));
+ gdb_printf (_("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_filtered (_("At the start of the branch trace record.\n"));
+ gdb_printf (_("At the start of the branch trace record.\n"));
else
- printf_filtered (_("At the end of the branch trace record.\n"));
+ gdb_printf (_("At the end of the branch trace record.\n"));
}
btrace_set_insn_history (btinfo, &begin, &end);
if (sym == NULL)
goto out;
- symtab = symbol_symtab (sym);
+ symtab = sym->symtab ();
for (const btrace_insn &insn : bfun->insn)
{
return;
uiout->field_string ("file",
- symtab_to_filename_for_display (symbol_symtab (sym)),
+ symtab_to_filename_for_display (sym->symtab ()),
file_name_style.style ());
btrace_compute_src_line_range (bfun, &begin, &end);
else
{
if (size < 0)
- printf_filtered (_("At the start of the branch trace record.\n"));
+ gdb_printf (_("At the start of the branch trace record.\n"));
else
- printf_filtered (_("At the end of the branch trace record.\n"));
+ gdb_printf (_("At the end of the branch trace record.\n"));
}
btrace_set_call_history (btinfo, &begin, &end);
/* We can't start replaying without trace. */
if (btinfo->functions.empty ())
- return NULL;
+ error (_("No trace."));
/* GDB stores the current frame_id when stepping in order to detects steps
into subroutines.
cmd_show_replay_memory_access (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file, _("Replay memory access is %s.\n"),
- replay_memory_access);
+ gdb_printf (file, _("Replay memory access is %s.\n"),
+ replay_memory_access);
}
/* The "set record btrace cpu none" command. */
switch (record_btrace_cpu_state)
{
case CS_AUTO:
- printf_filtered (_("btrace cpu is 'auto'.\n"));
+ gdb_printf (_("btrace cpu is 'auto'.\n"));
return;
case CS_NONE:
- printf_filtered (_("btrace cpu is 'none'.\n"));
+ gdb_printf (_("btrace cpu is 'none'.\n"));
return;
case CS_CPU:
{
case CV_INTEL:
if (record_btrace_cpu.stepping == 0)
- printf_filtered (_("btrace cpu is 'intel: %u/%u'.\n"),
- record_btrace_cpu.family,
- record_btrace_cpu.model);
+ gdb_printf (_("btrace cpu is 'intel: %u/%u'.\n"),
+ record_btrace_cpu.family,
+ record_btrace_cpu.model);
else
- printf_filtered (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
- record_btrace_cpu.family,
- record_btrace_cpu.model,
- record_btrace_cpu.stepping);
+ gdb_printf (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
+ record_btrace_cpu.family,
+ record_btrace_cpu.model,
+ record_btrace_cpu.stepping);
return;
}
}
struct cmd_list_element *c,
const char *value)
{
- fprintf_filtered (file, _("The record/replay bts buffer size is %s.\n"),
- value);
+ gdb_printf (file, _("The record/replay bts buffer size is %s.\n"),
+ value);
}
/* The "record pt buffer-size" show value function. */
struct cmd_list_element *c,
const char *value)
{
- fprintf_filtered (file, _("The record/replay pt buffer size is %s.\n"),
- value);
+ gdb_printf (file, _("The record/replay pt buffer size is %s.\n"),
+ value);
}
/* Initialize btrace commands. */