summaryrefslogtreecommitdiff
path: root/Src/options.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-03-01 13:00:52 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-03-01 13:00:52 +0000
commit7614be7fe1b9a9692a6c8f5c5f471df3ef288366 (patch)
treec15ae5cbd204d26d169923d72a72580a94864b60 /Src/options.c
parent3c3d3dc92c3812a7e7de17200ac8a944ad2dea93 (diff)
downloadzsh-7614be7fe1b9a9692a6c8f5c5f471df3ef288366.tar.gz
zsh-7614be7fe1b9a9692a6c8f5c5f471df3ef288366.zip
30303: emulate inside function marked for execution tracing enables xtrace
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 */