zsh-users
 help / color / mirror / code / Atom feed
From: Zach Riggle <zachriggle@gmail.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Preventing xtrace / -x from stepping through function from autoload'ed module
Date: Wed, 11 Aug 2021 03:36:05 -0500	[thread overview]
Message-ID: <CAMP9c5nqhJV8TLX3e7DCOgobA=+AKd7zKXgND8T=_s7g-FqsAA@mail.gmail.com> (raw)

Hello again, thanks in advance for the help.

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).

However, quick experimentation doesn't align with my reading of the
docs -- "typeset -ft func" DOES work to enable tracing for that
function, but "typeset -fT func" does NOT disable tracing for that
function (when tracing is enabled globally via e.g. "set -x").

Are my expectations for "typeset -fT" out of line?  Its inverse,
"typeset -ft" does seem to work as I expect it to.

    #!/usr/bin/env zsh

    # Turn ON execution tracing
    set -x

    # Turn OFF execution tracing for the named function, before declaration
    typeset -fT hello

    hello() {
        echo "$@"
    }

    # Turn OFF execution tracing for the named function, after declaration
    # (not sure which order is intended so we try both.)
    typeset -fT hello

    # Testing shows that "hello" is traced, which is NOT expected
    hello "Should not be traced"

    # Turn ON function tracing for hello
    set +x
    typeset -ft hello

    # Testing shows that "hello" is traced, here as expected
    hello "Should be traced"


Zach Riggle


             reply	other threads:[~2021-08-11  8:37 UTC|newest]

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

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='CAMP9c5nqhJV8TLX3e7DCOgobA=+AKd7zKXgND8T=_s7g-FqsAA@mail.gmail.com' \
    --to=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).