From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Davin Pearson Newsgroups: gmane.emacs.devel Subject: Re: How to highlight the offending line of code with edebug Date: Mon, 2 Jan 2023 13:27:08 +1300 Message-ID: References: <83fsd68u3f.fsf@gnu.org> <87ili2o9lc.fsf@md5i.com> <83zgbe7bu1.fsf@gnu.org> <83bknq2vrk.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000f2e35505f13d0320" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35651"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mwd@md5i.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 02 01:28:12 2023 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 1pC8gW-000973-31 for ged-emacs-devel@m.gmane-mx.org; Mon, 02 Jan 2023 01:28:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pC8fs-00062m-GN; Sun, 01 Jan 2023 19:27:32 -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 1pC8fq-0005zY-Rh for emacs-devel@gnu.org; Sun, 01 Jan 2023 19:27:30 -0500 Original-Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pC8fn-0008Px-Pq; Sun, 01 Jan 2023 19:27:30 -0500 Original-Received: by mail-pj1-x1034.google.com with SMTP id o2so23036992pjh.4; Sun, 01 Jan 2023 16:27:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=r+cTBR3ZVvu46HSEEhBAtkXtDg4TJVZJaJ5JVG+erJ0=; b=GClzDd4s8QCBHdg1IwXyijPkzmXgglm/5dEwVHJfFfZYIprY9Xjj7oVJza6a/4cXSD GvgqqKjGOKwxvqsmPe/+h7TU3Buvgpn3hcWVxYkqgJ/lqFCJmXr+DFoRJSNM7sJEX7qM YHPjI81j/h3mUpwPfQwJPXRFtOSa9R4EbaZ0x233s5+4dLkm5q+CNchFMEcEE+dm8osJ qQB/ip1P4e8WZwRHsKD0vBxA2UjRgWhV0CdXdWreHd7cdFqPfAff+xlpe+NAEYucueKE pRUdQmZM4bwproib6jwJSJ58XbL3PIlQr6BqF4klKA258rAVkBVKAOMsylQk+mH8FNa5 H/6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=r+cTBR3ZVvu46HSEEhBAtkXtDg4TJVZJaJ5JVG+erJ0=; b=SAKxfyZKJWL6xD+pKlDCPbKlbt+h2M4LVHFS6+9G3VuAiqUsD1SQmJv7hXpEyEOm1+ AMq9DMaKS97HcUggsML9ZKpm4RhgjrsWWCrB0YW6ablMd7Fnstm1T/DAETasHDOWF+NM 410Iv3UoCItM7n4dEm5ldW9pG7NUx5dMIroEzJGMHxpJgZbRBkGJemIUQBYZx6SojEXj oe5hPI50A5gRoVZWNQ7TiToMa6TTPNq4l6vpC7SYYn87hvEGxO/eGhFGs6PI+7y7HQAV ukTP6NPi6R4LHOArLiJKd6rL1fhdXI9M5F1iqkpGGIE+9XqsSIOS8EQTUYrO7EIaKohq mXGQ== X-Gm-Message-State: AFqh2kq6cBxOVqXplDDRBc1cB9jjuZq7wIMdUMHCky9SXZzs72BgH4bZ E7tGUEEPNIRMDiTT6jKb4ChFtdWwLYqWr7o9JJ8MBA6PfwA= X-Google-Smtp-Source: AMrXdXtTtpo0igDrqd5Ijn2OiPYLsOlAoH6EKySlr0NAiIDGMr4DUkp8dsxwuWwbPxFdJR0ex5BKWV38DKL4pmGyQH8= X-Received: by 2002:a17:903:200a:b0:192:ce13:518a with SMTP id s10-20020a170903200a00b00192ce13518amr115682pla.117.1672619245100; Sun, 01 Jan 2023 16:27:25 -0800 (PST) In-Reply-To: <83bknq2vrk.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=davin.pearson@gmail.com; helo=mail-pj1-x1034.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:302185 Archived-At: --000000000000f2e35505f13d0320 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable (progn (setq edebug-eval-top-level-form t) (setq edebug-all-defs t) (setq edebug-all-forms t) (setq edebug-on-error t)) (defun smegulator () void-variable-smeg ) ;;(smegulator) (defmacro dmp-quote (&rest rest) t) (dmp-quote When I put the following code at the start of my .emacs file it executes without errors as it should. However when I evaluate (smegulator) it brings up the following message, without a black triangle elisp--eval-last-sexp: Symbol=E2=80=99s value as variable is void: void-variable-smeg When I execute C-u C-M-x on (defun smegulator () void-variable-smeg) it brings up the following messages. edebug-after: Symbol=E2=80=99s value as variable is void: void-variable-sme= g elisp--eval-last-sexp: Symbol=E2=80=99s value as variable is void: void-variable-smeg with a black triangle indicating we are in edebug mode. How do I get the black triangle online in other files for debugging my code= ? i.e. how do you get Emacs to do a C-u C-M-x on every defun without doing it manually C-u C-M-x for every function one at a time? ) *Davin.* On Tue, 27 Dec 2022 at 01:29, Eli Zaretskii wrote: > > 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=E2=80=99s 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=E2=80=99s 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 =E2=80=98edebug-all-defs=E2=80=99 is non-=E2=80=98nil=E2=80=99, t= hen the commands =E2=80=98eval-region=E2=80=99, > =E2=80=98eval-current-buffer=E2=80=99, and =E2=80=98eval-buffer=E2=80= =99 also instrument any definitions > they evaluate. Similarly, =E2=80=98edebug-all-forms=E2=80=99 controls = whether > =E2=80=98eval-region=E2=80=99 should instrument _any_ form, even non-de= fining forms. > This doesn=E2=80=99t apply to loading or evaluations in the minibuffer.= The > command =E2=80=98M-x edebug-all-forms=E2=80=99 toggles this option. > > Another command, =E2=80=98M-x edebug-eval-top-level-form=E2=80=99, i= s available to > instrument any top-level form regardless of the values of > =E2=80=98edebug-all-defs=E2=80=99 and =E2=80=98edebug-all-forms=E2=80= =99. =E2=80=98edebug-defun=E2=80=99 is an alias > for =E2=80=98edebug-eval-top-level-form=E2=80=99. > > I think this answers your questions. > --000000000000f2e35505f13d0320 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
(progn
=C2=A0 (setq edebug-eval-top-level-form t)
= =C2=A0 (setq edebug-all-defs t)
=C2=A0 (setq edebug-all-forms t)
=C2= =A0 (setq edebug-on-error t))

(defun smegulator ()
=C2=A0 void-va= riable-smeg
=C2=A0 )

;;(smegulator)

(defmacro dmp-quote (&= amp;rest rest)
=C2=A0 t)

(dmp-quote

When I put the followi= ng code at the start of
my .emacs file it executes without errors as
= it should.

However when I evaluate (smegulator) it brings
up the = following message, without a black triangle

elisp--eval-last-sexp: S= ymbol=E2=80=99s value as variable is void: void-variable-smeg

When I= execute C-u C-M-x on (defun smegulator () void-variable-smeg)
it brings= up the following messages.

edebug-after: Symbol=E2=80=99s value as = variable is void: void-variable-smeg

elisp--eval-last-sexp: Symbol= =E2=80=99s value as variable is void: void-variable-smeg
with a black tr= iangle indicating we are in edebug mode.

How do I get the black tria= ngle online in other files for debugging my code?

i.e. how do you ge= t Emacs to do a C-u C-M-x on every defun =C2=A0without doing
it manually= C-u C-M-x for every function one at a time?

)
Davin.


On Tue, 27 Dec 2022 = at 01:29, Eli Zaretskii <eliz@gnu.org> wrote:
>= ; From: Davin Pearson <davin.pearson@gmail.com>
> Date: Mon, 26 Dec 2022 13:54:39 +1300
> Cc: Michael Welsh Duggan <mwd@md5i.com>, emacs-devel@gnu.org
>
> Consider the following code:
>
> (progn
>=C2=A0 =C2=A0(defun foo ()
>=C2=A0 =C2=A0 =C2=A0tomcat
>=C2=A0 =C2=A0 =C2=A0)
>=C2=A0 =C2=A0(defun bar ()
>=C2=A0 =C2=A0 =C2=A0(foo))
>=C2=A0 =C2=A0)
>
> (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<= br> > tomcat, thus indicating that we are stepping through the foo
> function which is what I want.
>
> The error message is this:
>
> edebug-after: Symbol=E2=80=99s value as variable is void: tomcat
>
> This is all good.=C2=A0 What I need to know is how to instrument every=
> function for debugging.=C2=A0 I tried the following command at
> the top of my ~/.emacs file:
>
> (progn
>=C2=A0 =C2=A0(setq edebug-on-error t)
>=C2=A0 =C2=A0(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=E2=80=99s 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:

=C2=A0 =C2=A0 =C2=A0If =E2=80=98edebug-all-defs=E2=80=99 is non-=E2=80=98ni= l=E2=80=99, then the commands =E2=80=98eval-region=E2=80=99,
=C2=A0 =E2=80=98eval-current-buffer=E2=80=99, and =E2=80=98eval-buffer=E2= =80=99 also instrument any definitions
=C2=A0 they evaluate.=C2=A0 Similarly, =E2=80=98edebug-all-forms=E2=80=99 c= ontrols whether
=C2=A0 =E2=80=98eval-region=E2=80=99 should instrument _any_ form, even non= -defining forms.
=C2=A0 This doesn=E2=80=99t apply to loading or evaluations in the minibuff= er.=C2=A0 The
=C2=A0 command =E2=80=98M-x edebug-all-forms=E2=80=99 toggles this option.<= br>
=C2=A0 =C2=A0 =C2=A0Another command, =E2=80=98M-x edebug-eval-top-level-for= m=E2=80=99, is available to
=C2=A0 instrument any top-level form regardless of the values of
=C2=A0 =E2=80=98edebug-all-defs=E2=80=99 and =E2=80=98edebug-all-forms=E2= =80=99.=C2=A0 =E2=80=98edebug-defun=E2=80=99 is an alias
=C2=A0 for =E2=80=98edebug-eval-top-level-form=E2=80=99.

I think this answers your questions.
--000000000000f2e35505f13d0320--