aboutsummaryrefslogtreecommitdiff
path: root/sim/sh/interp.c
diff options
context:
space:
mode:
authorJoern Rennecke <joern.rennecke@embecosm.com>2005-08-02 16:17:59 +0000
committerJoern Rennecke <joern.rennecke@embecosm.com>2005-08-02 16:17:59 +0000
commit63bee803533d6c0b890174637a751c958e25a08a (patch)
treec399e3661856f53c1198a945202b809fa4c57a01 /sim/sh/interp.c
parentf1ea48cbd9dfb5df1183e6ced6875272eec8e4bb (diff)
downloadgdb-63bee803533d6c0b890174637a751c958e25a08a.zip
gdb-63bee803533d6c0b890174637a751c958e25a08a.tar.gz
gdb-63bee803533d6c0b890174637a751c958e25a08a.tar.bz2
* interp.c (strswaplen): Add one for '\0' delimiter.
Diffstat (limited to 'sim/sh/interp.c')
-rw-r--r--sim/sh/interp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 5d4a4f5..107842b 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -959,6 +959,10 @@ ptr (x)
return (char *) (x + saved_state.asregs.memory);
}
+/* STR points to a zero-terminated string in target byte order. Return
+ the number of bytes that need to be converted to host byte order in order
+ to use this string as a zero-terminated string on the host.
+ (Not counting the rounding up needed to operate on entire words.) */
static int
strswaplen (str)
int str;
@@ -971,7 +975,7 @@ strswaplen (str)
return 0;
end = str;
for (end = str; memory[end ^ endian]; end++) ;
- return end - str;
+ return end - str + 1;
}
static void