This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFA: [ser-unix.c] Fix handling of baud rates
- To: Fernando Nasser <fnasser at redhat dot com>
- Subject: Re: RFA: [ser-unix.c] Fix handling of baud rates
- From: jtc at redback dot com (J.T. Conklin)
- Date: 25 Apr 2001 16:43:59 -0700
- Cc: gdb-patches at sources dot redhat dot com
- References: <3AE751A5.AE7633E4@redhat.com>
- Reply-To: jtc at redback dot com
>>>>> "Fernando" == Fernando Nasser <fnasser@redhat.com> writes:
Fernando> If the user requests an invalid baud rate (with -b or set
Fernando> remotebaud), GDB will try to set the serial port speed to -1
Fernando> and eventually dump core.
Fernando> The following patch will cause GDB to use only legal values
Fernando> for the serial line speed. If the speed requested is not
Fernando> one of the valid speeds, the best speed that is less than
Fernando> the value requested will be used. However, if the requested
Fernando> speed is less than 50, 50 bauds will be used.
Fernando> OK to commit?
I'm not sure I like the behavior of selecting a rate different than
what the user selected is a good idea.
It appears that the higher layers of the code handle the case when
SERIAL_SETBAUDRATE() returns non-zero, so all that needs to be done is
to return -1 in hardwire_setbaudrate() when rate_to_code returns -1
instead of trying to using that value with cfset{i,o}speed, or masking
it in to termio.c_flag, or setting sgttyb.sg_{i,o}speed. The only
additional thing we might want to do is to set errno to an appropriate
value so the perror_with_name() calls in the upper layers output a
reasonable message.
--jtc
--
J.T. Conklin
RedBack Networks