GNU bug report logs - #1343
[PATCH] trace package

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Vitaly Mayatskikh <v.mayatskih@HIDDEN>; Keywords: patch; merged with #6464, #27397; dated Fri, 14 Nov 2008 00:05:06 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Forcibly Merged 1343 6464 27397. Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 1343 6464. Request was from Glenn Morris <rgm@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at (unknown):


Received: (at unknown) by unknown; unknown
X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02
	(2007-08-08) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Status: No, score=-10.0 required=4.0 tests=BAYES_00,IMPRONONCABLE_2,
	MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_MED,X_DEBBUGS_NO_ACK autolearn=ham
	version=3.2.3-bugs.debian.org_2005_01_02
Received: (at quiet) by emacsbugs.donarmstrong.com; 13 Nov 2008 23:58:39 +0000
Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10])
	by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mADNwaZw019886
	for <quiet@HIDDEN>; Thu, 13 Nov 2008 15:58:37 -0800
Received: from rgm by fencepost.gnu.org with local (Exim 4.67)
	(envelope-from <rgm@HIDDEN>)
	id 1L0m54-0002a8-Cd
	for quiet@HIDDEN; Thu, 13 Nov 2008 18:58:34 -0500
From: Vitaly Mayatskikh <v.mayatskih@HIDDEN>
To: quiet <at> debbugs.gnu.org
Subject: [PATCH] trace package
Date: Tue, 11 Nov 2008 21:24:02 +0100
Lines: 66
X-From-Line: emacs-devel-bounces+rgm=gnu.org@HIDDEN  Tue Nov 11 15:23:21 2008
Received: from mail.gnu.org ([199.232.76.166]:45056 helo=mx10.gnu.org)
	by fencepost.gnu.org with esmtp (Exim 4.67)
	(envelope-from <emacs-devel-bounces+rgm=gnu.org@HIDDEN>)
	id 1Kzzlh-00019z-8v
	for rgm@HIDDEN; Tue, 11 Nov 2008 15:23:21 -0500
Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60)
	(envelope-from <emacs-devel-bounces+rgm=gnu.org@HIDDEN>)
	id 1Kzzoh-0001ZN-PL
	for rgm@HIDDEN; Tue, 11 Nov 2008 15:26:28 -0500
Received: from lists.gnu.org ([199.232.76.165]:49476)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <emacs-devel-bounces+rgm=gnu.org@HIDDEN>)
	id 1Kzzog-0001ZB-1e
	for rgm@HIDDEN; Tue, 11 Nov 2008 15:26:26 -0500
Received: from localhost ([127.0.0.1]:43470 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43)
	id 1Kzzof-0000bB-Qb
	for rgm@HIDDEN; Tue, 11 Nov 2008 15:26:25 -0500
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Kzzma-0007rm-9P
	for emacs-devel@HIDDEN; Tue, 11 Nov 2008 15:24:16 -0500
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1KzzmY-0007qs-Be
	for emacs-devel@HIDDEN; Tue, 11 Nov 2008 15:24:15 -0500
Received: from [199.232.76.173] (port=42861 helo=monty-python.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1KzzmY-0007qV-2u
	for emacs-devel@HIDDEN; Tue, 11 Nov 2008 15:24:14 -0500
Received: from ug-out-1314.google.com ([66.249.92.172]:36941)
	by monty-python.gnu.org with esmtp (Exim 4.60)
	(envelope-from <v.mayatskih@HIDDEN>) id 1KzzmW-0001H9-Kq
	for emacs-devel@HIDDEN; Tue, 11 Nov 2008 15:24:13 -0500
Received: by ug-out-1314.google.com with SMTP id 36so1015749uga.17
	for <emacs-devel@HIDDEN>; Tue, 11 Nov 2008 12:24:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:date:message-id:from:to
	:subject:user-agent:mime-version:content-type;
	bh=DPB6Kmmvrt756roox2IBYR626R79yMPzOKeRDSKYKjI=;
	b=wDYXvMwL4/MvpTRXysxmKT+CZEidLAcTP/UxezIKbmqtse5YMrw5MxWYlvkBx0Yh95
	IXwvRQnvIq6AK7+2meDcHKUXpUz6anLG4nixeZdLzFmlRhehV5HBcQkx/gcoMyM5EJq6
	7HT1QVOVjvfRQuIqO5EWSrARAkUomvLUS1EC8=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=date:message-id:from:to:subject:user-agent:mime-version
	:content-type;
	b=C66HSUuGiLTUruozWNX6wvciT12p5DdCphiM4IGRFNhdxfJumzwgwkstVjKy3z4tMr
	KVxWiwIP2pYJi4bzxzlsP+7/xZgL7Wpjj4IWXBtdvZxfyzef9CUI9aLdLI+AqIrMyvjS
	IH8ygwiwozpC2UxlsiV0AxutTw1rbfMAI7/wQ=
Received: by 10.210.22.8 with SMTP id 8mr9594688ebv.46.1226435046701;
	Tue, 11 Nov 2008 12:24:06 -0800 (PST)
Received: from gravicappa.englab.brq.redhat.com (r10ni46.net.upc.cz
	[78.45.116.46])
	by mx.google.com with ESMTPS id 7sm2004616eyg.9.2008.11.11.12.24.04
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Tue, 11 Nov 2008 12:24:05 -0800 (PST)
X-Debbugs-No-Ack: yes
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2)
X-BeenThere: emacs-devel@HIDDEN
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Emacs development discussions." <emacs-devel.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@HIDDEN?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/emacs-devel>
List-Post: <mailto:emacs-devel@HIDDEN>
List-Help: <mailto:emacs-devel-request@HIDDEN?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/emacs-devel>,
	<mailto:emacs-devel-request@HIDDEN?subject=subscribe>
Errors-To: emacs-devel-bounces+rgm=gnu.org@HIDDEN
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4)
Message-ID: <7g8wrnqitx.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Sender: Glenn Morris <rgm@HIDDEN>

Severity: wishlist
Tags: patch

[ resent from
  http://lists.gnu.org/archive/html/emacs-devel/2008-11/msg00347.html ]


trace.el has functions trace-function and trace-function-background,
which allows to add function or macro for tracing. Sometimes it is
useful to trace a bunch of functions in one package, like it is done
in elp.el (Emacs Lisp Profiler), but trace.el lacks this
facility. This patch introduces 3 functions to help with package
tracing: trace-package, trace-package-background and untrace-package.

Index: lisp/emacs-lisp/trace.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/trace.el,v
retrieving revision 1.22
diff -p -u -w -r1.22 trace.el
--- lisp/emacs-lisp/trace.el	10 Jun 2008 16:08:46 -0000	1.22
+++ lisp/emacs-lisp/trace.el	10 Nov 2008 19:40:37 -0000
@@ -153,6 +153,7 @@
 ;;; Code:
 
 (require 'advice)
+(require 'cl)
 
 (defgroup trace nil
   "Tracing facility for Emacs Lisp functions."
@@ -297,6 +298,37 @@ was not traced this is a noop."
   (ad-do-advised-functions (function)
     (untrace-function function)))
 
+(macrolet ((defun-trace-package (name background doc)
+	     `(defun ,name (prefix &optional buffer)
+		,doc
+		(interactive
+		 (list
+		  (completing-read "Prefix of package to trace: " obarray)
+		  (read-buffer "Output to buffer: " trace-buffer)))
+		(if (zerop (length prefix))
+		    (error "Tracing all Emacs functions would render Emacs unusable"))
+		(dolist (fun (mapcar 'intern (all-completions prefix obarray 'fboundp t)))
+		  (trace-function-internal fun buffer ,background)))))
+  (defun-trace-package trace-package nil
+    "Traces all functions which start with PREFIX. Trace output going to BUFFER.
+For example, to trace all TRACE functions, do the following:
+
+    \\[trace-package] RET trace- RET")
+  (defun-trace-package trace-package-background t
+    "Traces all functions which start with PREFIX. Trace output going quietly
+to BUFFER. For example, to trace all TRACE functions, do the following:
+
+    \\[trace-package] RET trace- RET"))
+
+(defun untrace-package (prefix)
+  "Untraces all functions which start with PREFIX, and possibly activates
+all remaining advice."
+  (interactive
+   (list
+    (completing-read "Prefix of package to untrace: " obarray)))
+  (dolist (fun (mapcar 'intern (all-completions prefix obarray 'trace-is-traced t)))
+    (untrace-function fun)))
+
 (provide 'trace)
 
 ;; arch-tag: cfd170a7-4932-4331-8c8b-b7151942e5a1

--
wbr, Vitaly




Report stored:
bug#1343; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 16 Jun 2017 15:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.