unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#52479: 27.2; EDebugging stops when breakpoint condition can not be printed
@ 2021-12-14 13:03 Петров Андрей
  2021-12-15  5:26 ` Michael Heerdegen
  0 siblings, 1 reply; 5+ messages in thread
From: Петров Андрей @ 2021-12-14 13:03 UTC (permalink / raw)
  To: 52479

Hello, team!
The following code can reproduce the bug:


(require 'cl-lib)
(require 'eieio)

(defclass my-field ()
  ((from-types :initform nil)
   (type :initform nil)))

(defun test ()
  "Demonstrates edebug condition printing bug.
1. evaluate the buffer
2. instrument `test' function for debugging
3. add conditional breakpoint inside lambda below (see comment)
   M-x edebug-set-conditional-breakpoint [RET] root [RET]
4. Start the function for debugging
   M-x (test)
5. Continue to the breakpoint
   c

Now error: \"Apparently circular structure being printed\" is
printed and no further debugging is possible.
"
  (let* ((root (my-field))
	 (tmp root))
    (dotimes (i 100)
      (let ((a (my-field)))
	(push a (oref tmp type))
	(push tmp (oref a from-types))
	(setf tmp a)))
    (push root (oref tmp type))    
    (cl-remove root '(1 2 3 4) :test (lambda (a b) ;; <-- put cursor here and set
				       ;; conditional breakpoint with condition: root
				       (= (length (oref a from-types))) b))
    (cl-remove root '(1 2 3 4) :test (lambda (a b) (= (length (oref a from-types))) b))
    (cl-remove root '(1 2 3 4) :test (lambda (a b) (= (length (oref a from-types))) b))
    "Finished"
    ))


It hard for me to get backtraces on the example but on other
(complicated) code I got the following using recursive edit:

Debugger entered--Lisp error: (error "Apparently circular structure being printed")
  apply(debug error (error "Apparently circular structure being printed"))
  edebug(error (error "Apparently circular structure being printed"))
  signal(error ("Apparently circular structure being printed"))
  edebug-signal(error ("Apparently circular structure being printed"))
  message("Break: %s => %s" filtered (#<field field-157aa078be4c>))
  edebug--display-1(nil 0 before)
  edebug--display(nil 0 before)
  edebug-debugger(0 before nil)
  edebug-before(0)
  (edebug-after (edebug-before 0) 11 (find-inpas-paths (edebug-after 0 1 parent) (edebug-after 0 2 stop-id) (edebug-after (edebug-before 3) 10 (if (edebug-after 0 4 filtered) (edebug-after (edebug-before 5) 8 (cl-remove (edebug-after 0 6 parent) (edebug-after 0 7 context) :count 1 :test (lambda (a b) (edebug-enter ... ... ...)))) (edebug-after 0 9 context)))))
  (lambda nil (edebug-after (edebug-before 0) 11 (find-inpas-paths (edebug-after 0 1 parent) (edebug-after 0 2 stop-id) (edebug-after (edebug-before 3) 10 (if (edebug-after 0 4 filtered) (edebug-after (edebug-before 5) 8 (cl-remove (edebug-after 0 6 parent) (edebug-after 0 7 context) :count 1 :test (lambda ... ...))) (edebug-after 0 9 context))))))()
  edebug-default-enter(edebug-anon17 (#<field field-157aa078be4c>) (lambda nil (edebug-after (edebug-before 0) 11 (find-inpas-paths (edebug-after 0 1 parent) (edebug-after 0 2 stop-id) (edebug-after (edebug-before 3) 10 (if (edebug-after 0 4 filtered) (edebug-after (edebug-before 5) 8 (cl-remove ... ... :count 1 :test ...)) (edebug-after 0 9 context)))))))
  edebug-enter(edebug-anon17 (#<field field-157aa078be4c>) (lambda nil (edebug-after (edebug-before 0) 11 (find-inpas-paths (edebug-after 0 1 parent) (edebug-after 0 2 stop-id) (edebug-after (edebug-before 3) 10 (if (edebug-after 0 4 filtered) (edebug-after (edebug-before 5) 8 (cl-remove ... ... :count 1 :test ...)) (edebug-after 0 9 context)))))))
  (lambda (parent) (edebug-enter 'edebug-anon17 (list parent) #'(lambda nil (edebug-after (edebug-before 0) 11 (find-inpas-paths (edebug-after 0 1 parent) (edebug-after 0 2 stop-id) (edebug-after ... 10 ...))))))(#<field field-157aa078be4c>)
  mapcan((lambda (parent) (edebug-enter 'edebug-anon17 (list parent) #'(lambda nil (edebug-after (edebug-before 0) 11 (find-inpas-paths (edebug-after 0 1 parent) (edebug-after 0 2 stop-id) (edebug-after ... 10 ...)))))) (#<field field-157aa078be4c>))


P.S. I could not copy the text from emacs with C-c M-i according to hint:
While in the mail buffer:

  Type C-c C-c to send the bug report.
  Type C-x k RET to cancel (don’t send it).
  Type C-c M-i to copy text to your preferred mail program.   <----


Andrey Petrov.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52479: 27.2; EDebugging stops when breakpoint condition can not be printed
  2021-12-14 13:03 bug#52479: 27.2; EDebugging stops when breakpoint condition can not be printed Петров Андрей
@ 2021-12-15  5:26 ` Michael Heerdegen
  2021-12-15  7:01   ` Петров Андрей
  2021-12-19 13:05   ` Lars Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Heerdegen @ 2021-12-15  5:26 UTC (permalink / raw)
  To: Петров Андрей
  Cc: 52479

Петров Андрей <an.petrov@pay-lab.ru> writes:

> Hello, team!

Hello - thanks for your (very well done and pleasant to read!) report.

> Debugger entered--Lisp error: (error "Apparently circular structure being printed")
>   apply(debug error (error "Apparently circular structure being printed"))
>   edebug(error (error "Apparently circular structure being printed"))
>   signal(error ("Apparently circular structure being printed"))
>   edebug-signal(error ("Apparently circular structure being printed"))
>   message("Break: %s => %s" filtered (#<field field-157aa078be4c>))

Another symptom of printing the wrong way, similar to bug#52222.
Printing with `edebug-safe-prin1-to-string' should fix it and be the
right thing, right?

> P.S. I could not copy the text from emacs with C-c M-i according to hint:
> While in the mail buffer:

>   Type C-c C-c to send the bug report.
>   Type C-x k RET to cancel (don’t send it).
>   Type C-c M-i to copy text to your preferred mail program.   <----

Hmm, that calls `report-emacs-bug-insert-to-mailer'.  You have set up a
mailer on your system and it works all fine?  If you think Emacs is not
behaving here, can you please create a separate report? - that this
works is very important.  Maybe you can already give debugging a try?

Thanks,

Michael.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52479: 27.2; EDebugging stops when breakpoint condition can not be printed
  2021-12-15  5:26 ` Michael Heerdegen
@ 2021-12-15  7:01   ` Петров Андрей
  2021-12-19 13:05   ` Lars Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Петров Андрей @ 2021-12-15  7:01 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: 52479@debbugs.gnu.org

Michael,

> Hmm, that calls `report-emacs-bug-insert-to-mailer'.  You have set up a
> mailer on your system and it works all fine?  If you think Emacs is not
> behaving here, can you please create a separate report? - that this
> works is very important.  Maybe you can already give debugging a try?


I did not. I think this is the reason why it did not work for me. Thank you!

I think the following changes (or similar) would help to avoid such misunderstandings:

--- /usr/share/emacs/27.2/lisp/mail/emacsbug.el.gz
+++ #<buffer emacsbug.el.gz>
@@ -114,7 +114,8 @@
            (start-process "xdg-email" nil "xdg-email"
                           "--subject" subject
                           "--body" body
-                          (concat "mailto:" to)))
+                          (concat "mailto:" to))
+           (display-buffer-below-selected (get-buffer "xdg-email") nil))
        (error "Subject, To or body not found")))))

 (defvar report-emacs-bug--os-description nil

Diff finished.  Wed Dec 15 11:58:39 2021

Andrey.

________________________________________
От: Michael Heerdegen <michael_heerdegen@web.de>
Отправлено: 15 декабря 2021 г. 10:26:38
Кому: Петров Андрей
Копия: 52479@debbugs.gnu.org
Тема: Re: bug#52479: 27.2; EDebugging stops when breakpoint condition can not be printed

Петров Андрей <an.petrov@pay-lab.ru> writes:

> Hello, team!

Hello - thanks for your (very well done and pleasant to read!) report.

> Debugger entered--Lisp error: (error "Apparently circular structure being printed")
>   apply(debug error (error "Apparently circular structure being printed"))
>   edebug(error (error "Apparently circular structure being printed"))
>   signal(error ("Apparently circular structure being printed"))
>   edebug-signal(error ("Apparently circular structure being printed"))
>   message("Break: %s => %s" filtered (#<field field-157aa078be4c>))

Another symptom of printing the wrong way, similar to bug#52222.
Printing with `edebug-safe-prin1-to-string' should fix it and be the
right thing, right?

> P.S. I could not copy the text from emacs with C-c M-i according to hint:
> While in the mail buffer:

>   Type C-c C-c to send the bug report.
>   Type C-x k RET to cancel (don’t send it).
>   Type C-c M-i to copy text to your preferred mail program.   <----

Hmm, that calls `report-emacs-bug-insert-to-mailer'.  You have set up a
mailer on your system and it works all fine?  If you think Emacs is not
behaving here, can you please create a separate report? - that this
works is very important.  Maybe you can already give debugging a try?

Thanks,

Michael.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52479: 27.2; EDebugging stops when breakpoint condition can not be printed
  2021-12-15  5:26 ` Michael Heerdegen
  2021-12-15  7:01   ` Петров Андрей
@ 2021-12-19 13:05   ` Lars Ingebrigtsen
  2021-12-19 15:50     ` Michael Heerdegen
  1 sibling, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-19 13:05 UTC (permalink / raw)
  To: Michael Heerdegen
  Cc: 52479,
	Петров Андрей

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Another symptom of printing the wrong way, similar to bug#52222.
> Printing with `edebug-safe-prin1-to-string' should fix it and be the
> right thing, right?

Sounds like the right solution to me.  Michael, you've investigated this
issue in the bug#52222 context -- can you do the fixes here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#52479: 27.2; EDebugging stops when breakpoint condition can not be printed
  2021-12-19 13:05   ` Lars Ingebrigtsen
@ 2021-12-19 15:50     ` Michael Heerdegen
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Heerdegen @ 2021-12-19 15:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen
  Cc: 52479,
	Петров Андрей

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
> > Another symptom of printing the wrong way, similar to bug#52222.
> > Printing with `edebug-safe-prin1-to-string' should fix it and be the
> > right thing, right?
>
> Sounds like the right solution to me.  Michael, you've investigated
> this issue in the bug#52222 context -- can you do the fixes here?

Yes, don't care, I have a fix, I'm just a bit slow.  There are lots of
places in Edebug where printing is done, so I want to be careful to not
change wrong places.

Michael.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-19 15:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 13:03 bug#52479: 27.2; EDebugging stops when breakpoint condition can not be printed Петров Андрей
2021-12-15  5:26 ` Michael Heerdegen
2021-12-15  7:01   ` Петров Андрей
2021-12-19 13:05   ` Lars Ingebrigtsen
2021-12-19 15:50     ` Michael Heerdegen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).