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: program.c,v 1.477 2003/02/01 15:43:51 mast Exp $ + || $Id: program.c,v 1.478 2003/02/04 17:29:19 mast Exp $   */      #include "global.h" - RCSID("$Id: program.c,v 1.477 2003/02/01 15:43:51 mast Exp $"); + RCSID("$Id: program.c,v 1.478 2003/02/04 17:29:19 mast Exp $");   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"
1970:   {    struct pike_string *save_file = lex.current_file;    int save_line = lex.current_line; -  lex.current_file = make_shared_string(file); +  +  { /* Trim off the leading path of the compilation environment. */ +  const char *p = DEFINETOSTR(PIKE_SRC_ROOT), *f = file; +  while (*p && *p == *f) p++, f++; +  while (*f == '/' || *f == '\\') f++; +  +  lex.current_file = make_shared_string(f);    lex.current_line = line; -  +  }       CDFPRINTF((stderr,    "th(%ld) start_new_program(%d, %s): "
5045:   PMOD_EXPORT struct pike_string *low_get_program_line (struct program *prog,    INT32 *linep)   { +  *linep = 0; +     if (prog->linenumbers) {    char *cnt;    size_t len = 0;
5063:    get_small_number(&cnt); /* Ignore the offset */    *linep = get_small_number(&cnt);    } -  else *linep = 0; +        if (file) {    struct pike_string *str = begin_wide_shared_string(len, shift);
5104: Inside #if defined(PIKE_DEBUG)
   INT32 shift = 0;    char *file = NULL;    static char buffer[1025]; +  *linep = 0;       if (!prog->linenumbers)    return "stub";
5120: Inside #if defined(PIKE_DEBUG)
   get_small_number(&cnt); /* Ignore the offset */    *linep = get_small_number(&cnt);    } -  else *linep = 0; +     if (file) {    if(shift)    {