+/* The "set record btrace cpu none" command. */
+
+static void
+cmd_set_record_btrace_cpu_none (const char *args, int from_tty)
+{
+ if (args != nullptr && *args != 0)
+ error (_("Trailing junk: '%s'."), args);
+
+ record_btrace_cpu_state = CS_NONE;
+}
+
+/* The "set record btrace cpu auto" command. */
+
+static void
+cmd_set_record_btrace_cpu_auto (const char *args, int from_tty)
+{
+ if (args != nullptr && *args != 0)
+ error (_("Trailing junk: '%s'."), args);
+
+ record_btrace_cpu_state = CS_AUTO;
+}
+
+/* The "set record btrace cpu" command. */
+
+static void
+cmd_set_record_btrace_cpu (const char *args, int from_tty)
+{
+ if (args == nullptr)
+ args = "";
+
+ /* We use a hard-coded vendor string for now. */
+ unsigned int family, model, stepping;
+ int l1, l2, matches = sscanf (args, "intel: %u/%u%n/%u%n", &family,
+ &model, &l1, &stepping, &l2);
+ if (matches == 3)
+ {
+ if (strlen (args) != l2)
+ error (_("Trailing junk: '%s'."), args + l2);
+ }
+ else if (matches == 2)
+ {
+ if (strlen (args) != l1)
+ error (_("Trailing junk: '%s'."), args + l1);
+
+ stepping = 0;
+ }
+ else
+ error (_("Bad format. See \"help set record btrace cpu\"."));
+
+ if (USHRT_MAX < family)
+ error (_("Cpu family too big."));
+
+ if (UCHAR_MAX < model)
+ error (_("Cpu model too big."));
+
+ if (UCHAR_MAX < stepping)
+ error (_("Cpu stepping too big."));
+
+ record_btrace_cpu.vendor = CV_INTEL;
+ record_btrace_cpu.family = family;
+ record_btrace_cpu.model = model;
+ record_btrace_cpu.stepping = stepping;
+
+ record_btrace_cpu_state = CS_CPU;
+}
+
+/* The "show record btrace cpu" command. */
+
+static void
+cmd_show_record_btrace_cpu (const char *args, int from_tty)
+{
+ const char *cpu;
+
+ if (args != nullptr && *args != 0)
+ error (_("Trailing junk: '%s'."), args);
+
+ switch (record_btrace_cpu_state)
+ {
+ case CS_AUTO:
+ printf_unfiltered (_("btrace cpu is 'auto'.\n"));
+ return;
+
+ case CS_NONE:
+ printf_unfiltered (_("btrace cpu is 'none'.\n"));
+ return;
+
+ case CS_CPU:
+ switch (record_btrace_cpu.vendor)
+ {
+ 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);
+ else
+ printf_unfiltered (_("btrace cpu is 'intel: %u/%u/%u'.\n"),
+ record_btrace_cpu.family,
+ record_btrace_cpu.model,
+ record_btrace_cpu.stepping);
+ return;
+ }
+ }
+
+ error (_("Internal error: bad cpu state."));
+}
+
+/* The "s record btrace bts" command. */
+
+static void
+cmd_set_record_btrace_bts (const char *args, int from_tty)
+{
+ printf_unfiltered (_("\"set record btrace bts\" must be followed "
+ "by an appropriate subcommand.\n"));
+ help_list (set_record_btrace_bts_cmdlist, "set record btrace bts ",
+ all_commands, gdb_stdout);
+}
+
+/* The "show record btrace bts" command. */
+
+static void
+cmd_show_record_btrace_bts (const char *args, int from_tty)
+{
+ cmd_show_list (show_record_btrace_bts_cmdlist, from_tty, "");
+}
+
+/* The "set record btrace pt" command. */
+
+static void
+cmd_set_record_btrace_pt (const char *args, int from_tty)
+{
+ printf_unfiltered (_("\"set record btrace pt\" must be followed "
+ "by an appropriate subcommand.\n"));
+ help_list (set_record_btrace_pt_cmdlist, "set record btrace pt ",
+ all_commands, gdb_stdout);
+}
+
+/* The "show record btrace pt" command. */
+
+static void
+cmd_show_record_btrace_pt (const char *args, int from_tty)
+{
+ cmd_show_list (show_record_btrace_pt_cmdlist, from_tty, "");
+}
+
+/* The "record bts buffer-size" show value function. */
+
+static void
+show_record_bts_buffer_size_value (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("The record/replay bts buffer size is %s.\n"),
+ value);
+}
+
+/* The "record pt buffer-size" show value function. */
+
+static void
+show_record_pt_buffer_size_value (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("The record/replay pt buffer size is %s.\n"),
+ value);
+}