From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 3630 invoked from network); 3 Sep 2021 01:44:06 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 3 Sep 2021 01:44:06 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1630633446; b=V8DcF6cbChm8ObJRwsUlQA4/zrxuq/xvbZqIe+/kRHhxEDBLUCgIU0p5NHPo50kppk2y+HBs7q aAajMoEL5Q0LPPBpBtBtdkiU/ChnNNxNSQbaNHjYjmqPBbayJZ/ZhdmSXemAZJ+8JXkNEKl2SJ 6bWMxLEGaCxDkFFrK+e2jI+a/rioeuZMfA/qiFZba9rOx4PcRvR0FhVTjviuL409iIptCAAmId eVWIpdcdA2gKOdG0CnC3bAiwC2p9KRr9DPhMhDeltQ0D4NDcsrjXqZ/SZ2IEi4D4L7GiU5Hy9G iGzL3t4nRrhL3Kkr9nQJ+8C5acHi79g2LYcLxSEWcky9RQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wm1-f54.google.com) smtp.remote-ip=209.85.128.54; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1630633446; bh=rYrYqQx+rZFbzNN3BNQ0r5YPGv9HYqIIty/Cwm+/EHs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=emgpueBYwPJZE+BAdyzUQiAnl21CWPaosRJ7KxtjOHMGPwMBZCT56Qm0Pmh3ateGIy7tqdM7pD deZnP6UuqcbfvFoHitvHM760VSmGAaoixUvVFH201enBilVlGigP6MdvjUoKLbYSg/xK+UGpDn ZMGL8rbOk7sIpRlLIOdQl9iy8wTcyTyv2fbW5zV6/B2pocdKEqQAr8vhZTBZrk7IHXAU7GFgXW r3fnRdtYjziowLYUfsWdesy9f7D/s2zxyivM2QLbFst48aq/nQCtcTwWxsO0qQvLN17jjRWJ2w biQRgw0cbGZpLOfGn8Zuri8LyRKHgYlk8D9EwruTXbVUnQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=Br8NJ0NQeDPom/A/Koq+ml4KAFMrmbXRumG/QAR8L1U=; b=VvLgzrEs4gN0R1WwNxMyHf0ur/ qq1olbhAzutPgsGKW4DCWvHQKAUGdFr5CV8v0o3PZQJ/LKZ9tvbuD4go5p568qCBqq7TqFfyKtNnr miNw4bfsABPmNKt76hforTQJDdRsN+5YF/hI5G4k/kUCMIyJuhC2tEc+E6ZQbCtUi/vC+uZqNwvOV O7XPJiItoGLe347CXbwCtP4iMvPqo4rVMkTf/TT7HPnfUVrVNu2l+MQ8ywLMIXIeYLxYK7P7YZAwJ cl2l4cXde8QaRv9Mvk5YwPFyYME8eyW9kbxb4H50K9gJdTQMi4vcWTi0biypqFSF5wQVs5EErun8e YhWEK2Tg==; Received: from authenticated user by zero.zsh.org with local id 1mLyFQ-000NSg-KK; Fri, 03 Sep 2021 01:44:04 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wm1-f54.google.com) smtp.remote-ip=209.85.128.54; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-wm1-f54.google.com ([209.85.128.54]:54888) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mLyEM-000Miw-J7; Fri, 03 Sep 2021 01:42:59 +0000 Received: by mail-wm1-f54.google.com with SMTP id g138so2484192wmg.4 for ; Thu, 02 Sep 2021 18:42:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=Br8NJ0NQeDPom/A/Koq+ml4KAFMrmbXRumG/QAR8L1U=; b=CMaXzXgCPvfVxA5jmwV9BNRDMT87qz1sqBN9ciWINygSCIAGqQa9y68ZW3l5JJW10B +kb/+uiOgc6HhefkMoIJbDh+CcWySu83b7U9YlcD+y1sDVboK4xSrWa1uvbZEhToQaOV J+P8HGJJJDcfvT1T3WtonCkmtMyKIwokCpKH4JoyFd1ZaJ2KPzUF5TmEfqe8HC2X+1Tv 2MRAwUbAYqzPnzdUSjjypG0rljnB8jTbRxNkKpG8wEzZKX2QjMhAxnr2N0shFfz+3YVk SDHSJXQditSrosBZboD5qhQ5Ofw2eFCFedHtgI4f0rbFbtg5deaCGFcbu1hgXUCtP8rk 6EaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Br8NJ0NQeDPom/A/Koq+ml4KAFMrmbXRumG/QAR8L1U=; b=fSjVJYX84Sd1rxzCYabQQsdBW7hLLt/54VF2LVxIuGB5GALaWPLzfM34KlYf/OLXt/ oCRJS3B5TQKG/PI++AMGkpK9n9ml6bMeoFdKxn0KZ5OrLEkWcN26O6ovUPabu6NOOuI8 EpKeJx1MfzIbuiZi96fh8uiQNHUsf4sj0NTYKxnn8h+cq8MIkiImCVjeoelk3wXZq6Oi 7gvFO202Sez0Frlg5MlolEWB9q03taFOcM0UwG89tTg36EWc5P61wGRLt3LhpmBJqSM/ kJP0qTYLz87OJ6LpNKtMy+ISBd6WBbgCyYjDUWaN7ukUPp/X1RRkeSSCydn7llId+x/V Ao8g== X-Gm-Message-State: AOAM530Tf4yR57jWZ9zx6l6Rinoi+kXQWKKPOoJGNygzY3IuIrAKlggu Xibe9aRfsnfNMf8bu9Dtot98HftxddJ5xc5+PPf8vqluQQ4= X-Google-Smtp-Source: ABdhPJyyjDXKTx3JcPPO1O1vYeQ9TGqikqxNBu0nB1TEcdxeb2qoioFh3ghrFX2vlb6k6Viswj65AayThqRI3qJqfOE= X-Received: by 2002:a7b:c3d0:: with SMTP id t16mr5816637wmj.169.1630633377467; Thu, 02 Sep 2021 18:42:57 -0700 (PDT) MIME-Version: 1.0 From: Zach Riggle Date: Thu, 2 Sep 2021 20:42:46 -0500 Message-ID: Subject: Accessing the evaluated expression which caused an error To: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 27077 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: I have a neat script that registers a TRAPERR function, which dumps out a backtrace, with the filename, line of source, and a few lines of source around the line where the error was triggered. Here's a contrived example: https://i.imgur.com/jDOa8Pq.png This is done using funcfiletrace, funcstack, and syntax-highlighted with 'bat'. I'm aware of funcsourcetrace, funcstack, and TRAPDEBUG / ZSH_DEBUG_CMD as well, but none of these contain the actual expression evaluated -- just the input to zsh. These are excellent to show a backtrace, but I'm curious whether there are additional functions that I might be able to leverage to show the fully-evaluated expression which caused TRAPERR to be invoked. I know that zsh has the data internally, since "zsh -x" shows the fully-evaluated expression, so that data must be available somewhere, even if it's not exposed in a shell variable. I looked through the docs, as well as the output of "env" and "declare" from within TRAPERR, but couldn't find anything helpful. Thanks! Zach Riggle