From: "Frank Ch. Eigler" <fche@redhat.com>
To: gcc-patches@gcc.gnu.org
Subject: [tree-ssa mudflap] strategy change for hook functions
Date: Wed, 05 Mar 2003 18:51:00 -0000 [thread overview]
Message-ID: <20030305135113.A15916@redhat.com> (raw)
Hi -
Until the attached patch, libmudflap intercepts checkworthy library
functions like malloc, memcpy, etc. using the same mechanism: linker
--wrap'ing or shared library overriding. This makes sense for those
functions that need to be intercepted even when called from
uninstrumented modules (malloc, free), but not those that don't (strcpy).
For example, an uninstrumented library (libstdc++-v3) linked to a -fmudflap
C++ program may have oodles of calls to strcpy. These strcpy calls would
be signalled as an error unless libmudflap heuristics are turned on. With
those heuristics on, on the other hand, some valuable error checking is
disabled. So let's not treat them the same way.
The attached patch partitions these various hook functions into the
classical --wrap/ld.so flavours, and an alternative set intercepted
via macros for instrumented modules only. This change makes simple
programs compiled with -fmudflap work well enough now that another
libmudflap heuristic can go off by default. The patch also contains
some minor fixes.
- FChE
2003-03-05 Frank Ch. Eigler <fche@redhat.com>
* gcc.c (MFWRAP_SPEC): Remove most --wrap entries.
2003-03-05 Frank Ch. Eigler <fche@redhat.com>
Switch to macro-style hooks for str*/mem*/b* functions.
* mf-runtime.h.in (__MF_TYPE_*): Moved some internal values out.
(mem*, str*, b*): Added macro-style hooks for _MUDFLAP case.
* mf-runtime.c: #include config.h to enable glibc backtraces again.
(__mf_set_default_options): Turn off heur_proc_map.
(*): Adapt to to macro-style hook functions.
(__mf_object_dead_head, __mf_object_cemetary): Correct bounds.
(__mf_check, __mf_register, __mf_unregister): Tweak tracing message.
(__mf_violation): Handle __MF_VIOL_WATCH.
* mf-impl.h (__MF_TYPE_*): Moved these internal values here.
(__mf_dynamic): Removed mem*/str*/b* functions.
(TRACE, VERBOSE_TRACE): Add reentrancy locking.
(WRAPPER2): New macro for macro-style hooks.
* mf-hooks.c: Convert mem*/str*/b* functions to simpler
macro-style hooks.
(BEGIN_PROTECT): Tweak tracing vs reentrancy-lock ordering.
* mf-heuristics.c: Adapt to macro-style hook functions.
Correct some comments.
* testsuite/lib/mfdg.exp (dg-test): Simplify result string for
output pattern tests.
* testsuite/libmudflap.c/fail[89]-frag.c: Elaborate output test.
* testsuite/libmudflap.c++/c++frags.exp: Enable non-static tests.
Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.324.2.24
diff -u -p -r1.324.2.24 gcc.c
--- gcc.c 2 Mar 2003 19:58:49 -0000 1.324.2.24
+++ gcc.c 5 Mar 2003 18:09:22 -0000
@@ -615,13 +615,6 @@ proper position among the other output f
/* XXX: should exactly match hooks provided by libmudflap.a */
#define MFWRAP_SPEC " %{fmudflap: %{static:\
--wrap=malloc --wrap=free --wrap=calloc --wrap=realloc\
- --wrap=memcpy --wrap=memmove\
- --wrap=memset --wrap=memcmp --wrap=memchr --wrap=memrchr\
- --wrap=strcpy --wrap=strncpy --wrap=strcat --wrap=strncat\
- --wrap=strcmp --wrap=strcasecmp --wrap=strncmp --wrap=strncasecmp\
- --wrap=strdup --wrap=strndup --wrap=strchr --wrap=strrchr\
- --wrap=strstr --wrap=memmem --wrap=strlen --wrap=strnlen\
- --wrap=bzero --wrap=bcopy --wrap=bcmp --wrap=index --wrap=rindex\
--wrap=dlopen --wrap=mmap --wrap=munmap --wrap=alloca\
}}"
#endif
Index: mf-heuristics.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-heuristics.c,v
retrieving revision 1.1.2.11
diff -u -p -r1.1.2.11 mf-heuristics.c
--- mf-heuristics.c 24 Sep 2002 17:47:21 -0000 1.1.2.11
+++ mf-heuristics.c 5 Mar 2003 18:10:05 -0000
@@ -1,6 +1,6 @@
/* Mudflap: narrow-pointer bounds-checking by tree rewriting.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003 Free Software Foundation, Inc.
Contributed by Frank Ch. Eigler <fche@redhat.com>
and Graydon Hoare <graydon@redhat.com>
@@ -53,8 +53,9 @@ __init_misc (int argc, char **argv, char
-/* Run some quick validation of the given region. If successful, return non-zero.
- If the result is cacheworthy, return something positive. */
+/* Run some quick validation of the given region.
+ Return -1 / 0 / 1 if the access known-invalid, possibly-valid, or known-valid.
+*/
int
__mf_heuristic_check (uintptr_t ptr, uintptr_t ptr_high)
{
@@ -74,7 +75,7 @@ __mf_heuristic_check (uintptr_t ptr, uin
ptr >= stack_top_guess &&
ptr_high >= ptr)
{
- return 1; /* uncacheable */
+ return 1;
}
}
@@ -175,7 +176,6 @@ __mf_heuristic_check (uintptr_t ptr, uin
static unsigned done;
if (! done)
{
- DECLARE(size_t, strlen, const char *s);
done = 1;
/* Register the environment string sequence. */
@@ -194,7 +194,7 @@ __mf_heuristic_check (uintptr_t ptr, uin
char * env = system_envp[i];
if (env)
{
- unsigned len = CALL_REAL (strlen, env);
+ unsigned len = strlen (env);
__mf_register ((uintptr_t) env,
(uintptr_t) len+1,
__MF_TYPE_GUESS,
@@ -218,7 +218,7 @@ __mf_heuristic_check (uintptr_t ptr, uin
char * arg = system_argv[i];
if (arg)
{
- unsigned len = CALL_REAL (strlen, arg);
+ unsigned len = strlen (arg);
__mf_register ((uintptr_t) arg,
(uintptr_t) (len + 1),
__MF_TYPE_GUESS,
@@ -232,5 +232,5 @@ __mf_heuristic_check (uintptr_t ptr, uin
}
#endif
- return -1; /* hard failure */
+ return 0; /* unknown */
}
Index: mf-hooks.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-hooks.c,v
retrieving revision 1.1.2.24
diff -u -p -r1.1.2.24 mf-hooks.c
--- mf-hooks.c 29 Jan 2003 17:46:34 -0000 1.1.2.24
+++ mf-hooks.c 5 Mar 2003 18:10:05 -0000
@@ -22,6 +22,14 @@ XXX: libgcc license?
#error "Do not compile this file with -fmudflap!"
#endif
+
+
+
+/* ------------------------------------------------------------------------ */
+/* These hook functions are intercepted via linker wrapping or shared
+ library ordering. */
+
+
#define MF_VALIDATE_EXTENT(value,size,acc,context) \
{ \
if (UNLIKELY (size > 0 && __MF_CACHE_MISS_P (value, size))) \
@@ -34,7 +42,6 @@ XXX: libgcc license?
}
-
#define BEGIN_PROTECT(ty, fname, ...) \
ty result; \
enum __mf_state old_state; \
@@ -44,9 +51,9 @@ XXX: libgcc license?
} \
else \
{ \
- TRACE ("mf: %s\n", __PRETTY_FUNCTION__); \
old_state = __mf_state; \
__mf_state = reentrant; \
+ TRACE ("mf: %s\n", __PRETTY_FUNCTION__); \
}
#define END_PROTECT(ty, fname, ...) \
@@ -55,7 +62,6 @@ XXX: libgcc license?
return result;
-
/* malloc/free etc. */
#ifdef WRAP_malloc
@@ -102,7 +108,7 @@ WRAPPER(void *, calloc, size_t c, size_t
result = (char *) CALL_REAL(malloc, size_with_crumple_zones);
if (LIKELY(result))
- CALL_REAL(memset, result, 0, size_with_crumple_zones);
+ memset (result, 0, size_with_crumple_zones);
__mf_state = old_state;
@@ -171,7 +177,6 @@ WRAPPER(void, free, void *buf)
static int freeq_initialized = 0;
enum __mf_state old_state;
DECLARE(void * , free, void *);
- DECLARE(void *, memset, void *s, int c, size_t n);
if (UNLIKELY (__mf_state != active))
{
@@ -181,7 +186,7 @@ WRAPPER(void, free, void *buf)
if (UNLIKELY(!freeq_initialized))
{
- CALL_REAL(memset, free_queue, 0,
+ memset (free_queue, 0,
__MF_FREEQ_MAX * sizeof (void *));
freeq_initialized = 1;
}
@@ -396,138 +401,116 @@ WRAPPER(void *, alloca, size_t c)
+/* ------------------------------------------------------------------------ */
+/* These hook functions are intercepted via compile-time macros only. */
+
+
+#undef MF_VALIDATE_EXTENT
+#define MF_VALIDATE_EXTENT(value,size,acc,context) \
+ do { \
+ if (UNLIKELY (size > 0 && __MF_CACHE_MISS_P (value, size))) \
+ { \
+ __mf_check ((void *) (value), (size), acc, "(" context ")"); \
+ } \
+ } while (0)
+
+
+
/* str*,mem*,b* */
#ifdef WRAP_memcpy
-#undef memcpy
-WRAPPER(void *, memcpy, void *dest, const void *src, size_t n)
+WRAPPER2(void *, memcpy, void *dest, const void *src, size_t n)
{
- DECLARE(void *, memcpy, void *dest, const void *src, size_t n);
- BEGIN_PROTECT(void *, memcpy, dest, src, n);
MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "memcpy source");
MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "memcpy dest");
- END_PROTECT (void *, memcpy, dest, src, n);
+ return memcpy (dest, src, n);
}
#endif
#ifdef WRAP_memmove
-#undef memmove
-WRAPPER(void *, memmove, void *dest, const void *src, size_t n)
+WRAPPER2(void *, memmove, void *dest, const void *src, size_t n)
{
- DECLARE(void *, memmove, void *dest, const void *src, size_t n);
- BEGIN_PROTECT(void *, memmove, dest, src, n);
MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "memmove src");
MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "memmove dest");
- END_PROTECT(void *, memmove, dest, src, n);
+ return memmove (dest, src, n);
}
#endif
#ifdef WRAP_memset
-#undef memset
-WRAPPER(void *, memset, void *s, int c, size_t n)
+WRAPPER2(void *, memset, void *s, int c, size_t n)
{
- DECLARE(void *, memset, void *s, int c, size_t n);
- BEGIN_PROTECT(void *, memset, s, c, n);
MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "memset dest");
- END_PROTECT(void *, memset, s, c, n);
+ return memset (s, c, n);
}
#endif
#ifdef WRAP_memcmp
-#undef memcmp
-WRAPPER(int, memcmp, const void *s1, const void *s2, size_t n)
+WRAPPER2(int, memcmp, const void *s1, const void *s2, size_t n)
{
- DECLARE(int , memcmp, const void *s1, const void *s2, size_t n);
- BEGIN_PROTECT(int, memcmp, s1, s2, n);
MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "memcmp 1st arg");
MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "memcmp 2nd arg");
- END_PROTECT(int, memcmp, s1, s2, n);
+ return memcmp (s1, s2, n);
}
#endif
#ifdef WRAP_memchr
-#undef memchr
-WRAPPER(void *, memchr, const void *s, int c, size_t n)
+WRAPPER2(void *, memchr, const void *s, int c, size_t n)
{
- DECLARE(void *, memchr, const void *s, int c, size_t n);
- BEGIN_PROTECT(void *, memchr, s, c, n);
MF_VALIDATE_EXTENT(s, n, __MF_CHECK_READ, "memchr region");
- END_PROTECT(void *, memchr, s, c, n);
+ return memchr (s, c, n);
}
#endif
#ifdef WRAP_memrchr
-#undef memrchr
-WRAPPER(void *, memrchr, const void *s, int c, size_t n)
+WRAPPER2(void *, memrchr, const void *s, int c, size_t n)
{
- DECLARE(void *, memrchr, const void *s, int c, size_t n);
- BEGIN_PROTECT(void *, memrchr, s, c, n);
MF_VALIDATE_EXTENT(s, n, __MF_CHECK_READ, "memrchr region");
- END_PROTECT(void *, memrchr, s, c, n);
+ return memrchr (s, c, n);
}
#endif
#ifdef WRAP_strcpy
-#undef strcpy
-WRAPPER(char *, strcpy, char *dest, const char *src)
+WRAPPER2(char *, strcpy, char *dest, const char *src)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(char *, strcpy, char *dest, const char *src);
- size_t n;
-
/* nb: just because strlen(src) == n doesn't mean (src + n) or (src + n +
1) are valid pointers. the allocated object might have size < n.
check anyways. */
- BEGIN_PROTECT(char *, strcpy, dest, src);
- TRACE("mf: strcpy %08lx -> %08lx\n", (uintptr_t) src, (uintptr_t) dest);
- n = CALL_REAL(strlen, src);
+ size_t n = strlen (src);
MF_VALIDATE_EXTENT(src, CLAMPADD(n, 1), __MF_CHECK_READ, "strcpy src");
MF_VALIDATE_EXTENT(dest, CLAMPADD(n, 1), __MF_CHECK_WRITE, "strcpy dest");
- END_PROTECT(char *, strcpy, dest, src);
+ return strcpy (dest, src);
}
#endif
#ifdef WRAP_strncpy
-#undef strncpy
-WRAPPER(char *, strncpy, char *dest, const char *src, size_t n)
+WRAPPER2(char *, strncpy, char *dest, const char *src, size_t n)
{
- DECLARE(size_t, strnlen, const char *s, size_t n);
- DECLARE(char *, strncpy, char *dest, const char *src, size_t n);
- size_t len;
-
- BEGIN_PROTECT(char *, strncpy, dest, src, n);
- TRACE("mf: strncpy %08lx -> %08lx\n", (uintptr_t) src, (uintptr_t) dest);
- len = CALL_REAL(strnlen, src, n);
+ size_t len = strnlen (src, n);
MF_VALIDATE_EXTENT(src, len, __MF_CHECK_READ, "strncpy src");
MF_VALIDATE_EXTENT(dest, len, __MF_CHECK_WRITE, "strncpy dest"); /* nb: strNcpy */
- END_PROTECT(char *, strncpy, dest, src, n);
+ return strncpy (dest, src, n);
}
#endif
#ifdef WRAP_strcat
-#undef strcat
-WRAPPER(char *, strcat, char *dest, const char *src)
+WRAPPER2(char *, strcat, char *dest, const char *src)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(char *, strcat, char *dest, const char *src);
size_t dest_sz;
size_t src_sz;
- BEGIN_PROTECT(char *, strcat, dest, src);
- dest_sz = CALL_REAL(strlen, dest);
- src_sz = CALL_REAL(strlen, src);
+ dest_sz = strlen (dest);
+ src_sz = strlen (src);
MF_VALIDATE_EXTENT(src, CLAMPADD(src_sz, 1), __MF_CHECK_READ, "strcat src");
MF_VALIDATE_EXTENT(dest, CLAMPADD(dest_sz, CLAMPADD(src_sz, 1)),
__MF_CHECK_WRITE, "strcat dest");
- END_PROTECT(char *, strcat, dest, src);
+ return strcat (dest, src);
}
#endif
#ifdef WRAP_strncat
-#undef strncat
-WRAPPER(char *, strncat, char *dest, const char *src, size_t n)
+WRAPPER2(char *, strncat, char *dest, const char *src, size_t n)
{
/* nb: validating the extents (s,n) might be a mistake for two reasons.
@@ -550,143 +533,106 @@ WRAPPER(char *, strncat, char *dest, con
this same logic applies to further uses of strnlen later down in this
file. */
- DECLARE(size_t, strnlen, const char *s, size_t n);
- DECLARE(char *, strncat, char *dest, const char *src, size_t n);
size_t src_sz;
size_t dest_sz;
- BEGIN_PROTECT(char *, strncat, dest, src, n);
- src_sz = CALL_REAL(strnlen, src, n);
- dest_sz = CALL_REAL(strnlen, dest, n);
+ src_sz = strnlen (src, n);
+ dest_sz = strnlen (dest, n);
MF_VALIDATE_EXTENT(src, src_sz, __MF_CHECK_READ, "strncat src");
MF_VALIDATE_EXTENT(dest, (CLAMPADD(dest_sz, CLAMPADD(src_sz, 1))),
__MF_CHECK_WRITE, "strncat dest");
- END_PROTECT(char *, strncat, dest, src, n);
+ return strncat (dest, src, n);
}
#endif
#ifdef WRAP_strcmp
-#undef strcmp
-WRAPPER(int, strcmp, const char *s1, const char *s2)
+WRAPPER2(int, strcmp, const char *s1, const char *s2)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(int, strcmp, const char *s1, const char *s2);
size_t s1_sz;
size_t s2_sz;
- BEGIN_PROTECT(int, strcmp, s1, s2);
- s1_sz = CALL_REAL(strlen, s1);
- s2_sz = CALL_REAL(strlen, s2);
+ s1_sz = strlen (s1);
+ s2_sz = strlen (s2);
MF_VALIDATE_EXTENT(s1, CLAMPADD(s1_sz, 1), __MF_CHECK_READ, "strcmp 1st arg");
MF_VALIDATE_EXTENT(s2, CLAMPADD(s2_sz, 1), __MF_CHECK_WRITE, "strcmp 2nd arg");
- END_PROTECT(int, strcmp, s1, s2);
+ return strcmp (s1, s2);
}
#endif
#ifdef WRAP_strcasecmp
-#undef strcasecmp
-WRAPPER(int, strcasecmp, const char *s1, const char *s2)
+WRAPPER2(int, strcasecmp, const char *s1, const char *s2)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(int, strcasecmp, const char *s1, const char *s2);
size_t s1_sz;
size_t s2_sz;
- BEGIN_PROTECT(int, strcasecmp, s1, s2);
- s1_sz = CALL_REAL(strlen, s1);
- s2_sz = CALL_REAL(strlen, s2);
+ s1_sz = strlen (s1);
+ s2_sz = strlen (s2);
MF_VALIDATE_EXTENT(s1, CLAMPADD(s1_sz, 1), __MF_CHECK_READ, "strcasecmp 1st arg");
MF_VALIDATE_EXTENT(s2, CLAMPADD(s2_sz, 1), __MF_CHECK_READ, "strcasecmp 2nd arg");
- END_PROTECT(int, strcasecmp, s1, s2);
+ return strcasecmp (s1, s2);
}
#endif
#ifdef WRAP_strncmp
-#undef strncmp
-WRAPPER(int, strncmp, const char *s1, const char *s2, size_t n)
+WRAPPER2(int, strncmp, const char *s1, const char *s2, size_t n)
{
- DECLARE(size_t, strnlen, const char *s, size_t n);
- DECLARE(int, strncmp, const char *s1, const char *s2, size_t n);
size_t s1_sz;
size_t s2_sz;
- BEGIN_PROTECT(int, strncmp, s1, s2, n);
- s1_sz = CALL_REAL(strnlen, s1, n);
- s2_sz = CALL_REAL(strnlen, s2, n);
+ s1_sz = strnlen (s1, n);
+ s2_sz = strnlen (s2, n);
MF_VALIDATE_EXTENT(s1, s1_sz, __MF_CHECK_READ, "strncmp 1st arg");
MF_VALIDATE_EXTENT(s2, s2_sz, __MF_CHECK_READ, "strncmp 2nd arg");
- END_PROTECT(int, strncmp, s1, s2, n);
+ return strncmp (s1, s2, n);
}
#endif
#ifdef WRAP_strncasecmp
-#undef strncasecmp
-WRAPPER(int, strncasecmp, const char *s1, const char *s2, size_t n)
+WRAPPER2(int, strncasecmp, const char *s1, const char *s2, size_t n)
{
- DECLARE(size_t, strnlen, const char *s, size_t n);
- DECLARE(int, strncasecmp, const char *s1, const char *s2, size_t n);
size_t s1_sz;
size_t s2_sz;
- BEGIN_PROTECT(int, strncasecmp, s1, s2, n);
- s1_sz = CALL_REAL(strnlen, s1, n);
- s2_sz = CALL_REAL(strnlen, s2, n);
+ s1_sz = strnlen (s1, n);
+ s2_sz = strnlen (s2, n);
MF_VALIDATE_EXTENT(s1, s1_sz, __MF_CHECK_READ, "strncasecmp 1st arg");
MF_VALIDATE_EXTENT(s2, s2_sz, __MF_CHECK_READ, "strncasecmp 2nd arg");
- END_PROTECT(int, strncasecmp, s1, s2, n);
+ return strncasecmp (s1, s2, n);
}
#endif
#ifdef WRAP_strdup
-#undef strdup
-WRAPPER(char *, strdup, const char *s)
+WRAPPER2(char *, strdup, const char *s)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(char *, strdup, const char *s);
DECLARE(void *, malloc, size_t sz);
- DECLARE(void *, memcpy, void *dest, const void *src, size_t n);
- size_t n;
+ char *result;
+ size_t n = strlen (s);
- BEGIN_PROTECT(char *, strdup, s);
- n = CALL_REAL(strlen, s);
MF_VALIDATE_EXTENT(s, CLAMPADD(n,1), __MF_CHECK_READ, "strdup region");
-
result = (char *)CALL_REAL(malloc,
CLAMPADD(CLAMPADD(n,1),
CLAMPADD(__mf_opts.crumple_zone,
__mf_opts.crumple_zone)));
- if (UNLIKELY(!result))
- {
- __mf_state = old_state;
- return result;
- }
+ if (UNLIKELY(! result)) return result;
result += __mf_opts.crumple_zone;
- CALL_REAL(memcpy, result, s, n);
+ memcpy (result, s, n);
result[n] = '\0';
- __mf_state = old_state;
-
__mf_register (result, CLAMPADD(n,1),
__MF_TYPE_HEAP, "strdup region");
- __mf_state = old_state;
return result;
}
#endif
#ifdef WRAP_strndup
-#undef strndup
-WRAPPER(char *, strndup, const char *s, size_t n)
+WRAPPER2(char *, strndup, const char *s, size_t n)
{
- DECLARE(size_t, strnlen, const char *s, size_t n);
- DECLARE(char *, strndup, const char *s, size_t n);
DECLARE(void *, malloc, size_t sz);
- DECLARE(void *, memcpy, void *dest, const void *src, size_t n);
- size_t sz;
+ char *result;
+ size_t sz = strnlen (s, n);
- BEGIN_PROTECT(char *, strndup, s, n);
- sz = CALL_REAL(strnlen, s, n);
MF_VALIDATE_EXTENT(s, sz, __MF_CHECK_READ, "strndup region"); /* nb: strNdup */
/* note: strndup still adds a \0, even with the N limit! */
@@ -695,199 +641,125 @@ WRAPPER(char *, strndup, const char *s,
CLAMPADD(__mf_opts.crumple_zone,
__mf_opts.crumple_zone)));
- if (UNLIKELY(!result))
- {
- __mf_state = old_state;
- return result;
- }
+ if (UNLIKELY(! result)) return result;
result += __mf_opts.crumple_zone;
- CALL_REAL(memcpy, result, s, n);
+ memcpy (result, s, n);
result[n] = '\0';
- __mf_state = old_state;
-
__mf_register (result, CLAMPADD(n,1), __MF_TYPE_HEAP, "strndup region");
- __mf_state = old_state;
return result;
}
#endif
#ifdef WRAP_strchr
-#undef strchr
-WRAPPER(char *, strchr, const char *s, int c)
+WRAPPER2(char *, strchr, const char *s, int c)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(char *, strchr, const char *s, int c);
size_t n;
- BEGIN_PROTECT(char *, strchr, s, c);
- n = CALL_REAL(strlen, s);
+ n = strlen (s);
MF_VALIDATE_EXTENT(s, CLAMPADD(n,1), __MF_CHECK_READ, "strchr region");
- END_PROTECT(char *, strchr, s, c);
+ return strchr (s, c);
}
#endif
#ifdef WRAP_strrchr
-#undef strrchr
-WRAPPER(char *, strrchr, const char *s, int c)
+WRAPPER2(char *, strrchr, const char *s, int c)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(char *, strrchr, const char *s, int c);
size_t n;
- BEGIN_PROTECT(char *, strrchr, s, c);
- n = CALL_REAL(strlen, s);
+ n = strlen (s);
MF_VALIDATE_EXTENT(s, CLAMPADD(n,1), __MF_CHECK_READ, "strrchr region");
- END_PROTECT(char *, strrchr, s, c);
+ return strrchr (s, c);
}
#endif
#ifdef WRAP_strstr
-#undef strstr
-WRAPPER(char *, strstr, const char *haystack, const char *needle)
+WRAPPER2(char *, strstr, const char *haystack, const char *needle)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(char *, strstr, const char *haystack, const char *needle);
size_t haystack_sz;
size_t needle_sz;
- BEGIN_PROTECT(char *, strstr, haystack, needle);
- haystack_sz = CALL_REAL(strlen, haystack);
- needle_sz = CALL_REAL(strlen, needle);
+ haystack_sz = strlen (haystack);
+ needle_sz = strlen (needle);
MF_VALIDATE_EXTENT(haystack, CLAMPADD(haystack_sz, 1), __MF_CHECK_READ, "strstr haystack");
MF_VALIDATE_EXTENT(needle, CLAMPADD(needle_sz, 1), __MF_CHECK_READ, "strstr needle");
- END_PROTECT(char *, strstr, haystack, needle);
+ return strstr (haystack, needle);
}
#endif
#ifdef WRAP_memmem
-#undef memmem
-WRAPPER(void *, memmem,
+WRAPPER2(void *, memmem,
const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen)
{
- DECLARE(void *, memmem, const void *haystack, size_t haystacklen,
- const void *needle, size_t needlelen);
-
- BEGIN_PROTECT(void *, memmem, haystack, haystacklen, needle, needlelen);
MF_VALIDATE_EXTENT(haystack, haystacklen, __MF_CHECK_READ, "memmem haystack");
MF_VALIDATE_EXTENT(needle, needlelen, __MF_CHECK_READ, "memmem needle");
- END_PROTECT(char *, memmem, haystack, haystacklen, needle, needlelen);
+ return memmem (haystack, haystacklen, needle, needlelen);
}
#endif
#ifdef WRAP_strlen
-#undef strlen
-WRAPPER(size_t, strlen, const char *s)
+WRAPPER2(size_t, strlen, const char *s)
{
- DECLARE(size_t, strlen, const char *s);
-
- BEGIN_PROTECT(size_t, strlen, s);
- result = CALL_REAL(strlen, s);
+ size_t result = strlen (s);
MF_VALIDATE_EXTENT(s, CLAMPADD(result, 1), __MF_CHECK_READ, "strlen region");
- __mf_state = old_state;
return result;
}
#endif
#ifdef WRAP_strnlen
-#undef strnlen
-WRAPPER(size_t, strnlen, const char *s, size_t n)
+WRAPPER2(size_t, strnlen, const char *s, size_t n)
{
- DECLARE(size_t, strnlen, const char *s, size_t n);
-
- BEGIN_PROTECT(size_t, strnlen, s, n);
- result = CALL_REAL(strnlen, s, n);
+ size_t result = strnlen (s, n);
MF_VALIDATE_EXTENT(s, result, __MF_CHECK_READ, "strnlen region");
- __mf_state = old_state;
return result;
}
#endif
#ifdef WRAP_bzero
-#undef bzero
-WRAPPER(void, bzero, void *s, size_t n)
+WRAPPER2(void, bzero, void *s, size_t n)
{
- DECLARE(void , bzero, void *s, size_t n);
- enum __mf_state old_state;
-
- if (UNLIKELY (__mf_state != active))
- {
- CALL_REAL(bzero, s, n);
- return;
- }
- TRACE ("mf: %s\n", __PRETTY_FUNCTION__);
- old_state = __mf_state;
- __mf_state = reentrant;
MF_VALIDATE_EXTENT(s, n, __MF_CHECK_WRITE, "bzero region");
- CALL_REAL(bzero, s, n);
- __mf_state = old_state;
+ bzero (s, n);
}
#endif
#ifdef WRAP_bcopy
#undef bcopy
-WRAPPER(void, bcopy, const void *src, void *dest, size_t n)
+WRAPPER2(void, bcopy, const void *src, void *dest, size_t n)
{
- DECLARE(void , bcopy, const void *src, void *dest, size_t n);
- enum __mf_state old_state;
-
- if (UNLIKELY (__mf_state != active))
- {
- CALL_REAL(bcopy, src, dest, n);
- return;
- }
- TRACE ("mf: %s\n", __PRETTY_FUNCTION__);
- old_state = __mf_state;
- __mf_state = reentrant;
MF_VALIDATE_EXTENT(src, n, __MF_CHECK_READ, "bcopy src");
MF_VALIDATE_EXTENT(dest, n, __MF_CHECK_WRITE, "bcopy dest");
- CALL_REAL(bcopy, src, dest, n);
- __mf_state = old_state;
+ bcopy (src, dest, n);
}
#endif
#ifdef WRAP_bcmp
#undef bcmp
-WRAPPER(int, bcmp, const void *s1, const void *s2, size_t n)
+WRAPPER2(int, bcmp, const void *s1, const void *s2, size_t n)
{
- DECLARE(int , bcmp, const void *s1, const void *s2, size_t n);
-
- BEGIN_PROTECT(int, bcmp, s1, s2, n);
MF_VALIDATE_EXTENT(s1, n, __MF_CHECK_READ, "bcmp 1st arg");
MF_VALIDATE_EXTENT(s2, n, __MF_CHECK_READ, "bcmp 2nd arg");
- END_PROTECT(int, bcmp, s1, s2, n);
+ return bcmp (s1, s2, n);
}
#endif
#ifdef WRAP_index
-#undef index
-WRAPPER(char *, index, const char *s, int c)
+WRAPPER2(char *, index, const char *s, int c)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(char *, index, const char *s, int c);
- size_t n;
-
- BEGIN_PROTECT(char *, index, s, c);
- n = CALL_REAL(strlen, s);
+ size_t n = strlen (s);
MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "index region");
- END_PROTECT(char *, index, s, c);
+ return index (s, c);
}
#endif
#ifdef WRAP_rindex
-#undef rindex
-WRAPPER(char *, rindex, const char *s, int c)
+WRAPPER2(char *, rindex, const char *s, int c)
{
- DECLARE(size_t, strlen, const char *s);
- DECLARE(char *, rindex, const char *s, int c);
- size_t n;
-
- BEGIN_PROTECT(char *, rindex, s, c);
- n = CALL_REAL(strlen, s);
+ size_t n = strlen (s);
MF_VALIDATE_EXTENT(s, CLAMPADD(n, 1), __MF_CHECK_READ, "rindex region");
- END_PROTECT(char *, rindex, s, c);
+ return rindex (s, c);
}
#endif
Index: mf-impl.h
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-impl.h,v
retrieving revision 1.1.2.12
diff -u -p -r1.1.2.12 mf-impl.h
--- mf-impl.h 29 Jan 2003 17:46:34 -0000 1.1.2.12
+++ mf-impl.h 5 Mar 2003 18:10:05 -0000
@@ -10,7 +10,7 @@
and Graydon Hoare <graydon@redhat.com>
This file is part of GCC.
-
+ XXX: libgcc license?
*/
#ifdef _MUDFLAP
@@ -18,6 +18,13 @@
#endif
+/* Private definitions related to mf-runtime.h */
+
+#define __MF_TYPE_MAX_CEM 3 /* the largest type stored in the cemetary */
+#define __MF_TYPE_MAX __MF_TYPE_GUESS
+
+
+
/* Address calculation macros. */
@@ -45,7 +52,6 @@
extern void __mf_violation (void *ptr, size_t sz,
uintptr_t pc, const char *location,
int type);
-
extern size_t __mf_backtrace (char ***, void *, unsigned);
extern void __mf_resolve_dynamics ();
extern int __mf_heuristic_check (uintptr_t, uintptr_t);
@@ -158,40 +164,13 @@ struct __mf_options
struct __mf_dynamic
{
- void * dyn_bcmp;
- void * dyn_bcopy;
- void * dyn_bzero;
void * dyn_calloc;
void * dyn_dlopen;
void * dyn_free;
- void * dyn_index;
void * dyn_malloc;
- void * dyn_memchr;
- void * dyn_memcmp;
- void * dyn_memcpy;
- void * dyn_memmem;
- void * dyn_memmove;
- void * dyn_memrchr;
- void * dyn_memset;
void * dyn_mmap;
void * dyn_munmap;
void * dyn_realloc;
- void * dyn_rindex;
- void * dyn_strcasecmp;
- void * dyn_strcat;
- void * dyn_strchr;
- void * dyn_strcmp;
- void * dyn_strcpy;
- void * dyn_strdup;
- void * dyn_strlen;
- void * dyn_strncasecmp;
- void * dyn_strncat;
- void * dyn_strncmp;
- void * dyn_strncpy;
- void * dyn_strndup;
- void * dyn_strnlen;
- void * dyn_strrchr;
- void * dyn_strstr;
};
#endif /* PIC */
@@ -216,10 +195,21 @@ extern struct __mf_dynamic __mf_dynamic;
#define STRINGIFY(e) STRINGIFY2(e)
#define VERBOSE_TRACE(...) \
if (UNLIKELY (__mf_opts.verbose_trace)) \
- fprintf (stderr, __VA_ARGS__);
+ { \
+ enum __mf_state _ts = __mf_state; \
+ __mf_state = reentrant; \
+ fprintf (stderr, __VA_ARGS__); \
+ __mf_state = _ts; \
+ }
#define TRACE(...) \
if (UNLIKELY (__mf_opts.trace_mf_calls)) \
- fprintf (stderr, __VA_ARGS__);
+ { \
+ enum __mf_state _ts = __mf_state; \
+ __mf_state = reentrant; \
+ fprintf (stderr, __VA_ARGS__); \
+ __mf_state = _ts; \
+ }
+
#define __MF_PERSIST_MAX 256
#define __MF_FREEQ_MAX 256
@@ -285,41 +275,9 @@ ret __wrap_ ## fname (__VA_ARGS__)
#endif /* PIC */
-
-/* previous incarnation of PIC strategy */
-
-/*
-#define WRAPPER(fname) fname
-
-#define DECLARE(ty, fname, ...) \
- typedef ty (*__mf_fn_ ## fname) (__VA_ARGS__); \
- static __mf_fn_ ## fname __dynamic_ ## fname = NULL;
-
-#define CALL_REAL(fname, ...) \
-({ \
- if (__dynamic_ ## fname == NULL) \
- { \
- enum __mf_state prev_state; \
- prev_state = __mf_state; \
- __mf_state = active; \
- char *err = NULL; \
- __dynamic_ ## fname = (__mf_fn_ ## fname) dlsym (RTLD_NEXT, #fname); \
- err = dlerror (); \
- if (err != NULL) \
- { \
- fprintf (stderr, "mf: error dlsym(" STRINGIFY(fname) ") failed: %s\n", err); \
- abort (); \
- } \
- else if (__dynamic_ ## fname == NULL) \
- { \
- fprintf (stderr, "mf: error dlsym(" STRINGIFY(fname) ") returned null\n"); \
- abort (); \
- } \
- __mf_state = prev_state; \
- } \
- (*__dynamic_ ## fname) (__VA_ARGS__); \
-})
- */
+/* WRAPPER2 is for functions intercepted via macros at compile time. */
+#define WRAPPER2(ret, fname, ...) \
+ret __mfwrap_ ## fname (__VA_ARGS__)
#endif /* __MF_IMPL_H */
Index: mf-runtime.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-runtime.c,v
retrieving revision 1.1.2.25
diff -u -p -r1.1.2.25 mf-runtime.c
--- mf-runtime.c 29 Jan 2003 17:46:34 -0000 1.1.2.25
+++ mf-runtime.c 5 Mar 2003 18:10:06 -0000
@@ -4,10 +4,11 @@
and Graydon Hoare <graydon@redhat.com>
This file is part of GCC.
-
XXX: libgcc license?
*/
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
@@ -27,7 +28,6 @@ XXX: libgcc license?
#include "mf-impl.h"
-
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
@@ -115,7 +115,7 @@ __mf_set_default_options ()
__mf_opts.backtrace = 4;
__mf_opts.mudflap_mode = mode_check;
__mf_opts.violation_mode = viol_nop;
- __mf_opts.heur_proc_map = 1;
+ __mf_opts.heur_proc_map = 0;
__mf_opts.heur_stack_bound = 0;
__mf_opts.heur_start_end = 0;
__mf_opts.heur_argv_environ = 1;
@@ -289,9 +289,6 @@ __mf_set_options (const char *optstr)
long tmp = 0;
int rc = 0;
const char *saved_optstr = optstr;
- DECLARE (size_t, strlen, const char *s);
- DECLARE (int, strncmp, const char *s1, const char *s2, size_t n);
- DECLARE (void *, memset, void *s, int c, size_t n);
/* XXX: bounds-check for optstr! */
@@ -311,14 +308,14 @@ __mf_set_options (const char *optstr)
optstr++;
if (*optstr == '?' ||
- CALL_REAL (strncmp, optstr, "help", 4) == 0)
+ strncmp (optstr, "help", 4) == 0)
{
/* Caller will print help and exit. */
rc = -1;
break;
}
- if (CALL_REAL (strncmp, optstr, "no-", 3) == 0)
+ if (strncmp (optstr, "no-", 3) == 0)
{
negate = 1;
optstr = & optstr[3];
@@ -326,10 +323,9 @@ __mf_set_options (const char *optstr)
for (opts = options; opts->name; opts++)
{
- if (CALL_REAL (strncmp , optstr, opts->name,
- CALL_REAL (strlen, opts->name)) == 0)
+ if (strncmp (optstr, opts->name, strlen (opts->name)) == 0)
{
- optstr += CALL_REAL (strlen, opts->name);
+ optstr += strlen (opts->name);
assert (opts->target);
switch (opts->type)
{
@@ -363,7 +359,7 @@ __mf_set_options (const char *optstr)
fprintf (stderr,
"warning: unrecognized string '%s' in mudflap options\n",
optstr);
- optstr += CALL_REAL (strlen, optstr);
+ optstr += strlen (optstr);
rc = -1;
break;
}
@@ -374,7 +370,7 @@ __mf_set_options (const char *optstr)
__mf_opts.free_queue_length &= (__MF_FREEQ_MAX - 1);
/* Clear the lookup cache, in case the parameters got changed. */
- CALL_REAL (memset, __mf_lookup_cache, 0, sizeof(__mf_lookup_cache));
+ memset (__mf_lookup_cache, 0, sizeof(__mf_lookup_cache));
/* void slot 0 */
__mf_lookup_cache[0].low = MAXPTR;
@@ -414,40 +410,13 @@ __mf_resolve_dynamics ()
{
#define RESOLVE(fname) \
resolve_single_dynamic (&__mf_dynamic.dyn_ ## fname, #fname)
- RESOLVE(bcmp);
- RESOLVE(bcopy);
- RESOLVE(bzero);
RESOLVE(calloc);
RESOLVE(dlopen);
RESOLVE(free);
- RESOLVE(index);
RESOLVE(malloc);
- RESOLVE(memchr);
- RESOLVE(memcmp);
- RESOLVE(memcpy);
- RESOLVE(memmem);
- RESOLVE(memmove);
- RESOLVE(memrchr);
- RESOLVE(memset);
RESOLVE(mmap);
RESOLVE(munmap);
RESOLVE(realloc);
- RESOLVE(rindex);
- RESOLVE(strcasecmp);
- RESOLVE(strcat);
- RESOLVE(strchr);
- RESOLVE(strcmp);
- RESOLVE(strcpy);
- RESOLVE(strdup);
- RESOLVE(strlen);
- RESOLVE(strncasecmp);
- RESOLVE(strncat);
- RESOLVE(strncmp);
- RESOLVE(strncpy);
- RESOLVE(strndup);
- RESOLVE(strnlen);
- RESOLVE(strrchr);
- RESOLVE(strstr);
#undef RESOLVE
}
@@ -505,8 +474,8 @@ typedef struct __mf_object_tree
/* Live objects: binary tree on __mf_object_t.low */
__mf_object_tree_t *__mf_object_root;
/* Dead objects: circular arrays; _MIN_CEM .. _MAX_CEM only */
-unsigned __mf_object_dead_head[__MF_TYPE_MAX_CEM]; /* next empty spot */
-__mf_object_tree_t *__mf_object_cemetary[__MF_TYPE_MAX_CEM][__MF_PERSIST_MAX];
+unsigned __mf_object_dead_head[__MF_TYPE_MAX_CEM+1]; /* next empty spot */
+__mf_object_tree_t *__mf_object_cemetary[__MF_TYPE_MAX_CEM+1][__MF_PERSIST_MAX];
static unsigned __mf_find_objects (uintptr_t ptr_low, uintptr_t ptr_high,
__mf_object_tree_t **objs, unsigned max_objs);
@@ -602,7 +571,7 @@ void __mf_check (void *ptr, size_t sz, i
struct __mf_cache old_entry = *entry;
BEGIN_RECURSION_PROTECT;
- TRACE ("mf: check p=%08lx s=%lu %s location=`%s'\n",
+ TRACE ("mf: check ptr=%08lx size=%lu %s location=`%s'\n",
ptr, sz, (type == 0 ? "read" : "write"), location);
switch (__mf_opts.mudflap_mode)
@@ -887,7 +856,7 @@ __mf_register (void *ptr, size_t sz, int
{
/* if (UNLIKELY (!(__mf_state == active || __mf_state == starting))) return; */
- TRACE ("mf: register p=%08lx s=%lu t=%d n='%s'\n", ptr, sz,
+ TRACE ("mf: register ptr=%08lx size=%lu type=%d name='%s'\n", ptr, sz,
type, name ? name : "");
if (__mf_opts.collect_stats)
@@ -1076,7 +1045,7 @@ __mf_unregister (void *ptr, size_t sz)
DECLARE (void, free, void *ptr);
BEGIN_RECURSION_PROTECT;
- TRACE ("mf: unregister p=%08lx s=%lu\n", ptr, sz);
+ TRACE ("mf: unregister ptr=%08lx size=%lu\n", ptr, sz);
switch (__mf_opts.mudflap_mode)
{
@@ -1293,6 +1262,7 @@ struct tree_stats
double weighted_size;
};
+
static void
__mf_tree_analyze (__mf_object_tree_t *obj, struct tree_stats* s)
{
@@ -1925,6 +1895,7 @@ __mf_violation (void *ptr, size_t sz, ui
(type == __MF_VIOL_WRITE) ? "check/write" :
(type == __MF_VIOL_REGISTER) ? "register" :
(type == __MF_VIOL_UNREGISTER) ? "unregister" :
+ (type == __MF_VIOL_WATCH) ? "watch" :
"unknown"),
now.tv_sec, now.tv_usec,
ptr, sz, pc,
@@ -2064,7 +2035,7 @@ __mf_watch_or_not (void *ptr, size_t sz,
uintptr_t ptr_low = (uintptr_t) ptr;
unsigned count = 0;
- TRACE ("mf: %s p=%08lx s=%lu",
+ TRACE ("mf: %s ptr=%08lx size=%lu",
(flag ? "watch" : "unwatch"), ptr, sz);
switch (__mf_opts.mudflap_mode)
Index: mf-runtime.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/Attic/mf-runtime.h.in,v
retrieving revision 1.1.2.7
diff -u -p -r1.1.2.7 mf-runtime.h.in
--- mf-runtime.h.in 29 Jan 2003 17:46:34 -0000 1.1.2.7
+++ mf-runtime.h.in 5 Mar 2003 18:10:06 -0000
@@ -1,5 +1,6 @@
/* ------------------------------------------------------------------------ */
-/* Public libmudflap declarations */
+/* Public libmudflap declarations -*- C -*- */
+
/* XXX: need a better way of conditionally defining this type. */
@@ -16,7 +17,7 @@ typedef unsigned long uintptr_t;
#include <sys/types.h>
-/* Global variables. */
+/* Global declarations used by instrumentation. */
struct __mf_cache { uintptr_t low; uintptr_t high; };
extern struct __mf_cache __mf_lookup_cache [];
@@ -24,22 +25,19 @@ extern uintptr_t __mf_lc_mask;
extern unsigned char __mf_lc_shift;
-/* Codes to describe the type of access to check. */
+/* Codes to describe the type of access to check: __mf_check arg 3 */
#define __MF_CHECK_READ 0
#define __MF_CHECK_WRITE 1
-/* Codes to describe a region of memory being registered. */
-
+/* Codes to describe a region of memory being registered: __mf_*register arg 3 */
+
#define __MF_TYPE_NOACCESS 0
#define __MF_TYPE_HEAP 1
#define __MF_TYPE_STACK 2
#define __MF_TYPE_STATIC 3
-#define __MF_TYPE_MAX_CEM 3 /* the largest type stored in the cemetary */
-
#define __MF_TYPE_GUESS 4
-#define __MF_TYPE_MAX __MF_TYPE_GUESS
/* The public mudflap API */
@@ -55,6 +53,46 @@ extern unsigned __mf_watch (void *ptr, s
extern unsigned __mf_unwatch (void *ptr, size_t sz);
extern void __mf_report ();
extern int __mf_set_options (const char *opts);
+
+
+/* Redirect some standard library functions to libmudflap. These are
+ done by simple #define rather than linker wrapping, since only
+ instrumented modules are meant to be affected. */
+
+#ifdef _MUDFLAP
+#define memcpy __mfwrap_memcpy
+#define memmove __mfwrap_memmove
+#define memset __mfwrap_memset
+#define memcmp __mfwrap_memcmp
+#define memchr __mfwrap_memchr
+#define memrchr __mfwrap_memrchr
+#define strcpy __mfwrap_strcpy
+#define strncpy __mfwrap_strncpy
+#define strcat __mfwrap_strcat
+#define strncat __mfwrap_strncat
+#define strcmp __mfwrap_strcmp
+#define strcasecmp __mfwrap_strcasecmp
+#define strncmp __mfwrap_strncmp
+#define strncasecmp __mfwrap_strncasecmp
+#define strdup __mfwrap_strdup
+#define strndup __mfwrap_strndup
+#define strchr __mfwrap_strchr
+#define strrchr __mfwrap_strrchr
+#define strstr __mfwrap_strstr
+#define memmem __mfwrap_memmem
+#define strlen __mfwrap_strlen
+#define strnlen __mfwrap_strnlen
+#define bzero __mfwrap_bzero
+#define bcopy __mfwrap_bcopy
+#define bcmp __mfwrap_bcmp
+#define index __mfwrap_index
+#define rindex __mfwrap_rindex
+
+/* Disable glibc macros. */
+#define __NO_STRING_INLINES
+
+#endif /* _MUDFLAP */
+
#ifdef __cplusplus
}
Index: testsuite/lib/mfdg.exp
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/testsuite/lib/Attic/mfdg.exp,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 mfdg.exp
--- testsuite/lib/mfdg.exp 26 Feb 2003 19:00:37 -0000 1.1.2.1
+++ testsuite/lib/mfdg.exp 5 Mar 2003 18:10:06 -0000
@@ -289,12 +289,11 @@ proc dg-test { args } {
}
set texttmp [lindex ${dg-output-text} 1]
if { ![regexp $texttmp ${output}] } {
- fail "$name output pattern test, is ${output}, should match $texttmp"
- verbose "Failed test for output pattern $texttmp" 3
+ fail "$name output pattern test"
} else {
- pass "$name output pattern test, $texttmp"
- verbose "Passed test for output pattern $texttmp" 3
+ pass "$name output pattern test"
}
+ verbose -log "Output pattern $texttmp"
unset texttmp
}
}
Index: testsuite/libmudflap.c/fail8-frag.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/testsuite/libmudflap.c/Attic/fail8-frag.c,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fail8-frag.c
--- testsuite/libmudflap.c/fail8-frag.c 26 Feb 2003 19:00:38 -0000 1.1.2.1
+++ testsuite/libmudflap.c/fail8-frag.c 5 Mar 2003 18:10:06 -0000
@@ -13,7 +13,7 @@ free(bar);
memcpy(foo, bar, 10);
return 0;
}
-/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "mudflap violation 1.*memcpy source.*" } */
/* { dg-output "Nearby object.*" } */
/* { dg-output "mudflap object.*malloc region.*alloc time.*dealloc time.*" } */
/* { dg-do run { xfail *-*-* } } */
Index: testsuite/libmudflap.c/fail9-frag.c
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/testsuite/libmudflap.c/Attic/fail9-frag.c,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 fail9-frag.c
--- testsuite/libmudflap.c/fail9-frag.c 26 Feb 2003 19:00:38 -0000 1.1.2.1
+++ testsuite/libmudflap.c/fail9-frag.c 5 Mar 2003 18:10:06 -0000
@@ -14,7 +14,7 @@ memcpy(foo, bar, 10);
return 0;
}
-/* { dg-output "mudflap violation 1.*" } */
+/* { dg-output "mudflap violation 1.*memcpy dest.*" } */
/* { dg-output "Nearby object.*" } */
/* { dg-output "mudflap object.*malloc region.*alloc time.*dealloc time.*" } */
/* { dg-do run { xfail *-*-* } } */
Index: testsuite/libmudflap.c++/c++frags.exp
===================================================================
RCS file: /cvs/gcc/gcc/libmudflap/testsuite/libmudflap.c++/Attic/c++frags.exp,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 c++frags.exp
--- testsuite/libmudflap.c++/c++frags.exp 28 Feb 2003 19:46:45 -0000 1.1.2.2
+++ testsuite/libmudflap.c++/c++frags.exp 5 Mar 2003 18:10:06 -0000
@@ -5,10 +5,7 @@ dg-init
global srcdir
-# XXX: As of 2003-02-25, non-static linking of libstdc++ doesn't work with -fmudflap.
-# libstdc++ startup routines call into hooked str*/mem* functions, which fail due
-# to the disabled heuristics.
-foreach flags [list {-static} {-O3 -static}] {
+foreach flags [list {} {-static} {-O2} {-O3}] {
foreach srcfile [lsort [glob -nocomplain ${srcdir}/libmudflap.c++/*.cxx]] {
set bsrc [file tail $srcfile]
setenv MUDFLAP_OPTIONS "-no-heur-proc-map -no-heur-argv-environ -viol-segv"
reply other threads:[~2003-03-05 18:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030305135113.A15916@redhat.com \
--to=fche@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).