aboutsummaryrefslogtreecommitdiff
path: root/sim/m68hc11
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-05-06 23:51:10 -0400
committerMike Frysinger <vapier@gentoo.org>2021-05-06 23:53:30 -0400
commit8852d02874735b231b0a0e36c767423542212f49 (patch)
tree970b7faf5aa9bed0cb725a8bd95b2191daaf80ea /sim/m68hc11
parenta41513efec7594abf0f49e400309bae9413f1847 (diff)
downloadgdb-8852d02874735b231b0a0e36c767423542212f49.zip
gdb-8852d02874735b231b0a0e36c767423542212f49.tar.gz
gdb-8852d02874735b231b0a0e36c767423542212f49.tar.bz2
sim: m68hc11: warn when emul_write fails
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.
Diffstat (limited to 'sim/m68hc11')
-rw-r--r--sim/m68hc11/ChangeLog5
-rw-r--r--sim/m68hc11/emulos.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 6fd984d..48b54b4 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -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.
diff --git a/sim/m68hc11/emulos.c b/sim/m68hc11/emulos.c
index 916364f..247e668 100644
--- a/sim/m68hc11/emulos.c
+++ b/sim/m68hc11/emulos.c
@@ -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--;
}