public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH/committed 1/2] sim: m68hc11: warn when emul_write fails
@ 2021-05-07  3:55 Mike Frysinger
  2021-05-07  3:55 ` [PATCH/committed 2/2] sim: m68hc11: fix up last warnings Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2021-05-07  3:55 UTC (permalink / raw)
  To: gdb-patches

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 | 5 +++++
 sim/m68hc11/emulos.c  | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 6fd984dfa995..48b54b45dea2 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 916364f306c4..247e66871cfb 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--;
     }
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH/committed 2/2] sim: m68hc11: fix up last warnings
  2021-05-07  3:55 [PATCH/committed 1/2] sim: m68hc11: warn when emul_write fails Mike Frysinger
@ 2021-05-07  3:55 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2021-05-07  3:55 UTC (permalink / raw)
  To: gdb-patches

Change the printf formats a little to fix the last build warnings in
here, and then turn on -Werror by default for the arch port.
---
 sim/m68hc11/ChangeLog    |   6 ++
 sim/m68hc11/configure    | 203 ++++++++++++++++++++-------------------
 sim/m68hc11/configure.ac |   1 -
 sim/m68hc11/interp.c     |   8 +-
 4 files changed, 113 insertions(+), 105 deletions(-)

diff --git a/sim/m68hc11/ChangeLog b/sim/m68hc11/ChangeLog
index 48b54b45dea2..1aaa51b29bb7 100644
--- a/sim/m68hc11/ChangeLog
+++ b/sim/m68hc11/ChangeLog
@@ -1,3 +1,9 @@
+2021-05-06  Mike Frysinger  <vapier@gentoo.org>
+
+	* interp.c (sim_hw_configure): Change %lx to %x in format strings.
+	* configure.ac: Delete SIM_AC_OPTION_WARNINGS call.
+	* configure: Regenerate.
+
 2021-05-06  Mike Frysinger  <vapier@gentoo.org>
 
 	* emulos.c: Include errno.h & stdio.h.
diff --git a/sim/m68hc11/configure.ac b/sim/m68hc11/configure.ac
index be52b63c2092..57e13e207bdd 100644
--- a/sim/m68hc11/configure.ac
+++ b/sim/m68hc11/configure.ac
@@ -7,7 +7,6 @@ SIM_AC_COMMON
 dnl Options available in this module
 SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
-SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_HARDWARE(\
   m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram)
 
diff --git a/sim/m68hc11/interp.c b/sim/m68hc11/interp.c
index 91d4d25b322a..07e4a8858a74 100644
--- a/sim/m68hc11/interp.c
+++ b/sim/m68hc11/interp.c
@@ -172,7 +172,7 @@ sim_hw_configure (SIM_DESC sd)
 	  /* Allocate core managed memory */
 
 	  /* the monitor  */
-	  sim_do_commandf (sd, "memory region 0x%lx@%d,0x%lx",
+	  sim_do_commandf (sd, "memory region 0x%x@%d,0x%x",
 			   /* MONITOR_BASE, MONITOR_SIZE */
 			   0x8000, M6811_RAM_LEVEL, 0x8000);
 	  sim_do_commandf (sd, "memory region 0x000@%d,0x8000",
@@ -180,7 +180,7 @@ sim_hw_configure (SIM_DESC sd)
 	  sim_hw_parse (sd, "/m68hc11/reg 0x1000 0x03F");
           if (cpu->bank_start < cpu->bank_end)
             {
-              sim_do_commandf (sd, "memory region 0x%lx@%d,0x100000",
+              sim_do_commandf (sd, "memory region 0x%x@%d,0x100000",
                                cpu->bank_virtual, M6811_RAM_LEVEL);
               sim_hw_parse (sd, "/m68hc11/use_bank 1");
             }
@@ -234,13 +234,13 @@ sim_hw_configure (SIM_DESC sd)
       if (hw_tree_find_property (device_tree, "/m68hc12/reg") == 0)
 	{
 	  /* Allocate core external memory.  */
-	  sim_do_commandf (sd, "memory region 0x%lx@%d,0x%lx",
+	  sim_do_commandf (sd, "memory region 0x%x@%d,0x%x",
 			   0x8000, M6811_RAM_LEVEL, 0x8000);
 	  sim_do_commandf (sd, "memory region 0x000@%d,0x8000",
 			   M6811_RAM_LEVEL);
           if (cpu->bank_start < cpu->bank_end)
             {
-              sim_do_commandf (sd, "memory region 0x%lx@%d,0x100000",
+              sim_do_commandf (sd, "memory region 0x%x@%d,0x100000",
                                cpu->bank_virtual, M6811_RAM_LEVEL);
               sim_hw_parse (sd, "/m68hc12/use_bank 1");
             }
-- 
2.31.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-07  3:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07  3:55 [PATCH/committed 1/2] sim: m68hc11: warn when emul_write fails Mike Frysinger
2021-05-07  3:55 ` [PATCH/committed 2/2] sim: m68hc11: fix up last warnings Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).