Branch: Tag:

2006-03-22

2006-03-22 19:08:39 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Don't assume that pike_frame->pc has been set to NULL when executing in a IDENTIFIER_IS_C_FUNCTION.
Fixes some more (all?) remaining "Bad offset: pc:* program:* (*)".

Rev: src/builtin.cmod:1.182

2:   || 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: builtin.cmod,v 1.181 2006/03/11 17:46:21 grubba Exp $ + || $Id: builtin.cmod,v 1.182 2006/03/22 19:08:39 grubba Exp $   */      #include "global.h"
1257:    file = low_get_line(THIS->pc, THIS->prog, &THIS->lineno);    THIS->pc = NULL;    } -  else if (THIS->fun.type == PIKE_T_FUNCTION) +  else if (THIS->fun.type == PIKE_T_FUNCTION) {    file = low_get_function_line (THIS->fun.u.object, THIS->fun.subtype,    &THIS->lineno); -  else if (THIS->prog) +  } +  else if (THIS->prog) {    file = low_get_program_line (THIS->prog, &THIS->lineno); -  +  }       if (file) {    if (!THIS->filename) THIS->filename = file;
1521:    res->item[size].subtype = 0;       bf = OBJ2_BACKTRACE_FRAME(o); +  bf->pc = NULL;       if ((bf->prog = f->context.prog)) {    add_ref(bf->prog); -  bf->pc = f->pc; +     }       if ((bf->fun.u.object = f->current_object) &&
1533:    bf->fun.subtype = f->fun;    bf->fun.type = PIKE_T_FUNCTION;    function = ID_FROM_INT(f->current_object->prog, f->fun); +  +  if (IDENTIFIER_IS_PIKE_FUNCTION(function->identifier_flags)) { +  /* We don't trust pc if we aren't in a Pike function... */ +  bf->pc = f->pc; +  }    } else {    bf->fun.u.integer = 0;    bf->fun.subtype = NUMBER_DESTRUCTED;