]> git.eshelyaron.com Git - emacs.git/commitdiff
Rearrange suspicious pointer logging
authorDaniel Colascione <dancol@dancol.org>
Thu, 3 Apr 2014 09:44:41 +0000 (02:44 -0700)
committerDaniel Colascione <dancol@dancol.org>
Thu, 3 Apr 2014 09:44:41 +0000 (02:44 -0700)
src/ChangeLog
src/alloc.c

index a628148bbda5bb1550900ee4fc1c100a67fbc997..b2a8f81f3a6f820dd7e9296eb9c2042ec7267bc0 100644 (file)
@@ -1,3 +1,9 @@
+2014-04-03  Daniel Colascione  <dancol@dancol.org>
+
+       * alloc.c (detect_suspicious_free): Split actual stack capturing
+       out into new function for easier breakpoint setting.
+       (note_suspicious_free): New function.
+
 2014-04-03  Daniel Colascione  <dancol@dancol.org>
 
        In all places below, change expressions of the form sizeof(arr) /
index 46b4f5021dff1719615b38040ab03af3e1cd7d1f..7c63fa05ac67fecbea25937b31700d9d24821032 100644 (file)
@@ -6845,28 +6845,34 @@ find_suspicious_object_in_range (void* begin, void* end)
 }
 
 static void
-detect_suspicious_free (void* ptr)
+note_suspicious_free (void* ptr)
 {
-  int i;
   struct suspicious_free_record* rec;
 
+  rec = &suspicious_free_history[suspicious_free_history_index++];
+  if (suspicious_free_history_index ==
+      EARRAYSIZE (suspicious_free_history))
+    {
+      suspicious_free_history_index = 0;
+    }
+
+  memset (rec, 0, sizeof (*rec));
+  rec->suspicious_object = ptr;
+#ifdef HAVE_EXECINFO_H
+  backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace));
+#endif
+}
+
+static void
+detect_suspicious_free (void* ptr)
+{
+  int i;
   eassert (ptr != NULL);
 
   for (i = 0; i < EARRAYSIZE (suspicious_objects); ++i)
     if (suspicious_objects[i] == ptr)
       {
-        rec = &suspicious_free_history[suspicious_free_history_index++];
-        if (suspicious_free_history_index ==
-            EARRAYSIZE (suspicious_free_history))
-          {
-            suspicious_free_history_index = 0;
-          }
-
-        memset (rec, 0, sizeof (*rec));
-        rec->suspicious_object = ptr;
-#ifdef HAVE_EXECINFO_H
-        backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace));
-#endif
+        note_suspicious_free (ptr);
         suspicious_objects[i] = NULL;
       }
 }