GC_INNER void (*GC_print_heap_obj)(ptr_t p) = GC_default_print_heap_obj_proc;
#ifdef PRINT_BLACK_LIST
-STATIC void GC_print_source_ptr(ptr_t p)
-{
- ptr_t base = GC_base(p);
+ STATIC void GC_print_blacklisted_ptr(word p, ptr_t source,
+ const char *kind_str)
+ {
+ ptr_t base = GC_base(source);
+
if (0 == base) {
- if (0 == p) {
- GC_err_printf("in register");
- } else {
- GC_err_printf("in root set");
- }
+ GC_err_printf("Black listing (%s) %p referenced from %p in %s\n",
+ kind_str, (ptr_t)p, source,
+ NULL != source ? "root set" : "register");
} else {
- GC_err_printf("in object at ");
/* FIXME: We can't call the debug version of GC_print_heap_obj */
/* (with PRINT_CALL_CHAIN) here because the lock is held and */
/* the world is stopped. */
- GC_default_print_heap_obj_proc(base);
+ GC_err_printf("Black listing (%s) %p referenced from %p in"
+ " object at %p of appr. %lu bytes\n",
+ kind_str, (ptr_t)p, source,
+ base, (unsigned long)GC_size(base));
}
-}
-#endif
+ }
+#endif /* PRINT_BLACK_LIST */
GC_INNER void GC_bl_init_no_interiors(void)
{
if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_normal_bl, index)) {
# ifdef PRINT_BLACK_LIST
if (!get_pht_entry_from_index(GC_incomplete_normal_bl, index)) {
- GC_err_printf("Black listing (normal) %p referenced from %p ",
- (ptr_t)p, source);
- GC_print_source_ptr(source);
- GC_err_puts("\n");
+ GC_print_blacklisted_ptr(p, source, "normal");
}
# endif
set_pht_entry_from_index(GC_incomplete_normal_bl, index);
if (HDR(p) == 0 || get_pht_entry_from_index(GC_old_stack_bl, index)) {
# ifdef PRINT_BLACK_LIST
if (!get_pht_entry_from_index(GC_incomplete_stack_bl, index)) {
- GC_err_printf("Black listing (stack) %p referenced from %p ",
- (ptr_t)p, source);
- GC_print_source_ptr(source);
- GC_err_puts("\n");
+ GC_print_blacklisted_ptr(p, source, "stack");
}
# endif
set_pht_entry_from_index(GC_incomplete_stack_bl, index);
if (pthread_sigmask(SIG_BLOCK, NULL, &blocked) != 0)
ABORT("pthread_sigmask failed");
- GC_printf("Blocked: ");
for (i = 1; i < NSIG; i++) {
if (sigismember(&blocked, i))
- GC_printf("%d ", i);
+ GC_printf("Signal blocked: %d\n", i);
}
- GC_printf("\n");
}
#endif /* DEBUG_THREADS */
unsigned n_marks = GC_n_set_marks(hhdr);
if (hhdr -> hb_n_marks != n_marks) {
- GC_printf("(%u:%u,%u!=%u)", hhdr -> hb_obj_kind, (unsigned)bytes,
- (unsigned)hhdr -> hb_n_marks, n_marks);
+ GC_printf("(%u:%u,%u!=%u)\n", hhdr->hb_obj_kind, (unsigned)bytes,
+ (unsigned)hhdr->hb_n_marks, n_marks);
} else {
- GC_printf("(%u:%u,%u)", hhdr -> hb_obj_kind,
+ GC_printf("(%u:%u,%u)\n", hhdr->hb_obj_kind,
(unsigned)bytes, n_marks);
}
bytes += HBLKSIZE-1;
pstats.number_of_blocks = 0;
pstats.total_bytes = 0;
GC_apply_to_all_blocks(GC_print_block_descr, (word)&pstats);
- GC_printf("\nblocks = %lu, bytes = %lu\n",
+ GC_printf("blocks= %lu, bytes= %lu\n",
(unsigned long)pstats.number_of_blocks,
(unsigned long)pstats.total_bytes);
}
{
struct obj_kind * ok = &GC_obj_kinds[kind];
ptr_t flh = ok -> ok_freelist[sz_in_granules];
- struct hblk *lastBlock = 0;
int n;
- for (n = 1; flh; n++) {
+ for (n = 0; flh; n++) {
struct hblk *block = HBLKPTR(flh);
- if (block != lastBlock) {
- GC_printf("\nIn heap block at %p:\n\t", (void *)block);
- lastBlock = block;
- }
- GC_printf("%d: %p;", n, flh);
+ GC_printf("Free object in heap block %p [%d]: %p\n",
+ (void *)block, n, flh);
flh = obj_link(flh);
}
}