PERFORCE change 127659 for review

John Birrell jb at FreeBSD.org
Wed Oct 17 22:03:19 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=127659

Change 127659 by jb at jb_freebsd1 on 2007/10/18 05:02:58

	Fix compiler warnings for WARNS=6.
	
	Add a couple of porting functions to help detect memory 
	corruption. Sun's OpenSolaris code tends to assume that
	libelf behaves as theirs does. Heh! Ours behaves just that
	little bit differently given that we handle cross-targets
	rather than just the host architecture like Sun does.

Affected files ...

.. //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/util.c#9 edit

Differences ...

==== //depot/projects/dtrace/src/contrib/opensolaris/tools/ctf/cvt/util.c#9 (text) ====

@@ -43,7 +43,7 @@
 #include "ctftools.h"
 #include "memory.h"
 
-static void (*terminate_cleanup)() = NULL;
+static void (*terminate_cleanup)(void) = NULL;
 
 /* returns 1 if s1 == s2, 0 otherwise */
 int
@@ -116,7 +116,7 @@
 
 /*PRINTFLIKE2*/
 static void
-whine(char *type, char *format, va_list ap)
+whine(const char *type, const char *format, va_list ap)
 {
 	int error = errno;
 
@@ -128,14 +128,14 @@
 }
 
 void
-set_terminate_cleanup(void (*cleanup)())
+set_terminate_cleanup(void (*cleanup)(void))
 {
 	terminate_cleanup = cleanup;
 }
 
 /*PRINTFLIKE1*/
 void
-terminate(char *format, ...)
+terminate(const char *format, ...)
 {
 	va_list ap;
 
@@ -163,7 +163,7 @@
 
 /*PRINTFLIKE1*/
 void
-aborterr(char *format, ...)
+aborterr(const char *format, ...)
 {
 	va_list ap;
 
@@ -180,7 +180,7 @@
 
 /*PRINTFLIKE1*/
 void
-warning(char *format, ...)
+warning(const char *format, ...)
 {
 	va_list ap;
 
@@ -194,7 +194,7 @@
 
 /*PRINTFLIKE2*/
 void
-vadebug(int level, char *format, va_list ap)
+vadebug(int level, const char *format, va_list ap)
 {
 	if (level > debug_level)
 		return;
@@ -206,7 +206,7 @@
 
 /*PRINTFLIKE2*/
 void
-debug(int level, char *format, ...)
+debug(int level, const char *format, ...)
 {
 	va_list ap;
 
@@ -248,3 +248,36 @@
 {
 	return (tdp->t_name == NULL ? "(anon)" : tdp->t_name);
 }
+
+char	*watch_address = NULL;
+int	watch_length = 0;
+
+void
+watch_set(void *addr, int len)
+{
+	watch_address = addr;
+	watch_length  = len;
+}
+
+void
+watch_dump(int v)
+{
+	char *p = watch_address;
+	int i;
+
+	if (watch_address == NULL || watch_length == 0)
+		return;
+
+	printf("%d: watch %p len %d\n",v,watch_address,watch_length);
+        for (i = 0; i < watch_length; i++) {
+                if (*p >= 0x20 && *p < 0x7f) {
+                        printf(" %c",*p++ & 0xff);
+                } else {
+                        printf(" %02x",*p++ & 0xff);
+                }
+        }
+        printf("\n");
+
+}
+
+


More information about the p4-projects mailing list