From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: debugging Emacs LISP functions Date: Wed, 01 Mar 2017 09:01:34 -0500 Message-ID: References: <20170301121427.GA3290@workstation> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1488376953 841 195.159.176.226 (1 Mar 2017 14:02:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 1 Mar 2017 14:02:33 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 01 15:02:22 2017 Return-path: Envelope-to: geh-help-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 1cj4pd-0007V8-EU for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Mar 2017 15:02:17 +0100 Original-Received: from localhost ([::1]:46747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cj4pj-0006Ua-JA for geh-help-gnu-emacs@m.gmane.org; Wed, 01 Mar 2017 09:02:23 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56184) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cj4pF-0006US-Q1 for help-gnu-emacs@gnu.org; Wed, 01 Mar 2017 09:01:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cj4pA-0007WQ-CQ for help-gnu-emacs@gnu.org; Wed, 01 Mar 2017 09:01:53 -0500 Original-Received: from [195.159.176.226] (port=44713 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cj4pA-0007W4-6Z for help-gnu-emacs@gnu.org; Wed, 01 Mar 2017 09:01:48 -0500 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cj4ox-0003h3-4w for help-gnu-emacs@gnu.org; Wed, 01 Mar 2017 15:01:35 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 37 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:YW7MM7Y3aAGFALWat71bw6BNzEA= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:112404 Archived-At: > I have a problem with Emacs. Basically it doesn't do what I want it to do :-) That's only because you haven't yet realized that it's exactly what you want it to do. > emacs-devel mailing list. I don't know. With free software you just > loose the difference between a "user" and a "developer". As Emacs contributor&maintainer I've always tried hard to blur this distinction as much as possible, indeed. > When I try to debug LISP code that is part of Emacs I see with some functions > I get the source code and with others I just get "byte-code". In the latter > case I can't debug it because the debugger just skips the whole function. > How can I know what functions appear as "byte-code" in the debugger? > And how can I debug them? [ By "the debugger" I assume you mean the debugger that pops the *Backtrace* buffer, as opposed to the Edebug debugger you get by instrumenting code with C-u C-M-x. ] Normally, most of the Elisp functions are byte-compiled, so you don't get to see much of their internals in the backtrace (and when you do see their internals, you'd rather they had been hidden). In order to see details from a function, you'll then need to redefine the function in its non-byte-compiled form. Usually the best way to do that is: - click on the function-name which should hopefully be a link to the function's definition. - hit C-M-x from within the body of that definition, to redefine the function. Then you can re-trigger the bug, which should get you back to the backtrace but with more details of where you are within that function, such that you can now use `e` from the various levels of stack to investigate the value of the various variables. Stefan