* s390-tdep.c (s390_readinstruction): Don't call
authorJim Blandy <jimb@codesourcery.com>
Thu, 20 Dec 2001 08:50:47 +0000 (08:50 +0000)
committerJim Blandy <jimb@codesourcery.com>
Thu, 20 Dec 2001 08:50:47 +0000 (08:50 +0000)
info->read_memory_func to read zero bytes.  Some targets'
xfer_memory functions can't cope with that.

gdb/ChangeLog
gdb/s390-tdep.c

index deb527ac88742ab3480493cb8cc9091248901cdb..d4888d3c78a15549fbebe83b9bf7a0d016fe6595 100644 (file)
@@ -1,5 +1,9 @@
 2001-12-19  Jim Blandy  <jimb@redhat.com>
 
+       * s390-tdep.c (s390_readinstruction): Don't call
+       info->read_memory_func to read zero bytes.  Some targets'
+       xfer_memory functions can't cope with that.
+
        * gdbarch.sh (TARGET_CHAR_SIGNED): New macro.
        * gdbarch.c, gdbarch.h: Regenerated.
        * gdbtypes.c (build_gdbtypes): If TARGET_CHAR_SIGNED is zero,
index 02786ece5e3d36dfbeb659757613ae42b63a7142..db7692b4472beeffbe38b7ce7300d5d39161ac81 100644 (file)
@@ -132,8 +132,11 @@ s390_readinstruction (bfd_byte instr[], CORE_ADDR at,
   if ((*info->read_memory_func) (at, &instr[0], 2, info))
     return -1;
   instrlen = s390_instrlen[instr[0] >> 6];
-  if ((*info->read_memory_func) (at + 2, &instr[2], instrlen - 2, info))
-    return -1;
+  if (instrlen > 2)
+    {
+      if ((*info->read_memory_func) (at + 2, &instr[2], instrlen - 2, info))
+        return -1;
+    }
   return instrlen;
 }