OSDN Git Service

2004-07-20 Frank Ch. Eigler <fche@redhat.com>
authorfche <fche@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Jul 2004 20:00:56 +0000 (20:00 +0000)
committerfche <fche@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Jul 2004 20:00:56 +0000 (20:00 +0000)
* mf-impl.h (__mf_options): Add ignore_reads and timestamps fields.
* mf-runtime.c (options): Give them a name.
(__mf_set_default_options): Set them.
(__mf_insert_new_object, __mfu_unregister): Optionalize timestamps.
(__mf_violation): Warning cleanup.
* mf-impl.h (MF_VALIDATE_EXTENT): Support ignore_reads option.
* splay-tree.c (splay_tree_delete_helper): Remove obsolete decl.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@84971 138bc75d-0d04-0410-961f-82ee72b054a4

libmudflap/ChangeLog
libmudflap/mf-impl.h
libmudflap/mf-runtime.c
libmudflap/splay-tree.c

index 60fbf2e..5a6f2d2 100644 (file)
@@ -1,3 +1,13 @@
+2004-07-20  Frank Ch. Eigler  <fche@redhat.com>
+
+       * mf-impl.h (__mf_options): Add ignore_reads and timestamps fields.
+       * mf-runtime.c (options): Give them a name.
+       (__mf_set_default_options): Set them.
+       (__mf_insert_new_object, __mfu_unregister): Optionalize timestamps.
+       (__mf_violation): Warning cleanup.
+       * mf-impl.h (MF_VALIDATE_EXTENT): Support ignore_reads option.
+       * splay-tree.c (splay_tree_delete_helper): Remove obsolete decl.
+
 2004-07-15  Frank Ch. Eigler  <fche@redhat.com>
 
        g++/15861
 2004-07-15  Frank Ch. Eigler  <fche@redhat.com>
 
        g++/15861
index ef962bf..55706c1 100644 (file)
@@ -133,9 +133,6 @@ struct __mf_options
   /* Emit internal tracing message. */
   unsigned verbose_trace;
 
   /* Emit internal tracing message. */
   unsigned verbose_trace;
 
-  /* Support multiple threads.  XXX: not yet implemented. */
-  /* unsigned multi_threaded; */
-
   /* Wipe stack/heap objects upon unwind.  */
   unsigned wipe_stack;
   unsigned wipe_heap;
   /* Wipe stack/heap objects upon unwind.  */
   unsigned wipe_stack;
   unsigned wipe_heap;
@@ -153,6 +150,12 @@ struct __mf_options
   /* Maintain this many stack frames for contexts. */
   unsigned backtrace;
 
   /* Maintain this many stack frames for contexts. */
   unsigned backtrace;
 
+  /* Ignore read operations even if mode_check is in effect.  */
+  unsigned ignore_reads;
+
+  /* Collect register/unregister timestamps.  */
+  unsigned timestamps;
+
 #ifdef LIBMUDFLAPTH
   /* Thread stack size.  */
   unsigned thread_stack;
 #ifdef LIBMUDFLAPTH
   /* Thread stack size.  */
   unsigned thread_stack;
@@ -168,9 +171,7 @@ struct __mf_options
   }
   mudflap_mode;
 
   }
   mudflap_mode;
 
-
   /* How to handle a violation. */
   /* How to handle a violation. */
-
   enum
   {
     viol_nop,        /* Return control to application. */ 
   enum
   {
     viol_nop,        /* Return control to application. */ 
@@ -240,7 +241,6 @@ extern enum __mf_state_enum *__mf_state_perthread ();
 extern enum __mf_state_enum __mf_state;
 #endif
 extern int __mf_starting_p;
 extern enum __mf_state_enum __mf_state;
 #endif
 extern int __mf_starting_p;
-
 extern struct __mf_options __mf_opts;
 
 /* ------------------------------------------------------------------------ */
 extern struct __mf_options __mf_opts;
 
 /* ------------------------------------------------------------------------ */
@@ -355,6 +355,7 @@ ret __mfwrap_ ## fname (__VA_ARGS__)
 #define MF_VALIDATE_EXTENT(value,size,acc,context) \
  do { \
   if (UNLIKELY (size > 0 && __MF_CACHE_MISS_P (value, size))) \
 #define MF_VALIDATE_EXTENT(value,size,acc,context) \
  do { \
   if (UNLIKELY (size > 0 && __MF_CACHE_MISS_P (value, size))) \
+    if (acc == __MF_CHECK_WRITE || ! __mf_opts.ignore_reads) \
     __mf_check ((void *) (value), (size), acc, "(" context ")"); \
  } while (0)
 #define BEGIN_PROTECT(fname, ...)       \
     __mf_check ((void *) (value), (size), acc, "(" context ")"); \
  } while (0)
 #define BEGIN_PROTECT(fname, ...)       \
index 332b9c2..486880c 100644 (file)
@@ -237,6 +237,7 @@ __mf_set_default_options ()
   __mf_opts.persistent_count = 100;
   __mf_opts.crumple_zone = 32;
   __mf_opts.backtrace = 4;
   __mf_opts.persistent_count = 100;
   __mf_opts.crumple_zone = 32;
   __mf_opts.backtrace = 4;
+  __mf_opts.timestamps = 1;
   __mf_opts.mudflap_mode = mode_check;
   __mf_opts.violation_mode = viol_nop;
   __mf_opts.heur_std_data = 1;
   __mf_opts.mudflap_mode = mode_check;
   __mf_opts.violation_mode = viol_nop;
   __mf_opts.heur_std_data = 1;
@@ -313,6 +314,12 @@ options [] =
     {"abbreviate", 
      "abbreviate repetitive listings",
      set_option, 1, &__mf_opts.abbreviate},
     {"abbreviate", 
      "abbreviate repetitive listings",
      set_option, 1, &__mf_opts.abbreviate},
+    {"timestamps", 
+     "track object lifetime timestamps",
+     set_option, 1, &__mf_opts.timestamps},
+    {"ignore-reads", 
+     "ignore read accesses - assume okay",
+     set_option, 1, &__mf_opts.ignore_reads},
     {"wipe-stack",
      "wipe stack objects at unwind",
      set_option, 1, &__mf_opts.wipe_stack},
     {"wipe-stack",
      "wipe stack objects at unwind",
      set_option, 1, &__mf_opts.wipe_stack},
@@ -917,7 +924,8 @@ __mf_insert_new_object (uintptr_t low, uintptr_t high, int type,
   new_obj->name = name;
   new_obj->alloc_pc = pc;
 #if HAVE_GETTIMEOFDAY
   new_obj->name = name;
   new_obj->alloc_pc = pc;
 #if HAVE_GETTIMEOFDAY
-  gettimeofday (& new_obj->alloc_time, NULL);
+  if (__mf_opts.timestamps)
+    gettimeofday (& new_obj->alloc_time, NULL);
 #endif
 #if LIBMUDFLAPTH
   new_obj->alloc_thread = pthread_self ();
 #endif
 #if LIBMUDFLAPTH
   new_obj->alloc_thread = pthread_self ();
@@ -1157,7 +1165,8 @@ __mfu_unregister (void *ptr, size_t sz, int type)
             old_obj->deallocated_p = 1;
             old_obj->dealloc_pc = (uintptr_t) __builtin_return_address (0);
 #if HAVE_GETTIMEOFDAY
             old_obj->deallocated_p = 1;
             old_obj->dealloc_pc = (uintptr_t) __builtin_return_address (0);
 #if HAVE_GETTIMEOFDAY
-            gettimeofday (& old_obj->dealloc_time, NULL);
+            if (__mf_opts.timestamps)
+              gettimeofday (& old_obj->dealloc_time, NULL);
 #endif
 #ifdef LIBMUDFLAPTH
             old_obj->dealloc_thread = pthread_self ();
 #endif
 #ifdef LIBMUDFLAPTH
             old_obj->dealloc_thread = pthread_self ();
@@ -1843,7 +1852,7 @@ __mf_violation (void *ptr, size_t sz, uintptr_t pc,
   {
     unsigned dead_p;
     unsigned num_helpful = 0;
   {
     unsigned dead_p;
     unsigned num_helpful = 0;
-    struct timeval now;
+    struct timeval now = { 0, 0 };
 #if HAVE_GETTIMEOFDAY
     gettimeofday (& now, NULL);
 #endif
 #if HAVE_GETTIMEOFDAY
     gettimeofday (& now, NULL);
 #endif
index 229ef94..cbd4bfb 100644 (file)
@@ -39,7 +39,6 @@ Boston, MA 02111-1307, USA.  */
 #include "splay-tree.h"
 
 
 #include "splay-tree.h"
 
 
-static void splay_tree_delete_helper (splay_tree, splay_tree_node);
 static void splay_tree_splay (splay_tree, splay_tree_key);
 static splay_tree_node splay_tree_splay_helper (splay_tree,
                                                 splay_tree_key,
 static void splay_tree_splay (splay_tree, splay_tree_key);
 static splay_tree_node splay_tree_splay_helper (splay_tree,
                                                 splay_tree_key,