Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Preventing xtrace / -x from stepping through function from autoload'ed module
- X-seq: zsh-users 26912
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zach Riggle <zachriggle@xxxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Preventing xtrace / -x from stepping through function from autoload'ed module
- Date: Wed, 11 Aug 2021 10:48:45 -0700
- Archived-at: <https://zsh.org/users/26912>
- In-reply-to: <CAMP9c5nqhJV8TLX3e7DCOgobA=+AKd7zKXgND8T=_s7g-FqsAA@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CAMP9c5nqhJV8TLX3e7DCOgobA=+AKd7zKXgND8T=_s7g-FqsAA@mail.gmail.com>
On Wed, Aug 11, 2021 at 1:36 AM Zach Riggle <zachriggle@xxxxxxxxx> wrote:
>
> Documentation on "typeset" indicates that with the "-f" flag, "-ft"
> should turn ON tracing for that function, and "-fT" should turn OFF
> tracing for that function (as long as it is named).
No, that's not correct.
"typeset -ft funcname" turns on tracing for funcname and for every
other function called by funcname during its execution.
"typeset -fT funcname" turns on function tracing for funcname only,
that is, does not keep it on for other functions called by funcname.
Thus "typeset -fT func" will in fact disable the global xtrace for
other functions called by func, but not for func itself. Those other
functions may of course turn xtrace back on again as a consequence of
"typeset -ft" or (inside the function) "setopt xtrace". Note in the
example below that
functions -T innerfunc
disables tracing within bottomfunc.
% topfunc() { print $0; innerfunc }
% innerfunc() { print $0; bottomfunc }
% bottomfunc() { print $0 and done }
% functions -t topfunc
% functions -T innerfunc
% topfunc
+topfunc:0> print topfunc
topfunc
+topfunc:0> innerfunc
+innerfunc:0> print innerfunc
innerfunc
+innerfunc:0> bottomfunc
bottomfunc and done
%
Messages sorted by:
Reverse Date,
Date,
Thread,
Author