Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Mitchell <mark@codesourcery.com>
To: gdb-patches@sourceware.org
Subject: PATCH: Fix ARM simulator buglet
Date: Thu, 22 Feb 2007 21:56:00 -0000	[thread overview]
Message-ID: <200702222156.l1MLuSqs006149@sparrowhawk.codesourcery.com> (raw)


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;


             reply	other threads:[~2007-02-22 21:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-22 21:56 Mark Mitchell [this message]
2007-02-27 17:25 ` Daniel Jacobowitz
2007-02-27 18:57   ` Mark Mitchell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200702222156.l1MLuSqs006149@sparrowhawk.codesourcery.com \
    --to=mark@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox