From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: How to highlight the offending line of code with edebug Date: Mon, 26 Dec 2022 14:29:35 +0200 Message-ID: <83bknq2vrk.fsf@gnu.org> References: <83fsd68u3f.fsf@gnu.org> <87ili2o9lc.fsf@md5i.com> <83zgbe7bu1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33224"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mwd@md5i.com, emacs-devel@gnu.org To: Davin Pearson Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 26 13:30:25 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p9mca-0008Sx-QD for ged-emacs-devel@m.gmane-mx.org; Mon, 26 Dec 2022 13:30:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9mbo-0005TN-36; Mon, 26 Dec 2022 07:29:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9mbj-0005So-Ke for emacs-devel@gnu.org; Mon, 26 Dec 2022 07:29:31 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9mbj-00018T-CA; Mon, 26 Dec 2022 07:29:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=4gzw/e2MDC343ygC8aKunSviRPwAGq5Ag7IkCkYTeJo=; b=QrR1s/psGrFXeAFD4TkU OIvIR44DJdev5guMjTEtkD1NpAOgo/POaWEorb5Shm0lKQHXbS4+ZGuHJU4I8bh6oZg92VMdca2H1 5nbgOK0fWq8QFOXqkePkRegbNA39c/nTvEakaRtwNhID/nuzjJlul2klop+rmqUSTQ5F3OLeaJW7C y1mx1Gio9J6+EO/2XBXcPUDB/Am0uDIZDiSrwtLiqgUI95tsCR4+QCis77KbCh/qhQPvRewH47Anb BsofJousd4jJSM126p11WUUQpZ9aAkPVTSccUSAqtwHWSB8syQfDOEo81Vd42cPlr15zEV410lNys kbNvE7HZ2GrLPw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9mbi-00065V-LK; Mon, 26 Dec 2022 07:29:30 -0500 In-Reply-To: (message from Davin Pearson on Mon, 26 Dec 2022 13:54:39 +1300) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301929 Archived-At: > From: Davin Pearson > Date: Mon, 26 Dec 2022 13:54:39 +1300 > Cc: Michael Welsh Duggan , emacs-devel@gnu.org > > Consider the following code: > > (progn > (defun foo () > tomcat > ) > (defun bar () > (foo)) > ) > > (bar) > > When I instrument the foo and bar defuns for debugging by > entering the command C-u M-C-x over the (progn ...) sexp and > pressing the "n" key it comes with a black triangle next to > tomcat, thus indicating that we are stepping through the foo > function which is what I want. > > The error message is this: > > edebug-after: Symbol’s value as variable is void: tomcat > > This is all good. What I need to know is how to instrument every > function for debugging. I tried the following command at > the top of my ~/.emacs file: > > (progn > (setq edebug-on-error t) > (setq edebug-all-defs t)) > > When I put the above foo/bar/tomcat code in another file and I > try to instrument the foo and bar methods for debugging, again > with C-u M-C-x it comes back with the following error: > > bar: Symbol’s value as variable is void: tomcat > > Note that there is no black triangle next to the tomcat sexp, > indicating we are using the debug module and not the edebug > module, which is not what I want. > > How do I get every function marked as instrumented? According to the manual: If ‘edebug-all-defs’ is non-‘nil’, then the commands ‘eval-region’, ‘eval-current-buffer’, and ‘eval-buffer’ also instrument any definitions they evaluate. Similarly, ‘edebug-all-forms’ controls whether ‘eval-region’ should instrument _any_ form, even non-defining forms. This doesn’t apply to loading or evaluations in the minibuffer. The command ‘M-x edebug-all-forms’ toggles this option. Another command, ‘M-x edebug-eval-top-level-form’, is available to instrument any top-level form regardless of the values of ‘edebug-all-defs’ and ‘edebug-all-forms’. ‘edebug-defun’ is an alias for ‘edebug-eval-top-level-form’. I think this answers your questions.