From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fernando Nasser To: Eli Zaretskii Cc: gdb-patches@sources.redhat.com Subject: Re: RFA: [ser-unix.c] Fix handling of baud rates Date: Thu, 26 Apr 2001 07:17:00 -0000 Message-id: <3AE82D73.78A375DE@redhat.com> References: <3AE751A5.AE7633E4@redhat.com> <2110-Thu26Apr2001102549+0300-eliz@is.elta.co.il> X-SW-Source: 2001-04/msg00245.html Eli Zaretskii wrote: > > > Date: Wed, 25 Apr 2001 18:37:25 -0400 > > From: Fernando Nasser > > > > The following patch will cause GDB to use only legal values for the > > serial line speed. If the speed requested is not one of the valid > > speeds, the best speed that is less than the value requested will be > > used. However, if the requested speed is less than 50, 50 bauds will be > > used. > > I'd say it is better to print an error message than silently use the > wrong baudrate. What if the user simply mistyped the value? I don't really mind, I just want to get rid of the core dump. The problem with the error message is that: 1) there is nothing very nice to set the errno to (suggestions?) 2) it comes too late; the user set this value either in the command line or through a "set baudrate" and it was accepted. I cannot add a test in there because I don't know what the target will be. To solve the criptic error message, I could add a warning() to the rate_to_mode() function, so that would preceed the error message (with the best possible errno): "Illegal baud rate %d." But as we are adding a warning(), why not just say: "Illegal baud rate %d; using %d instead." and gracefully fall back? Just let me know of the preferences. This bug is in 5.0, GNUPro and everywhere and I just want to get rid of the user's complaints. P.S.: ARM RDI does fall back on the speed if the board (with the Angel monitor) cannot speak at the speed requested by the user. The only indication is in the welcome string returned by the board, which has the Angel version, copyright and the speed being used (Insight users don't see that this happened yet). -- Fernando Nasser Red Hat Canada Ltd. E-Mail: fnasser@redhat.com 2323 Yonge Street, Suite #300 Toronto, Ontario M4P 2C9