summary refs log tree commit diff
path: root/Src/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/options.c')
-rw-r--r--Src/options.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Src/options.c b/Src/options.c
index 5fbb06b11..48df16045 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -523,6 +523,20 @@ emulate(const char *zsh_name, int fully)
     if (fully)
 	emulation |= EMULATE_FULLY;
     installemulation();
+
+    if (funcstack && funcstack->tp == FS_FUNC) {
+	/*
+	 * We are inside a function.  Decide if it's traced.
+	 * Pedantic note: the function in the function table isn't
+	 * guaranteed to be what we're executing, but it's
+	 * close enough.
+	 */
+	Shfunc shf = (Shfunc)shfunctab->getnode(shfunctab, funcstack->name);
+	if (shf && (shf->node.flags & PM_TAGGED)) {
+	    /* Tracing is on, so set xtrace */
+	    opts[XTRACE] = 1;
+	}
+    }
 }
 
 /* setopt, unsetopt */