pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: gc.c,v 1.298 2007/09/29 15:10:50 grubba Exp $ + || $Id: gc.c,v 1.299 2007/10/12 13:31:05 mast Exp $   */      #include "global.h"      struct callback *gc_evaluator_callback=0;      #include "array.h"   #include "multiset.h"   #include "mapping.h"   #include "object.h"
pike.git/src/gc.c:569: Inside #if defined (PIKE_DEBUG) || defined (GC_CYCLE_DEBUG)
   if (p2) {size_t l = strlen (p2_name); if (l > longest) longest = l;}    if (p3) {size_t l = strlen (p3_name); if (l > longest) longest = l;}    longest++;    for (l = stack_top; l != &sentinel_frame; l = l->prev) {    size_t c = 0;    if (!l) {fputs (" <broken prev link in rec stack>\n", stderr); break;}    fprintf (stderr, " %p", l);    if (l == p1) {fprintf (stderr, " %s", p1_name); c += strlen (p1_name) + 1;}    if (l == p2) {fprintf (stderr, " %s", p2_name); c += strlen (p2_name) + 1;}    if (l == p3) {fprintf (stderr, " %s", p3_name); c += strlen (p3_name) + 1;} -  fprintf (stderr, ": %*s", c < longest ? longest - c : 0, ""); +  fprintf (stderr, ": %*s", c < longest ? (int) (longest - c) : 0, "");    describe_rec_frame (l);    fputc ('\n', stderr);    }   }      #endif      #ifdef PIKE_DEBUG      int gc_in_cycle_check = 0;
pike.git/src/gc.c:851:    /* FALL THROUGH */       case T_MULTISET_DATA: {    struct multiset_data *msd = (struct multiset_data *) descblock;    union msnode *node = low_multiset_first (msd);    struct svalue ind;    int indval = msd->flags & MULTISET_INDVAL;    for (; node; node = low_multiset_next (node)) {    if (&node->i.ind == (struct svalue *) location) {    fprintf (stderr, "%*s **In index ", indent, ""); -  print_svalue (stderr, low_use_multiset_index (node, ind)); +  safe_print_svalue (stderr, low_use_multiset_index (node, ind));    fputc ('\n', stderr);    break;    }    else if (indval && &node->iv.val == (struct svalue *) location) {    fprintf(stderr, "%*s **In value with index ", indent, ""); -  print_svalue(stderr, low_use_multiset_index (node, ind)); +  safe_print_svalue (stderr, low_use_multiset_index (node, ind));    fputc('\n', stderr);    break;    }    }    break;    }       case T_ARRAY:    {    struct array *a=(struct array *)descblock;
pike.git/src/gc.c:891:       case T_MAPPING:    descblock = ((struct mapping *) memblock)->data;    /* FALL THROUGH */    case T_MAPPING_DATA: {    INT32 e;    struct keypair *k;    NEW_MAPPING_LOOP((struct mapping_data *) descblock)    if (&k->ind == (struct svalue *) location) {    fprintf(stderr, "%*s **In index ", indent, ""); -  print_svalue(stderr, &k->ind); +  safe_print_svalue (stderr, &k->ind);    fputc('\n', stderr);    break;    }    else if (&k->val == (struct svalue *) location) {    fprintf(stderr, "%*s **In value with index ", indent, ""); -  print_svalue(stderr, &k->ind); +  safe_print_svalue (stderr, &k->ind);    fputc('\n', stderr);    break;    }    break;    }       case T_PIKE_FRAME: {    struct pike_frame *f = (struct pike_frame *) descblock;    if (f->locals) { /* Paranoia. */    ptrdiff_t pos = (struct svalue *) location - f->locals;
pike.git/src/gc.c:1145: Inside #if defined(PIKE_DEBUG)
   fprintf (stderr, "%*s**Object variables:\n", indent, "");       for (inh_idx = 0; inh_idx < p->num_inherits; inh_idx++) {    struct inherit *inh = p->inherits + inh_idx;    struct program *p2 = inh->prog;       if (inh->inherit_level) {    if (inh->name) {    fprintf (stderr, "%*s**%*s=== In inherit ",    indent, "", inh->inherit_level + 1, ""); -  print_short_svalue (stderr, (union anything *) &inh->name, T_STRING); +  safe_print_short_svalue (stderr, (union anything *) &inh->name, +  T_STRING);    fprintf (stderr, ", program %d:\n", inh->prog->id);    }    else    fprintf (stderr, "%*s**%*s=== In nameless inherit, program %d:\n",    indent, "", inh->inherit_level + 1, "", inh->prog->id);    }       for (var_idx = 0; var_idx < p2->num_variable_index; var_idx++) {    struct identifier *id = p2->identifiers + p2->variable_index[var_idx];    void *ptr;       fprintf (stderr, "%*s**%*srtt: %-8s name: ",    indent, "", inh->inherit_level + 1, "",    get_name_of_type (id->run_time_type));       if (id->name->size_shift) -  print_short_svalue (stderr, (union anything *) &id->name, T_STRING); +  safe_print_short_svalue (stderr, (union anything *) &id->name, +  T_STRING);    else    fprintf (stderr, "%-20s", id->name->str);       fprintf (stderr, " off: %4"PRINTPTRDIFFT"d value: ",    inh->storage_offset + id->func.offset);       ptr = PIKE_OBJ_STORAGE ((struct object *) a) +    inh->storage_offset + id->func.offset;    if (id->run_time_type == T_MIXED) -  print_svalue_compact (stderr, (struct svalue *) ptr); +  safe_print_svalue_compact (stderr, (struct svalue *) ptr);    else -  print_short_svalue_compact (stderr, (union anything *) ptr, +  safe_print_short_svalue_compact (stderr, (union anything *) ptr,    id->run_time_type);       fputc ('\n', stderr);    var_count++;    }    }       if (!var_count)    fprintf (stderr, "%*s** (none)\n", indent, "");   
pike.git/src/gc.c:1253: Inside #if defined(PIKE_DEBUG)
   const char *type;    char prot[100], descr[120];       while (next_inh < p->inherits + p->num_inherits &&    id_idx == next_inh->identifier_level) {    inh = next_inh++;    inh_id_end = inh->identifier_level + inh->prog->num_identifier_references;    if (inh->name) {    fprintf (stderr, "%*s**%*s=== In inherit ",    indent, "", inh->inherit_level + 1, ""); -  print_short_svalue (stderr, (union anything *) &inh->name, T_STRING); +  safe_print_short_svalue (stderr, (union anything *) &inh->name, +  T_STRING);    fprintf (stderr, ", program %d:\n", inh->prog->id);    }    else    fprintf (stderr, "%*s**%*s=== In nameless inherit, program %d:\n",    indent, "", inh->inherit_level + 1, "", inh->prog->id);    }       while (id_idx == inh_id_end) {    int cur_lvl = inh->inherit_level;    if (inh->name) {    fprintf (stderr, "%*s**%*s=== End of inherit ",    indent, "", inh->inherit_level + 1, ""); -  print_short_svalue (stderr, (union anything *) &inh->name, T_STRING); +  safe_print_short_svalue (stderr, (union anything *) &inh->name, +  T_STRING);    fputc ('\n', stderr);    }    else    fprintf (stderr, "%*s**%*s=== End of nameless inherit\n",    indent, "", inh->inherit_level + 1, "");    while (inh > p->inherits) { /* Paranoia. */    if ((--inh)->inherit_level < cur_lvl) break;    }    inh_id_end = inh->identifier_level + inh->prog->num_identifier_references;    }
pike.git/src/gc.c:1312: Inside #if defined(PIKE_DEBUG)
   if (id_ref->id_flags & ID_INLINE) strcat (prot, ",inl");    if (id_ref->id_flags & ID_OPTIONAL) strcat (prot, ",opt");    if (id_ref->id_flags & ID_EXTERN) strcat (prot, ",ext");    if (id_ref->id_flags & ID_VARIANT) strcat (prot, ",var");       sprintf (descr, "%s: %s", type, prot + 1);    fprintf (stderr, "%*s**%*s%-18s name: ",    indent, "", id_inh->inherit_level + 1, "", descr);       if (id->name->size_shift) -  print_short_svalue (stderr, (union anything *) &id->name, T_STRING); +  safe_print_short_svalue (stderr, (union anything *) &id->name, +  T_STRING);    else    fprintf (stderr, "%-20s", id->name->str);       if (IDENTIFIER_IS_ALIAS(id->identifier_flags)) {    fprintf(stderr, " depth: %d id: %d",    id->func.ext_ref.depth, id->func.ext_ref.id);    } else if (id->identifier_flags & IDENTIFIER_C_FUNCTION)    fprintf (stderr, " addr: %p", id->func.c_fun);    else if (IDENTIFIER_IS_VARIABLE (id->identifier_flags))    fprintf (stderr, " rtt: %s off: %"PRINTPTRDIFFT"d",    get_name_of_type (id->run_time_type), id->func.offset);    else if (IDENTIFIER_IS_PIKE_FUNCTION (id->identifier_flags))    fprintf (stderr, " pc: %"PRINTPTRDIFFT"d", id->func.offset);    else if (IDENTIFIER_IS_CONSTANT (id->identifier_flags)) {    fputs (" value: ", stderr); -  print_svalue_compact (stderr, &id_inh->prog->constants[id->func.offset].sval); +  safe_print_svalue_compact ( +  stderr, &id_inh->prog->constants[id->func.offset].sval);    }       fputc ('\n', stderr);    id_count++;    }       if (!id_count)    fprintf (stderr, "%*s** (none)\n", indent, "");    }