This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: RFA: [ser-unix.c] Fix handling of baud rates

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:
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]