aboutsummaryrefslogtreecommitdiff
path: root/sim/arm/armos.c
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
commit0d9fd8f1d01dd162bb0296f3b0815e1e9c43a5b9 (patch)
treef587dc4965a7d1d4dd73f198c70765e0773d56ca /sim/arm/armos.c
parent0aa7e1aa07c5fced19457c55240df2b3502dc55d (diff)
downloadgdb-0d9fd8f1d01dd162bb0296f3b0815e1e9c43a5b9.zip
gdb-0d9fd8f1d01dd162bb0296f3b0815e1e9c43a5b9.tar.gz
gdb-0d9fd8f1d01dd162bb0296f3b0815e1e9c43a5b9.tar.bz2
(SWIWrite0): Catch big-endian bug when printing characters
Diffstat (limited to 'sim/arm/armos.c')
-rw-r--r--sim/arm/armos.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sim/arm/armos.c b/sim/arm/armos.c
index c4cb051..04916d6 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);
}