aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel Colascione2014-04-08 05:32:45 -0700
committerDaniel Colascione2014-04-08 05:32:45 -0700
commitfd9c746d747bf9f18919d88d25a8d95a878f82b5 (patch)
treeb5b8354f1a8e1919dbf707d5c3a2afb98d8c0d84 /src
parentcb6e0bfa7a01dcdaa246e4d3f5d8568087f6e3ba (diff)
parent1b85074c81b11066f60b6f4d8c827788429000a2 (diff)
downloademacs-fd9c746d747bf9f18919d88d25a8d95a878f82b5.tar.gz
emacs-fd9c746d747bf9f18919d88d25a8d95a878f82b5.zip
Rearrange pointer logging
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/alloc.c31
2 files changed, 25 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bbdff0c79b5..0b03069c8d7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12014-04-08 Daniel Colascione <dancol@dancol.org>
2
3 * alloc.c (detect_suspicious_free): Split actual stack capturing
4 out into new function for easier breakpoint setting.
5 (note_suspicious_free): New function.
6
12014-04-07 Stefan Monnier <monnier@iro.umontreal.ca> 72014-04-07 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * lisp.h (struct Lisp_Symbol): New bitfield `pinned'. 9 * lisp.h (struct Lisp_Symbol): New bitfield `pinned'.
diff --git a/src/alloc.c b/src/alloc.c
index ea8d81648d7..d22e71bd1a8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6885,7 +6885,24 @@ find_suspicious_object_in_range (void *begin, void *end)
6885} 6885}
6886 6886
6887static void 6887static void
6888detect_suspicious_free (void *ptr) 6888note_suspicious_free (void* ptr)
6889{
6890 struct suspicious_free_record* rec;
6891
6892 rec = &suspicious_free_history[suspicious_free_history_index++];
6893 if (suspicious_free_history_index ==
6894 EARRAYSIZE (suspicious_free_history))
6895 {
6896 suspicious_free_history_index = 0;
6897 }
6898
6899 memset (rec, 0, sizeof (*rec));
6900 rec->suspicious_object = ptr;
6901 backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace));
6902}
6903
6904static void
6905detect_suspicious_free (void* ptr)
6889{ 6906{
6890 int i; 6907 int i;
6891 6908
@@ -6894,17 +6911,7 @@ detect_suspicious_free (void *ptr)
6894 for (i = 0; i < ARRAYELTS (suspicious_objects); ++i) 6911 for (i = 0; i < ARRAYELTS (suspicious_objects); ++i)
6895 if (suspicious_objects[i] == ptr) 6912 if (suspicious_objects[i] == ptr)
6896 { 6913 {
6897 struct suspicious_free_record *rec 6914 note_suspicious_free (ptr);
6898 = &suspicious_free_history[suspicious_free_history_index++];
6899 if (suspicious_free_history_index ==
6900 ARRAYELTS (suspicious_free_history))
6901 {
6902 suspicious_free_history_index = 0;
6903 }
6904
6905 memset (rec, 0, sizeof (*rec));
6906 rec->suspicious_object = ptr;
6907 backtrace (rec->backtrace, ARRAYELTS (rec->backtrace));
6908 suspicious_objects[i] = NULL; 6915 suspicious_objects[i] = NULL;
6909 } 6916 }
6910} 6917}