From owner-p4-projects@FreeBSD.ORG Thu Oct 18 05:03:19 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1F4A816A41B; Thu, 18 Oct 2007 05:03:19 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4EBE16A41A for ; Thu, 18 Oct 2007 05:03:18 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id B138C13C45A for ; Thu, 18 Oct 2007 05:03:18 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l9I53ILU005667 for ; Thu, 18 Oct 2007 05:03:18 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l9I53IT2005664 for perforce@freebsd.org; Thu, 18 Oct 2007 05:03:18 GMT (envelope-from jb@freebsd.org) Date: Thu, 18 Oct 2007 05:03:18 GMT Message-Id: <200710180503.l9I53IT2005664@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 127659 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Oct 2007 05:03:19 -0000 http://perforce.freebsd.org/chv.cgi?CH=127659 Change 127659 by jb@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"); + +} + +