about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-08-21 18:03:01 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-08-21 18:03:01 +0000
commit6f3ff6b653ca5e6f528bc46ec6295cb6d263a9fd (patch)
tree5597e80a02d420f2ec6543f6dff0e21e14064b1b /Src/exec.c
parent07fd604718b0b2202808c121f7bbcb4dce5c9ae5 (diff)
downloadzsh-6f3ff6b653ca5e6f528bc46ec6295cb6d263a9fd.tar.gz
zsh-6f3ff6b653ca5e6f528bc46ec6295cb6d263a9fd.tar.xz
zsh-6f3ff6b653ca5e6f528bc46ec6295cb6d263a9fd.zip
30633: "functions -T" only traces marked function, not called functions
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 6ebc9c014..a40838f91 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4484,11 +4484,12 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
     int *oldpipestats = NULL;
     char saveopts[OPT_SIZE], *oldscriptname = scriptname;
     char *name = shfunc->node.nam;
-    int flags = shfunc->node.flags;
+    int flags = shfunc->node.flags, ooflags;
     char *fname = dupstring(name);
     int obreaks, saveemulation, savesticky_emulation, restore_sticky;
     Eprog prog;
     struct funcstack fstack;
+    static int oflags;
 #ifdef MAX_FUNCTION_DEPTH
     static int funcdepth;
 #endif
@@ -4547,8 +4548,17 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
     } else
 	restore_sticky = 0;
 
-    if (flags & PM_TAGGED)
+    if (flags & (PM_TAGGED|PM_TAGGED_LOCAL))
 	opts[XTRACE] = 1;
+    else if (oflags & PM_TAGGED_LOCAL)
+	opts[XTRACE] = 0;
+    ooflags = oflags;
+    /*
+     * oflags is static, because we compare it on the next recursive
+     * call.  Hence also we maintain ooflags for restoring the previous
+     * value of oflags after the call.
+     */
+    oflags = flags;
     opts[PRINTEXITVALUE] = 0;
     if (doshargs) {
 	LinkNode node;
@@ -4633,6 +4643,7 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
     optcind = oldoptcind;
     zoptind = oldzoptind;
     scriptname = oldscriptname;
+    oflags = ooflags;
 
     if (restore_sticky) {
 	/*