From 7614be7fe1b9a9692a6c8f5c5f471df3ef288366 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 1 Mar 2012 13:00:52 +0000 Subject: 30303: emulate inside function marked for execution tracing enables xtrace --- Src/options.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Src/options.c') 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 */ -- cgit 1.4.1