This is the mail archive of the gdb-patches@sources.redhat.com 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


>>>>> "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


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