zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zach Riggle <zachriggle@gmail.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Preventing xtrace / -x from stepping through function from autoload'ed module
Date: Wed, 11 Aug 2021 10:48:45 -0700	[thread overview]
Message-ID: <CAH+w=7aDTk5AkMasPDmp3YJnGVT-JAy8r1r5=B4T+pFEW69SvA@mail.gmail.com> (raw)
In-Reply-To: <CAMP9c5nqhJV8TLX3e7DCOgobA=+AKd7zKXgND8T=_s7g-FqsAA@mail.gmail.com>

On Wed, Aug 11, 2021 at 1:36 AM Zach Riggle <zachriggle@gmail.com> 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
%


      reply	other threads:[~2021-08-11 17:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11  8:36 Zach Riggle
2021-08-11 17:48 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7aDTk5AkMasPDmp3YJnGVT-JAy8r1r5=B4T+pFEW69SvA@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=zachriggle@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).