This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] sim/erc32: Added -v command line switch for verbose output


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=638fcdad6a0de44f6c91b503280207fc1f34ff9e

commit 638fcdad6a0de44f6c91b503280207fc1f34ff9e
Author: Jiri Gaisler <jiri@gaisler.se>
Date:   Tue Mar 17 22:02:38 2015 +0100

    sim/erc32: Added -v command line switch for verbose output

Diff:
---
 sim/erc32/ChangeLog |  9 +++++++++
 sim/erc32/func.c    |  5 +++--
 sim/erc32/help.c    |  2 +-
 sim/erc32/sis.c     |  9 ++++++---
 sim/erc32/sis.h     | 10 ++++------
 5 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/sim/erc32/ChangeLog b/sim/erc32/ChangeLog
index 8211b4a..253b450 100644
--- a/sim/erc32/ChangeLog
+++ b/sim/erc32/ChangeLog
@@ -1,3 +1,12 @@
+2015-03-17  Jiri Gaisler  <jiri@gaisler.se>
+
+	* func.c (show_stat): Print simulation time in portable long long
+	format.
+	* help.c (usage): Update usage help print-out.
+	* sis.c (run_sim): Increase debug level with -v. Also print
+	simulation time in portable long long format.
+	* sis.h: Use stdint.h for portable 32- and 64-bit ints.
+
 2015-03-16  Mike Frysinger  <vapier@gentoo.org>
 
 	* config.in, configure: Regenerate.
diff --git a/sim/erc32/func.c b/sim/erc32/func.c
index 69d5eba..260ceff 100644
--- a/sim/erc32/func.c
+++ b/sim/erc32/func.c
@@ -28,6 +28,7 @@
 #include "sis.h"
 #include <dis-asm.h>
 #include "sim-config.h"
+#include <inttypes.h>
 
 
 #define	VAL(x)	strtoul(x,(char **)NULL,0)
@@ -642,8 +643,8 @@ show_stat(sregs)
 	sregs->nbranch;
 #endif
 
-    printf("\n Cycles       : %9d\n\r", ebase.simtime - sregs->simstart);
-    printf(" Instructions : %9d\n", sregs->ninst);
+    printf("\n Cycles       : %9" PRIu64 "\n\r", ebase.simtime - sregs->simstart);
+    printf(" Instructions : %9" PRIu64 "\n", sregs->ninst);
 
 #ifdef STAT
     printf("   integer    : %9.2f %%\n", 100.0 * (float) iinst / (float) sregs->ninst);
diff --git a/sim/erc32/help.c b/sim/erc32/help.c
index 21c2a77..9813bda 100644
--- a/sim/erc32/help.c
+++ b/sim/erc32/help.c
@@ -7,8 +7,8 @@ usage()
 {
 
     printf("usage: sis [-uart1 uart_device1] [-uart2 uart_device2]\n");
+    printf("[-sparclite] [-dumbio] [-v] \n");
     printf("[-nfp] [-freq frequency] [-c batch_file] [files]\n");
-    printf("[-sparclite] [-dumbio]\n");
 }
 
 void
diff --git a/sim/erc32/sis.c b/sim/erc32/sis.c
index ce9b3d0..931e3f3 100644
--- a/sim/erc32/sis.c
+++ b/sim/erc32/sis.c
@@ -30,6 +30,7 @@
 #include "sis.h"
 #include <dis-asm.h>
 #include "sim-config.h"
+#include <inttypes.h>
 
 #define	VAL(x)	strtol(x,(char **)NULL,0)
 
@@ -113,7 +114,7 @@ run_sim(sregs, icount, dis)
 			        sregs->histind = 0;
 		        }
 		        if (dis) {
-			    printf(" %8u ", ebase.simtime);
+			    printf(" %8" PRIu64 " ", ebase.simtime);
 			    dis_mem(sregs->pc, 1, &dinfo);
 		        }
 		    }
@@ -205,6 +206,8 @@ main(argc, argv)
 #endif
             } else if (strcmp(argv[stat], "-dumbio") == 0) {
 		dumbio = 1;
+            } else if (strcmp(argv[stat], "-v") == 0) {
+		sis_verbose += 1;
 	    } else {
 		printf("unknown option %s\n", argv[stat]);
 		usage();
@@ -271,7 +274,7 @@ main(argc, argv)
 	case CTRL_C:
 	    printf("\b\bInterrupt!\n");
 	case TIME_OUT:
-	    printf(" Stopped at time %d (%.3f ms)\n", ebase.simtime, 
+	    printf(" Stopped at time %" PRIu64 " (%.3f ms)\n", ebase.simtime,
 	      ((double) ebase.simtime / (double) sregs.freq) / 1000.0);
 	    break;
 	case BPT_HIT:
@@ -281,7 +284,7 @@ main(argc, argv)
 	case ERROR:
 	    printf("IU in error mode (%d)\n", sregs.trap);
 	    stat = 0;
-	    printf(" %8d ", ebase.simtime);
+	    printf(" %8" PRIu64 " ", ebase.simtime);
 	    dis_mem(sregs.pc, 1, &dinfo);
 	    break;
 	default:
diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h
index 6820cb4..74466ae 100644
--- a/sim/erc32/sis.h
+++ b/sim/erc32/sis.h
@@ -24,7 +24,8 @@
 #include "gdb/callback.h"
 #include "gdb/remote-sim.h"
 #include <sim-config.h>
- 
+#include <stdint.h>
+
 #if WITH_HOST_BYTE_ORDER == BIG_ENDIAN
 #define HOST_BIG_ENDIAN
 #else
@@ -56,11 +57,8 @@ typedef unsigned int uint32;	/* 32-bit unsigned int */
 typedef float   float32;	/* 32-bit float */
 typedef double  float64;	/* 64-bit float */
 
-/* FIXME: what about host compilers that don't support 64-bit ints? */
-typedef unsigned long long uint64; /* 64-bit unsigned int */
-typedef long long int64;	   /* 64-bit signed int */
-
-#define UINT64_MAX 18446744073709551615ULL
+typedef uint64_t uint64; /* 64-bit unsigned int */
+typedef int64_t int64;	   /* 64-bit signed int */
 
 struct pstate {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]