comparison src/alloc.c @ 4934:714f7c9fabb1

make it easier to debug staticpro crashes. Add functions to print out the variable names saved during calls to staticpro(), and change the order of enumerating staticpros to start from 0 to make it easier to get a count to pass to the new functions.
author Ben Wing <ben@xemacs.org>
date Tue, 19 Jan 2010 01:21:39 -0600
parents ae81a2c00f4f
children 299dce99bdad
comparison
equal deleted inserted replaced
4933:77e3b19bd245 4934:714f7c9fabb1
3279 Dynarr_add (staticpros, varaddress); 3279 Dynarr_add (staticpros, varaddress);
3280 Dynarr_add (staticpro_names, varname); 3280 Dynarr_add (staticpro_names, varname);
3281 dump_add_root_lisp_object (varaddress); 3281 dump_add_root_lisp_object (varaddress);
3282 } 3282 }
3283 3283
3284 /* External debugging function: Return the name of the variable at offset
3285 COUNT. */
3286 char *
3287 staticpro_name (int count)
3288 {
3289 return Dynarr_at (staticpro_names, count);
3290 }
3284 3291
3285 Lisp_Object_ptr_dynarr *staticpros_nodump; 3292 Lisp_Object_ptr_dynarr *staticpros_nodump;
3286 char_ptr_dynarr *staticpro_nodump_names; 3293 char_ptr_dynarr *staticpro_nodump_names;
3287 3294
3288 /* Mark the Lisp_Object at heap VARADDRESS as a root object for 3295 /* Mark the Lisp_Object at heap VARADDRESS as a root object for
3290 void 3297 void
3291 staticpro_nodump_1 (Lisp_Object *varaddress, char *varname) 3298 staticpro_nodump_1 (Lisp_Object *varaddress, char *varname)
3292 { 3299 {
3293 Dynarr_add (staticpros_nodump, varaddress); 3300 Dynarr_add (staticpros_nodump, varaddress);
3294 Dynarr_add (staticpro_nodump_names, varname); 3301 Dynarr_add (staticpro_nodump_names, varname);
3302 }
3303
3304 /* External debugging function: Return the name of the variable at offset
3305 COUNT. */
3306 char *
3307 staticpro_nodump_name (int count)
3308 {
3309 return Dynarr_at (staticpro_nodump_names, count);
3295 } 3310 }
3296 3311
3297 #ifdef HAVE_SHLIB 3312 #ifdef HAVE_SHLIB
3298 /* Stop treating the Lisp_Object at non-heap VARADDRESS as a root object 3313 /* Stop treating the Lisp_Object at non-heap VARADDRESS as a root object
3299 for garbage collection, but not for dumping. */ 3314 for garbage collection, but not for dumping. */
3414 void 3429 void
3415 mcpro_1 (Lisp_Object varaddress, char *varname) 3430 mcpro_1 (Lisp_Object varaddress, char *varname)
3416 { 3431 {
3417 Dynarr_add (mcpros, varaddress); 3432 Dynarr_add (mcpros, varaddress);
3418 Dynarr_add (mcpro_names, varname); 3433 Dynarr_add (mcpro_names, varname);
3434 }
3435
3436 /* External debugging function: Return the name of the variable at offset
3437 COUNT. */
3438 char *
3439 mcpro_name (int count)
3440 {
3441 return Dynarr_at (mcpro_names, count);
3419 } 3442 }
3420 3443
3421 #else /* not DEBUG_XEMACS */ 3444 #else /* not DEBUG_XEMACS */
3422 3445
3423 Lisp_Object_dynarr *mcpros; 3446 Lisp_Object_dynarr *mcpros;