From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24886 invoked from network); 13 Aug 2008 00:01:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Aug 2008 00:01:23 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 4865 invoked from network); 13 Aug 2008 00:01:08 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Aug 2008 00:01:08 -0000 Received: (qmail 18088 invoked by alias); 13 Aug 2008 00:00:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25446 Received: (qmail 18070 invoked from network); 13 Aug 2008 00:00:52 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 13 Aug 2008 00:00:52 -0000 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.180]) by bifrost.dotsrc.org (Postfix) with ESMTP id C5CA980F75A4 for ; Wed, 13 Aug 2008 02:00:42 +0200 (CEST) Received: by wa-out-1112.google.com with SMTP id v27so457468wah.21 for ; Tue, 12 Aug 2008 17:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:mime-version:content-type; bh=JRhHR2zDPEKFzz9Sq4BAO4ESQrr4QaMaiQbMF3skLmo=; b=r7hxNKRAGRKWp8X0u6NynYKf5525GawPw/hGvCFr3GSwH5J4XoXJcwt4+hHUr2RQIe k3usoU4MBYqhUcCqDZYDy2gh0E8ju8GbuSRyYa73S+Asf5QB+j8WcgNPlFujV0lu6h8K jR5B3N1HGBO7inWZzJIHrlSkwFahD/MI9gRtQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:mime-version:content-type; b=w9GoIfUc0C3SCtNomTmF+Banw78WetIIRXP5UvEtw9xD8zRENtPozckH341/c9ZcRs MSxe87eqT1nNs0dYf5Psf8npLqbvjzzvUsykpMsoysrlKfjRwlw0Xj2dSjd/AS76UVQZ d4CyrBwC/5+hxXKWQJCvWqfJl6x1TQDpIHoFE= Received: by 10.114.106.13 with SMTP id e13mr5662123wac.157.1218585640996; Tue, 12 Aug 2008 17:00:40 -0700 (PDT) Received: by 10.114.159.2 with HTTP; Tue, 12 Aug 2008 17:00:40 -0700 (PDT) Message-ID: <6cd6de210808121700kf500ea6p9b3eed0fefadfc8@mail.gmail.com> Date: Tue, 12 Aug 2008 20:00:40 -0400 From: "Rocky Bernstein" To: "Peter Stephenson" Subject: functrace and funcsourcetrace (was Re: PATCH: trace information for sourced files) Cc: "Zsh hackers list" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_79971_16823798.1218585640966" X-Virus-Scanned: ClamAV 0.92.1/8021/Tue Aug 12 21:27:39 2008 on bifrost X-Virus-Status: Clean ------=_Part_79971_16823798.1218585640966 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I updated today from CVS sources and built. I tried a little test and alas, I'm sorry to report that I can't use this. I've attached the little test program called linebug.sh. It doesn't do any "source"'ing. rocky-patch.out contains the output given with the patch I submitted. functrace.out contains output using $functrace and funcsourcetrace.out contains output using $funcsourcetrace.out. Right now I can't see how to patch together the output from functrace and funcsourcetrace. But it really doesn't matter because it shouldn't be that convoluted either. What we want is an array that contains the source file name and absolute line number of the place where we were called from. If the caller has a caller, then another array entry for the source file and line number of that location, and so on. This is the way it works in virtually every other programming language I can think of. Perl, Python, Ruby, Java, C, C++, bash, ksh, LISP, to name some that come to mind. Right now functrace (whose output is shown in functrace.out), seems to come the closest were it not for this function information getting put there inside functions instead, and which is sort of duplicated in funcstack. I am not fussy about what name you want to give this, whether you want to have several parallel arrays for functions, file names, line numbers and so on, or fewer with each string encoding more than one bit of information. However the the filenames and line numbers have to be there, and match the information as shown in rocky-patch.out for the run in linebug.sh. Thanks. On Tue, Aug 12, 2008 at 4:27 PM, Peter Stephenson wrote: > On Tue, 12 Aug 2008 15:58:03 -0400 > "Rocky Bernstein" wrote: >> > I'm not sure what to put in $funcsourcetrace since there is no separate >> > point of definition from that of the caller in this case. >> >> How about "source" or ".". Down the line one may want to record the >> number of parameters passed, and here I note that zsh allows passing >> parameters in a source command. > > OK, I've committed it so that the funcsourcetrace element shows up as > "source:0". > > I had a look at providing the text for debug traps but it wasn't as > trivial as I'd hoped so that may have to wait. > > -- > Peter Stephenson > Web page now at http://homepage.ntlworld.com/p.w.stephenson/ > > ------=_Part_79971_16823798.1218585640966 Content-Type: application/x-sh; name=linebug.sh Content-Transfer-Encoding: base64 X-Attachment-Id: f_fjt5iho40 Content-Disposition: attachment; filename=linebug.sh cHJpbnRfc3RhY2soKSB7CiAgICBmb3IgZmlsZV9saW5lIGluICRmdW5jc291cmNldHJhY2VbQF07 IGRvIAoJcHJpbnQgJGZpbGVfbGluZQogICAgZG9uZQogICAgcHJpbnQgJz09PT0nCn0Kc2V0IC1v IERFQlVHX0JFRk9SRV9DTUQKdHJhcCAncHJpbnRfc3RhY2snIERFQlVHCmZvbygpIHsKICBlY2hv IGNhbGxpbmcgYmFyIDEwCiAgYmFyIDEwCn0KYmFyKCkgewogIHg9MjAKfQpmb28gYXJnMSAkMQp4 PTUK ------=_Part_79971_16823798.1218585640966 Content-Type: application/octet-stream; name=rocky-patch.out Content-Transfer-Encoding: base64 X-Attachment-Id: f_fjt5ljf72 Content-Disposition: attachment; filename=rocky-patch.out JCAvdXNyL2xvY2FsL2Jpbi96c2ggbGluZWJ1Zy5zaAoKbGluZWJ1Zy5zaDo5Cj09PT0KbGluZWJ1 Zy5zaDoxMwo9PT09CmxpbmVidWcuc2g6MTYKPT09PQpsaW5lYnVnLnNoOjEwCmxpbmVidWcuc2g6 MTYKPT09PQpjYWxsaW5nIGJhciAxMApsaW5lYnVnLnNoOjExCmxpbmVidWcuc2g6MTYKPT09PQps aW5lYnVnLnNoOjE0CmxpbmVidWcuc2g6MTEKbGluZWJ1Zy5zaDoxNgo9PT09CmxpbmVidWcuc2g6 MTcKPT09PQo= ------=_Part_79971_16823798.1218585640966 Content-Type: application/octet-stream; name=functrace.out Content-Transfer-Encoding: base64 X-Attachment-Id: f_fjt5mfqu2 Content-Disposition: attachment; filename=functrace.out JCAvdXNyL2xvY2FsL2Jpbi96c2ggLi9saW5lYnVnLnNoCgouL2xpbmVidWcuc2g6OQo9PT09Ci4v bGluZWJ1Zy5zaDoxMwo9PT09Ci4vbGluZWJ1Zy5zaDoxNgo9PT09CmZvbzoxCi4vbGluZWJ1Zy5z aDoxNgo9PT09CmNhbGxpbmcgYmFyIDEwCmZvbzoyCi4vbGluZWJ1Zy5zaDoxNgo9PT09CmJhcjox CmZvbzoyCi4vbGluZWJ1Zy5zaDoxNgo9PT09Ci4vbGluZWJ1Zy5zaDoxNwo9PT09CiA3OjE3UE0g cm9ja3lAZHItZmVyZGluYW5kIC9zcmMvZ2l0L3pzaGRiL2J1ZyBbMyB6XSAwCiQgCg== ------=_Part_79971_16823798.1218585640966 Content-Type: application/octet-stream; name=funcsourcetrace.out Content-Transfer-Encoding: base64 X-Attachment-Id: f_fjt5nh973 Content-Disposition: attachment; filename=funcsourcetrace.out JCAvdXNyL2xvY2FsL2Jpbi96c2ggLi9saW5lYnVnLnNoCgouL2xpbmVidWcuc2g6MQo9PT09Ci4v bGluZWJ1Zy5zaDoxCj09PT0KLi9saW5lYnVnLnNoOjEKPT09PQouL2xpbmVidWcuc2g6MQouL2xp bmVidWcuc2g6OQo9PT09CmNhbGxpbmcgYmFyIDEwCi4vbGluZWJ1Zy5zaDoxCi4vbGluZWJ1Zy5z aDo5Cj09PT0KLi9saW5lYnVnLnNoOjEKLi9saW5lYnVnLnNoOjEzCi4vbGluZWJ1Zy5zaDo5Cj09 PT0KLi9saW5lYnVnLnNoOjEKPT09PQo= ------=_Part_79971_16823798.1218585640966--