Rearrange pointer logging
authorDaniel Colascione <dancol@dancol.org>
Tue, 8 Apr 2014 12:32:45 +0000 (05:32 -0700)
committerDaniel Colascione <dancol@dancol.org>
Tue, 8 Apr 2014 12:32:45 +0000 (05:32 -0700)
1  2 
src/ChangeLog
src/alloc.c

diff --cc src/ChangeLog
@@@ -1,79 -1,69 +1,85 @@@
 -2014-04-03  Daniel Colascione  <dancol@dancol.org>
++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-03  Daniel Colascione  <dancol@dancol.org>
 -
 -      In all places below, change expressions of the form sizeof(arr) /
 -      sizeof(arr[0]) to EARRAYSIZE(arr).
 -
 -      * xterm.c (x_term_init): See above.
 -
 -      * xfns.c (best_xim_style): See above.
 -
 -      * xfaces.c (Fdump_colors): See above.
 -
 -      * w32fns.c (w32_default_color_map): See above.
 +2014-04-07  Stefan Monnier  <monnier@iro.umontreal.ca>
  
 -      * w32.c:
 -      (init_environment): See above.
 -      (N_ENV_VARS): See above.
 +      * lisp.h (struct Lisp_Symbol): New bitfield `pinned'.
  
 -      * unexcw.c (read_exe_header): See above.
 +      * alloc.c: Keep track of symbols referenced from pure space (bug#17168).
 +      (symbol_block_pinned): New var.
 +      (Fmake_symbol): Initialize `pinned'.
 +      (purecopy): New function, extracted from Fpurecopy.  Mark symbols as
 +      pinned and signal an error for un-purifiable objects.
 +      (pure_cons): Use it.
 +      (Fpurecopy): Use it, except for objects that can't be purified.
 +      (mark_pinned_symbols): New function.
 +      (Fgarbage_collect): Use it.
 +      (gc_sweep): Remove hack made unnecessary.
  
 -      * term.c (term_get_fkeys_1): See above.
 +2014-04-07  Glenn Morris  <rgm@gnu.org>
  
 -      * sysdep.c (init_baud_rate): See above.
 +      * keyboard.c (Fopen_dribble_file): Doc tweak.
  
 -      * nsterm.m (ns_convert_key): See above.
 +2014-04-07  Ken Brown  <kbrown@cornell.edu>
  
 -      * nsfns.m (get_geometry_from_preferences): See above.
 +      * Makefile.in (EMACS_MANIFEST): Update comment.  (Bug#17176)
  
 -      * msdos.c (dos_set_window_size): See above.
 -      (init_environment): See above.
 +2014-04-07  Paul Eggert  <eggert@cs.ucla.edu>
  
 -      * macfont.m (mac_font_get_glyph_for_cid): See above.
 -      (macfont_store_descriptor_attributes): See above.
 -      (macfont_create_attributes_with_spec): See above.
 -      (mac_ctfont_get_glyph_for_cid): See above.
 +      * alloc.c: Simplify by removing use of HAVE_EXECINFO_H.
 +      We have a substitute execinfo.h on hosts that lack it.
 +      (suspicious_free_history): Make it EXTERNALLY_VISIBLE so it
 +      isn't optimized away.
  
 -      * keyboard.c (command_loop_1): See above.
 -      (read_menu_command): See above.
 -      (make_lispy_event): See above.
 -      (NUM_MOD_NAMES): See above.
 -      (read_key_sequence_vs): See above.
 -      (Fcurrent_input_mode): See above.
 -      (syms_of_keyboard): See above.
 +2014-04-05  Paul Eggert  <eggert@cs.ucla.edu>
  
 -      * image.c (xpm_str_to_color_key): See above.
 +      Prefer 'ARRAYELTS (x)' to 'sizeof x / sizeof *x'.
 +      * alloc.c (memory_full):
 +      * charset.c (syms_of_charset):
 +      * doc.c (Fsnarf_documentation):
 +      * emacs.c (main):
 +      * font.c (BUILD_STYLE_TABLE):
 +      * keyboard.c (make_lispy_event):
 +      * profiler.c (setup_cpu_timer):
 +      * xgselect.c (xg_select):
 +      * xterm.c (record_event, STORE_KEYSYM_FOR_DEBUG):
 +      Use ARRAYELTS.
 +      * font.c (FONT_PROPERTY_TABLE_SIZE): Remove.
 +      Replace the only use with ARRAYELTS (font_property_table).
 +      * xfaces.c (DIM): Remove.  All uses replaced by ARRAYELTS.
  
 -      * fringe.c (MAX_STANDARD_FRINGE_BITMAPS): See above.
 -
 -      * frame.c (x_set_frame_parameters): See above.
 -
 -      * fileio.c (Ffile_selinux_context): See above.
 -
 -      * emacs.c (sort_args): See above.
 -
 -      * dosfns.c ():
 -      (msdos_stdcolor_name): See above.
 -
 -      * dired.c (file_attributes): See above.
 +2014-04-03  Daniel Colascione  <dancol@dancol.org>
  
 -      * chartab.c:
 -      (uniprop_decoder_count,uniprop_encode_count): See above.
 +      * xterm.c (x_term_init):
 +      * xfns.c (best_xim_style):
 +      * xfaces.c (Fdump_colors):
 +      * w32fns.c (w32_default_color_map):
 +      * w32.c (init_environment, N_ENV_VARS):
 +      * unexcw.c (read_exe_header):
 +      * term.c (term_get_fkeys_1):
 +      * sysdep.c (init_baud_rate):
 +      * nsterm.m (ns_convert_key):
 +      * nsfns.m (get_geometry_from_preferences):
 +      * msdos.c (dos_set_window_size, init_environment):
 +      * macfont.m (mac_font_get_glyph_for_cid)
 +      (macfont_store_descriptor_attributes)
 +      (macfont_create_attributes_with_spec, mac_ctfont_get_glyph_for_cid):
 +      * keyboard.c (command_loop_1, read_menu_command, make_lispy_event)
 +      (NUM_MOD_NAMES, read_key_sequence_vs, Fcurrent_input_mode)
 +      (syms_of_keyboard):
 +      * image.c (xpm_str_to_color_key):
 +      * fringe.c (MAX_STANDARD_FRINGE_BITMAPS):
 +      * frame.c (x_set_frame_parameters):
 +      * fileio.c (Ffile_selinux_context):
 +      * emacs.c (sort_args):
 +      * dosfns.c (msdos_stdcolor_name):
 +      * dired.c (file_attributes):
 +      * chartab.c (uniprop_decoder_count, uniprop_encode_count):
 +      Change expressions of the form sizeof(arr) / sizeof(arr[0])
 +      to ARRAYELTS (arr).
  
  2014-04-02  Daniel Colascione  <dancol@dancol.org>
  
diff --cc src/alloc.c
@@@ -6885,26 -6845,34 +6885,33 @@@ find_suspicious_object_in_range (void *
  }
  
  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;
 -#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)
 +  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;
        }
  }