Branch: Tag:

2003-02-04

2003-02-04 17:32:20 by Martin Stjernholm <mast@lysator.liu.se>

Backported line info improvements from 7.5 since it can be a major bonus to
have this when tracking down bugs:

Provide line number info for C programs even when compiling without
rtldebug, but strip off the path to the build tree. Let Function.defined
return the line number info for the program when it's a C function that
doesn't have any line info itself.

Rev: src/Makefile.in:1.339
Rev: src/builtin_functions.c:1.456
Rev: src/program.c:1.468
Rev: src/program.h:1.172

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_functions.c,v 1.455 2003/02/01 15:37:22 mast Exp $ + || $Id: builtin_functions.c,v 1.456 2003/02/04 17:32:19 mast Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.455 2003/02/01 15:37:22 mast Exp $"); + RCSID("$Id: builtin_functions.c,v 1.456 2003/02/04 17:32:19 mast Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
7511:    struct program *p = Pike_sp[-args].u.object->prog;    int func = Pike_sp[-args].subtype;    struct identifier *id; +  INT32 line; +  struct pike_string *file = NULL;       if (p == pike_trampoline_program) {    struct pike_trampoline *t =
7524:    id=ID_FROM_INT(p, func);    if(IDENTIFIER_IS_PIKE_FUNCTION( id->identifier_flags ) &&    id->func.offset != -1) +  file = low_get_line(p->program + id->func.offset, p, &line); +  else +  /* The program line is better than nothing for C functions. */ +  file = low_get_program_line (p, &line); +  +  if (file)    { -  INT32 line = 0; -  struct pike_string *tmp = low_get_line(p->program + id->func.offset, p, &line); -  if (tmp) -  { +     pop_n_elems(args); -  -  push_string(tmp); +  if (line) { +  push_string(file);    push_constant_text(":");    push_int(line);    f_add(3); -  +  } +  else +  push_string (file);    return;    }    } -  } +        pop_n_elems(args);    push_int(0);