summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-03-02 10:28:29 +0000
committerNick Clifton <nickc@redhat.com>2003-03-02 10:28:29 +0000
commitf9a25da8435507772439c4c1d14701c1256ead49 (patch)
treed26c39c73b0732611a421f1d7f177cf461051e29
parent9f556f0ce1872034b4c36e80c15e8cd4d6610568 (diff)
downloadgdb-f9a25da8435507772439c4c1d14701c1256ead49.tar.gz
(SWIWrite0): Catch big-endian bug when printing characters
-rw-r--r--sim/arm/ChangeLog5
-rw-r--r--sim/arm/armos.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/sim/arm/ChangeLog b/sim/arm/ChangeLog
index 90cc64fa78d..5e4b316ca86 100644
--- a/sim/arm/ChangeLog
+++ b/sim/arm/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-02 Nick Clifton <nickc@redhat.com>
+
+ * armos.c (SWIWrite0): Catch big-endian bug when printing
+ characters.
+
2003-02-27 Andrew Cagney <cagney@redhat.com>
* wrapper.c (sim_create_inferior, sim_open): Rename _bfd to bfd.
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index c4cb0517560..04916d6ad72 100644
--- a/sim/arm/armos.c
+++ b/sim/arm/armos.c
@@ -274,7 +274,13 @@ SWIWrite0 (ARMul_State * state, ARMword addr)
struct OSblock *OSptr = (struct OSblock *) state->OSptr;
while ((temp = ARMul_SafeReadByte (state, addr++)) != 0)
- (void) sim_callback->write_stdout (sim_callback, (char *) &temp, 1);
+ {
+ char buffer = temp;
+ /* Note - we cannot just cast 'temp' to a (char *) here,
+ since on a big-endian host the byte value will end
+ up in the wrong place and a nul character will be printed. */
+ (void) sim_callback->write_stdout (sim_callback, & buffer, 1);
+ }
OSptr->ErrorNo = sim_callback->get_errno (sim_callback);
}