summaryrefslogtreecommitdiff
path: root/gdb/serial.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2013-10-10 05:50:19 +0000
committerJoel Brobecker <brobecker@gnat.com>2013-10-10 05:50:19 +0000
commitb5c16ade2b762dc1620c958ae4b58246cacf08f1 (patch)
treec5c629f7cb6daa11f9aa7301f7c578241e31a2e1 /gdb/serial.c
parente17c23ebbb87e0d46122d771f33dabfb5b07c09f (diff)
downloadgdb-b5c16ade2b762dc1620c958ae4b58246cacf08f1.tar.gz
Rename "set/show remotebaud" command into "set/show serial baud"
This patch renames the "set/show remotebaud" commands into "set/show serial baud", and moves its implementation into serial.c. It also moves the "baud_rate" global from top.c to serial.c, where the new code is being added (the alternative was to add an include of target.h). And to facilitate the transition to the new setting name, this patch also preserves the old commands, and marks them as deprecated to alert the users of the change. gdb/ChangeLog: * cli/cli-cmds.c (show_baud_rate): Moved to serial.c as serial_baud_show_cmd. (_initialize_cli_cmds): Delete the code creating the "set/show remotebaud" commands. * serial.c (baud_rate): Move here from top.c. (serial_baud_show_cmd): Move here from cli/cli-cmds.c. (_initialize_serial): Create "set/show serial baud" commands. Add "set/show remotebaud" command aliases. * top.c (baud_rate): Moved to serial.c. * NEWS: Document the new "set/show serial baud" commands, replacing "set/show remotebaud". gdb/doc/ChangeLog: * gdb.texinfo: Replace "set remotebaud" and "show remotebaud" by "set serial baud" and "show serial baud" (resp) throughout.
Diffstat (limited to 'gdb/serial.c')
-rw-r--r--gdb/serial.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/gdb/serial.c b/gdb/serial.c
index ee3f1ea4b13..f2a9648dead 100644
--- a/gdb/serial.c
+++ b/gdb/serial.c
@@ -621,6 +621,20 @@ serial_show_cmd (char *args, int from_tty)
cmd_show_list (serial_show_cmdlist, from_tty, "");
}
+/* Baud rate specified for talking to serial target systems. Default
+ is left as -1, so targets can choose their own defaults. */
+/* FIXME: This means that "show serial baud" and gr_files_info can
+ print -1 or (unsigned int)-1. This is a Bad User Interface. */
+
+int baud_rate = -1;
+
+static void
+serial_baud_show_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("Baud rate for remote serial I/O is %s.\n"),
+ value);
+}
void
_initialize_serial (void)
@@ -643,6 +657,45 @@ Show default serial/parallel port configuration."),
0/*allow-unknown*/,
&showlist);
+ /* If target is open when baud changes, it doesn't take effect until
+ the next open (I think, not sure). */
+ add_setshow_zinteger_cmd ("baud", no_class, &baud_rate, _("\
+Set baud rate for remote serial I/O."), _("\
+Show baud rate for remote serial I/O."), _("\
+This value is used to set the speed of the serial port when debugging\n\
+using remote targets."),
+ NULL,
+ serial_baud_show_cmd,
+ &serial_set_cmdlist, &serial_show_cmdlist);
+
+ /* The commands "set/show serial baud" used to have a different name.
+ Add aliases to those names to facilitate the transition, and mark
+ them as deprecated, in order to make users aware of the fact that
+ the command names have been changed. */
+ {
+ const char *cmd_name;
+ struct cmd_list_element *cmd;
+
+ /* FIXME: There is a limitation in the deprecation mechanism,
+ and the warning ends up not being displayed for prefixed
+ aliases. So use a real command instead of an alias. */
+ add_setshow_zinteger_cmd ("remotebaud", class_alias, &baud_rate, _("\
+Set baud rate for remote serial I/O."), _("\
+Show baud rate for remote serial I/O."), _("\
+This value is used to set the speed of the serial port when debugging\n\
+using remote targets."),
+ NULL,
+ serial_baud_show_cmd,
+ &setlist, &showlist);
+ cmd_name = "remotebaud";
+ cmd = lookup_cmd (&cmd_name, setlist, "", -1, 1);
+ deprecate_cmd (cmd, "set serial baud");
+ cmd_name
+ = "remotebaud"; /* needed because lookup_cmd updates the pointer */
+ cmd = lookup_cmd (&cmd_name, showlist, "", -1, 1);
+ deprecate_cmd (cmd, "show serial baud");
+ }
+
add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
Set filename for remote session recording."), _("\
Show filename for remote session recording."), _("\