diff options
author | Daniel Colascione <dancol@dancol.org> | 2014-04-08 05:32:45 -0700 |
---|---|---|
committer | Daniel Colascione <dancol@dancol.org> | 2014-04-08 05:32:45 -0700 |
commit | fd9c746d747bf9f18919d88d25a8d95a878f82b5 (patch) | |
tree | b5b8354f1a8e1919dbf707d5c3a2afb98d8c0d84 /src | |
parent | cb6e0bfa7a01dcdaa246e4d3f5d8568087f6e3ba (diff) | |
parent | 1b85074c81b11066f60b6f4d8c827788429000a2 (diff) | |
download | emacs-fd9c746d747bf9f18919d88d25a8d95a878f82b5.tar.gz |
Rearrange pointer logging
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/alloc.c | 31 |
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 @@ +2014-04-08 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-07 Stefan Monnier <monnier@iro.umontreal.ca> * 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) } static void -detect_suspicious_free (void *ptr) +note_suspicious_free (void* ptr) +{ + 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; + backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace)); +} + +static void +detect_suspicious_free (void* ptr) { int i; @@ -6894,17 +6911,7 @@ detect_suspicious_free (void *ptr) for (i = 0; i < ARRAYELTS (suspicious_objects); ++i) if (suspicious_objects[i] == ptr) { - struct suspicious_free_record *rec - = &suspicious_free_history[suspicious_free_history_index++]; - if (suspicious_free_history_index == - ARRAYELTS (suspicious_free_history)) - { - suspicious_free_history_index = 0; - } - - memset (rec, 0, sizeof (*rec)); - rec->suspicious_object = ptr; - backtrace (rec->backtrace, ARRAYELTS (rec->backtrace)); + note_suspicious_free (ptr); suspicious_objects[i] = NULL; } } |