This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
arm-elf semihosting stdin problem
- From: "Thomas Rauscher" <trauscher at loytec dot com>
- To: <gdb at sources dot redhat dot com>
- Date: Thu, 23 Dec 2004 15:46:23 +0100
- Subject: 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.