This is the mail archive of the gdb@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]
Other format: [Raw text]

arm-elf semihosting stdin problem


Hi,

I think I've found a small problem in rdi-share/hsys.c
when reading from a TTY using CL_Read.

For TTYs fgets() is called instead of fread().
This is usually not a problem, but if it happens that
the target tries to read a single character, no character
is read at all, because fgets() reads at most 'len'
characters minus 1 to be able to store the terminating zero.

I'm not sure whether the current behavior is intended, so
I wanted to ask if this is also a problem for others.

A quick solution would be to malloc one surplus byte and to 
call fgets with len+1. For a clean solution the 
HandleSysMessage() would need some rearrangement because
the buffer is allocated before the handle is checked with
isatty().

Thanks for any answers,
Thomas Rauscher.


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