]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: m68hc11: warn when emul_write fails
authorMike Frysinger <vapier@gentoo.org>
Fri, 7 May 2021 03:51:10 +0000 (23:51 -0400)
committerMike Frysinger <vapier@gentoo.org>
Fri, 7 May 2021 03:53:30 +0000 (23:53 -0400)
Not sure what we should do here when this fails, so just emit a warning
for now to satisfy unused result compiler warnings.  We can see if any
users actually notice here.

sim/m68hc11/ChangeLog
sim/m68hc11/emulos.c

index 6fd984dfa995e1b18212a3f6ba362f259b29df2e..48b54b45dea2ea16881d9a2c0dad4caf79b26441 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-06  Mike Frysinger  <vapier@gentoo.org>
+
+       * emulos.c: Include errno.h & stdio.h.
+       (emul_write): Print a warning when the write fails.
+
 2021-05-04  Mike Frysinger  <vapier@gentoo.org>
 
        * dv-m68hc11.c (struct m68hc11cpu): Change attach_size to unsigned int.
index 916364f306c4f2eafc9004533617a447f87b7d69..247e66871cfb8adea809c7ff403a66c21ea3eb40 100644 (file)
@@ -23,6 +23,8 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 #ifndef WIN32
+#include <errno.h>
+#include <stdio.h>
 #include <sys/types.h>
 #include <sys/time.h>
 
@@ -103,8 +105,9 @@ emul_write (sim_cpu *cpu)
   while (size)
     {
       uint8 val = memory_read8 (cpu, addr);
-        
-      write(0, &val, 1);
+
+      if (write (0, &val, 1) != 1)
+       printf ("write failed: %s\n", strerror (errno));
       addr ++;
       size--;
     }