Branch: Tag:

2003-02-04

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

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.345
Rev: src/builtin_functions.c:1.468
Rev: src/program.c:1.478
Rev: src/program.h:1.175

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.467 2003/02/02 00:31:16 mast Exp $ + || $Id: builtin_functions.c,v 1.468 2003/02/04 17:29:19 mast Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.467 2003/02/02 00:31:16 mast Exp $"); + RCSID("$Id: builtin_functions.c,v 1.468 2003/02/04 17:29:19 mast Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
7451:    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 =
7464:    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);