This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
PATCH: Fix ARM simulator buglet
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 22 Feb 2007 13:56:28 -0800
- Subject: PATCH: Fix ARM simulator buglet
- Reply-to: mark at codesourcery dot com
This patch fixes a bug in the ARM simulator. In particular, it was
unconditionally setting errno to EBADF when asked for the length of
file descriptor zero. That's probably not the right error code when
that's stdin, but, worse, it's not right to issue an error at all when
file descriptor zero is connected to a real file, as can happen when
freopen is applied to stdin. The right approach is just to let the
ordinary code in the function run, which passes the call down through
the generic GDB simulator semihosting layer.
I've tested this with a CodeSourcery arm-eabi toolchain, with good
results.
OK to apply?
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713
2007-02-22 Mark Mitchell <mark@codesourcery.com>
sim/arm/
* armos.c (SWIflen): Do not treate file descriptor zero as
special.
Index: sim/arm/armos.c
===================================================================
--- sim/arm/armos.c (revision 163133)
+++ sim/arm/armos.c (working copy)
@@ -401,7 +401,7 @@ SWIflen (ARMul_State * state, ARMword fh
struct OSblock *OSptr = (struct OSblock *) state->OSptr;
ARMword addr;
- if (fh == 0 || fh > FOPEN_MAX)
+ if (fh > FOPEN_MAX)
{
OSptr->ErrorNo = EBADF;
state->Reg[0] = -1L;