From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: Debugging Emacs Date: Sat, 28 Nov 2015 21:35:06 +0000 Message-ID: <87zixxkdth.fsf@russet.org.uk> References: <87r3jbicg0.fsf@russet.org.uk> <83wpt3qq7b.fsf@gnu.org> <87lh9jp073.fsf@russet.org.uk> <83h9k6r1z8.fsf@gnu.org> <878u5hlxqd.fsf@russet.org.uk> <8337vpq2po.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1448746525 31626 80.91.229.3 (28 Nov 2015 21:35:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 28 Nov 2015 21:35:25 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 28 22:35:13 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a2n9F-0000Mz-7D for ged-emacs-devel@m.gmane.org; Sat, 28 Nov 2015 22:35:13 +0100 Original-Received: from localhost ([::1]:33880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2n9I-00064y-N1 for ged-emacs-devel@m.gmane.org; Sat, 28 Nov 2015 16:35:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2n9F-00064L-Qi for emacs-devel@gnu.org; Sat, 28 Nov 2015 16:35:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2n9E-0000yM-QT for emacs-devel@gnu.org; Sat, 28 Nov 2015 16:35:13 -0500 Original-Received: from cheviot12.ncl.ac.uk ([128.240.234.12]:42255) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2n9A-0000xB-3H; Sat, 28 Nov 2015 16:35:08 -0500 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot12.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1a2n99-000259-Ao; Sat, 28 Nov 2015 21:35:07 +0000 Original-Received: from cpc6-benw10-2-0-cust45.gate.cable.virginm.net ([92.238.179.46] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1a2n99-0001Hb-0V; Sat, 28 Nov 2015 21:35:07 +0000 In-Reply-To: <8337vpq2po.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 28 Nov 2015 22:38:27 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:195492 Archived-At: Eli Zaretskii writes: >> > But I will now stop writing comments to a text I didn't yet see, and >> > let you work on it instead ;-) >> >> >> It was at the bottom of the original email! > > I thought you were rewriting it for inclusion in etc/DEBUG. Sorry for > my misunderstanding. Well, I wrote some text. I think etc/DEBUG would be the best place to put it, but I just included it to see whether any one (probably you!) thought it sounded sensible. >> While I am mailing, I had one idea which might simplify debugging. >> Currently, you need to break-point some function to get control to GDB >> before you launch Emacs. > > Do you mean get control to GBD _after_ Emacs is launched? If so, why > do you need that? You could set breakpoints where you need them > before running Emacs, can't you? You can, yes. And, if you are used to doing this, setting a breakpoint *before* running Emacs probably seems natural. >> Why not add a null function to Emacs core for the purpose? >> Guaranteed never to be called from anywhere, does nothing, and with >> a breakpoint could be added to .gdbinit. Then, after running Emacs, >> "M-x break" would automatically pass control back to GDB without any >> further set up. >> >> Just a thought. > > Sometimes I don't want to set a breakpoint before running Emacs, > because Emacs would hit that breakpoint many times during startup. If > this is the problem you needed to solve, then I use Fredraw_display > for that purpose (I've added that to DEBUG at some point). There are > other similar functions which can be used in the same role. Exactly. And you mention this in the DEBUG file. My text suggests the "log" function from floatfns.c. But, in a "getting started" file this adds complexity. You have to explain why it is necessary (because GDB normally uses Ctrl-G I guess?), you have to explain to set a breakpoint first, and how to do this. Now, if we had a command, say `break', implemented in C, then added a "breakpoint Fbreak" into .gdbinit, then all of this would happen automatically. Under GDB, then "M-x break" or (break) Emacs would halt. Outside M-x break would do nothing. Clearly, nothing that can't be done anyway, and something that an experienced debugger might never touch. But one of the joys of emacs-lisp is that getting to a step-through debugger is really very easy. I found it a little harder with the C core. Phil