cvs diff -u cvs diff: Diffing . Index: exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.134 diff -u -r1.134 exec.c --- exec.c 17 Jul 2008 11:27:57 -0000 1.134 +++ exec.c 30 Jul 2008 02:21:43 -0000 @@ -3913,6 +3913,8 @@ shf = (Shfunc) zalloc(sizeof(*shf)); shf->funcdef = prog; shf->node.flags = 0; + shf->filename = ztrdup(scriptfilename); + shf->lineno = lineno; if (!names) { /* @@ -4123,6 +4125,7 @@ #ifdef MAX_FUNCTION_DEPTH static int funcdepth; #endif + Shfunc shf; pushheap(); @@ -4193,7 +4196,15 @@ fstack.lineno = lineno; fstack.prev = funcstack; funcstack = &fstack; - + if (oargv0 && (shf = (Shfunc) shfunctab->getnode(shfunctab, oargv0))) { + fstack.flineno = shf->lineno + lineno; + fstack.filename = dupstring(shf->filename); + } else { + fstack.flineno = lineno; + fstack.filename = dupstring(fstack.caller); + } + + if (prog->flags & EF_RUN) { Shfunc shf; Index: init.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/init.c,v retrieving revision 1.86 diff -u -r1.86 init.c --- init.c 17 Jul 2008 11:27:57 -0000 1.86 +++ init.c 30 Jul 2008 02:21:43 -0000 @@ -334,6 +334,7 @@ } opts[INTERACTIVE] &= 1; argzero = *argv; + scriptfilename = argzero; argv++; } while (*argv) @@ -1065,8 +1066,10 @@ int oldshst, osubsh, oloops; FILE *obshin; char *old_scriptname = scriptname, *us; + const char *old_scriptfilename = scriptfilename; unsigned char *ocs; int ocsp; + struct funcstack fstack; if (!s || (!(prog = try_source_file((us = unmeta(s)))) && @@ -1096,8 +1099,17 @@ loops = 0; dosetopt(SHINSTDIN, 0, 1); scriptname = s; + scriptfilename = s; sourcelevel++; + fstack.name = "source"; + fstack.caller = dupstring(scriptname); + fstack.flineno = oldlineno; + fstack.lineno = oldlineno; + fstack.filename = dupstring(old_scriptfilename); + fstack.prev = funcstack; + funcstack = &fstack; + if (prog) { pushheap(); errflag = 0; @@ -1105,6 +1117,8 @@ popheap(); } else loop(0, 0); /* loop through the file to be sourced */ + funcstack = funcstack->prev; + scriptfilename = old_scriptfilename; sourcelevel--; /* restore the current shell state */ Index: utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.197 diff -u -r1.197 utils.c --- utils.c 17 Jul 2008 11:27:57 -0000 1.197 +++ utils.c 30 Jul 2008 02:21:45 -0000 @@ -33,7 +33,8 @@ /* name of script being sourced */ /**/ -mod_export char *scriptname; +mod_export char *scriptname; /* is sometimes a function name */ +mod_export char *scriptfilename; #ifdef MULTIBYTE_SUPPORT struct widechar_array { Index: zsh.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v retrieving revision 1.138 diff -u -r1.138 zsh.h --- zsh.h 12 Jun 2008 13:45:06 -0000 1.138 +++ zsh.h 30 Jul 2008 02:21:46 -0000 @@ -1059,6 +1059,8 @@ struct shfunc { struct hashnode node; + char *filename; /* Name of file located in */ + int lineno; /* line number in above file */ Eprog funcdef; /* function definition */ }; @@ -1077,8 +1079,10 @@ struct funcstack { Funcstack prev; /* previous in stack */ char *name; /* name of function called */ + char *filename; /* file function resides in */ char *caller; /* name of caller */ - int lineno; /* line number in file */ + int flineno; /* line number in file */ + int lineno; /* line offset from beginning of function */ }; /* node in list of function call wrappers */ cvs diff: Diffing Builtins cvs diff: Diffing Modules Index: Modules/parameter.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/parameter.c,v retrieving revision 1.45 diff -u -r1.45 parameter.c --- Modules/parameter.c 5 Sep 2007 16:16:17 -0000 1.45 +++ Modules/parameter.c 30 Jul 2008 02:21:46 -0000 @@ -528,8 +528,8 @@ for (f = funcstack, p = ret; f; f = f->prev, p++) { char *colonpair; - colonpair = zhalloc(strlen(f->caller) + (f->lineno > 9999 ? 24 : 6)); - sprintf(colonpair, "%s:%d", f->caller, f->lineno); + colonpair = zhalloc(strlen(f->filename) + (f->flineno > 9999 ? 24 : 6)); + sprintf(colonpair, "%s:%d", f->filename, f->flineno); *p = colonpair; }