diff options
| author | Daniel Colascione | 2014-04-08 05:32:45 -0700 |
|---|---|---|
| committer | Daniel Colascione | 2014-04-08 05:32:45 -0700 |
| commit | fd9c746d747bf9f18919d88d25a8d95a878f82b5 (patch) | |
| tree | b5b8354f1a8e1919dbf707d5c3a2afb98d8c0d84 /src/alloc.c | |
| parent | cb6e0bfa7a01dcdaa246e4d3f5d8568087f6e3ba (diff) | |
| parent | 1b85074c81b11066f60b6f4d8c827788429000a2 (diff) | |
| download | emacs-fd9c746d747bf9f18919d88d25a8d95a878f82b5.tar.gz emacs-fd9c746d747bf9f18919d88d25a8d95a878f82b5.zip | |
Rearrange pointer logging
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 31 |
1 files changed, 19 insertions, 12 deletions
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 | ||
| 6887 | static void | 6887 | static void |
| 6888 | detect_suspicious_free (void *ptr) | 6888 | note_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 | |||
| 6904 | static void | ||
| 6905 | detect_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 | } |