2003-02-04
2003-02-04 17:32:20 by Martin Stjernholm <mast@lysator.liu.se>
-
f6c11de70dfb4c5d382ac26a138c68e35fcb0216
(22 lines)
(+16/-6)
[
Show
| Annotate
]
Branch: 7.4
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: program.c,v 1.467 2003/02/01 15:37:23 mast Exp $
+ || $Id: program.c,v 1.468 2003/02/04 17:32:20 mast Exp $
*/
#include "global.h"
- RCSID("$Id: program.c,v 1.467 2003/02/01 15:37:23 mast Exp $");
+ RCSID("$Id: program.c,v 1.468 2003/02/04 17:32:20 mast Exp $");
#include "program.h"
#include "object.h"
#include "dynamic_buffer.h"
1817:
{
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): "
4892:
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;
4910:
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);
4951: Inside #if defined(PIKE_DEBUG)
INT32 shift = 0;
char *file = NULL;
static char buffer[1025];
+ *linep = 0;
if (!prog->linenumbers)
return "stub";
4967: Inside #if defined(PIKE_DEBUG)
get_small_number(&cnt); /* Ignore the offset */
*linep = get_small_number(&cnt);
}
- else *linep = 0;
+
if (file) {
if(shift)
{