From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gemini Lasswell Newsgroups: gmane.emacs.bugs Subject: bug#31919: 26.1.50; Lisp Debugger doesn't work when at stack limit Date: Wed, 20 Jun 2018 17:05:41 -0700 Message-ID: <87a7rprokq.fsf@runbox.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1529539509 20427 195.159.176.226 (21 Jun 2018 00:05:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 21 Jun 2018 00:05:09 +0000 (UTC) To: 31919@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 21 02:05:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fVn60-0005Di-NY for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Jun 2018 02:05:04 +0200 Original-Received: from localhost ([::1]:52266 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVn87-0008EL-SX for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Jun 2018 20:07:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53506) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVn81-0008EC-6v for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 20:07:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVn7w-0000mO-5b for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 20:07:09 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:50179) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fVn7v-0000lm-Vs for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 20:07:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fVn7v-0001Nc-DK for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 20:07:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Jun 2018 00:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 31919 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.15295395745093 (code B ref -1); Thu, 21 Jun 2018 00:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 Jun 2018 00:06:14 +0000 Original-Received: from localhost ([127.0.0.1]:58076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fVn78-0001K3-8C for submit@debbugs.gnu.org; Wed, 20 Jun 2018 20:06:14 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fVn75-0001Jf-Qr for submit@debbugs.gnu.org; Wed, 20 Jun 2018 20:06:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVn6z-0000Ej-4p for submit@debbugs.gnu.org; Wed, 20 Jun 2018 20:06:06 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:33973) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVn6y-0000EZ-W9 for submit@debbugs.gnu.org; Wed, 20 Jun 2018 20:06:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVn6x-00089j-ON for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 20:06:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVn6s-00007H-Nw for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 20:06:03 -0400 Original-Received: from aibo.runbox.com ([91.220.196.211]:42078) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fVn6s-00006A-B5 for bug-gnu-emacs@gnu.org; Wed, 20 Jun 2018 20:05:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=svaKGTrtXrkyOMjtAsKcp039RPh3jUurrO5BTBdsZv4=; b=J5zL7EgpO+/KkSycrbp+RGjzs u86HEdF63FShS5CIk1Mk/67Vi95Pew/Rs3rp0XABJSx3dBS+VZQss+nAyaWN1qTLX+yr8UIA30buA 5HJbilC5w+W9p58UWHbrrFYWPxKziltTSu+taouNpfAVOgS0qxMrJmEMbeUQkJjFJnt8je/wYrd98 DOWc9Cg5fOvASElfZT2hpPi2i0APw9xsnIFz3m42B8y+g3np7TOor0Y9H4Eyicvme/Bu4+9bbZcCG Arwv9rYpoazGb7RlvUOGoDapJ+OvfTn0haSzaZY6Ehwv57hARzdM75tm1p7t7STLfLWZqLuXkm+8t gJA47SVZw==; Original-Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1fVn6p-0006wB-PD for bug-gnu-emacs@gnu.org; Thu, 21 Jun 2018 02:05:55 +0200 Original-Received: from c-24-22-244-161.hsd1.wa.comcast.net ([24.22.244.161] helo=chinook) by mailfront10.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1fVn6l-0005MF-Ns for bug-gnu-emacs@gnu.org; Thu, 21 Jun 2018 02:05:52 +0200 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:147678 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable When max-lisp-eval-depth is exceeded and that error invokes the Lisp Debugger, it prints an error message, doesn't produce a backtrace, and leaves Emacs in a borked state. In Emacs 25.3.1, the Debugger works in this situation although the rest of Emacs doesn't work well due to being near the stack limit, but you can exit the Debugger and things will go back to normal. The reason for the regression is that backtrace printing is now done in Lisp, in cl-print, instead of in C. If cl-print isn't yet loaded, being at the stack limit can cause it to fail to load. To reproduce, from emacs -Q, enter this code into a buffer and evaluate it: (toggle-debug-on-error) (defun my-func (arg) (+ (length arg) (my-func arg))) (my-func "hello") Result: Instead of the *Backtrace* buffer, Emacs instead shows *Compile-Log*, which in my case contains: /nix/store/s6ji5vn6jbsjpp6wwbix2daigkcsvj7h-emacs-26.1.50/share/emacs/26.1.= 50/lisp/emacs-lisp/cl-print.elc:Error: Lisp nesting exceeds =E2=80=98max-li= sp-eval-depth=E2=80=99 In the echo area, this message appears: cl--generic-make-next-function: Symbol=E2=80=99s function definition is voi= d: t Emacs is at this point barely usable because it is inside the debugger's recursive edit and at its stack limit, making max-lisp-eval-depth errors easy to encounter. The *Backtrace* buffer exists but is empty and in Fundamental mode, so you can't use it to quit the debugger. You can recover from the situation with M-x top-level RET. If cl-print is already loaded the above example will work, but if you evaluate the following, the Debugger buffer will appear with a truncated backtrace: (my-func '(1 (2 (3 (4 (5 (6 (7 (8))))))))) Here's a patch to give the Debugger and cl-print more stack space during the recursive edit: --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0001-Increase-max-lisp-eval-depth-adjustment-while-in-deb.patch >From d044dc12a2b5794bd1155fd5b7ff7adb3bc8841d Mon Sep 17 00:00:00 2001 From: Gemini Lasswell Date: Wed, 20 Jun 2018 13:58:33 -0700 Subject: [PATCH] Increase max-lisp-eval-depth adjustment while in debugger * src/eval.c (call_debugger): Increase the amount of extra stack depth given to the debugger to allow it to call cl-print. --- src/eval.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/eval.c b/src/eval.c index ca1eb84ff3..f9bc13ade7 100644 --- a/src/eval.c +++ b/src/eval.c @@ -282,8 +282,8 @@ call_debugger (Lisp_Object arg) /* Do not allow max_specpdl_size less than actual depth (Bug#16603). */ EMACS_INT old_max = max (max_specpdl_size, count); - if (lisp_eval_depth + 40 > max_lisp_eval_depth) - max_lisp_eval_depth = lisp_eval_depth + 40; + if (lisp_eval_depth + 80 > max_lisp_eval_depth) + max_lisp_eval_depth = lisp_eval_depth + 80; /* While debugging Bug#16603, previous value of 100 was found too small to avoid specpdl overflow in the debugger itself. */ -- 2.16.4 --=-=-=--