From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: using the debugger Date: Sat, 09 Apr 2011 08:14:36 +1000 Organization: Unlimited download news at news.astraweb.com Message-ID: <87bp0gcrw3.fsf@puma.rapttech.com.au> References: <87mxk13saf.fsf@ericabrahamsen.net> <6ce07a3c-aa8f-4492-8976-3a2a7fc3a890@i14g2000yqe.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1302303679 3370 80.91.229.12 (8 Apr 2011 23:01:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 8 Apr 2011 23:01:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 09 01:01:15 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q8Kfv-0003sI-I5 for geh-help-gnu-emacs@m.gmane.org; Sat, 09 Apr 2011 01:01:11 +0200 Original-Received: from localhost ([127.0.0.1]:37705 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8KML-0007OJ-Tp for geh-help-gnu-emacs@m.gmane.org; Fri, 08 Apr 2011 18:40:57 -0400 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:unHbJ7hT+7xdlQqXQ/hwYMoPV60= Original-Lines: 49 Original-NNTP-Posting-Host: 6b6abbbf.news.astraweb.com Original-X-Trace: DXC=2Q8iB; fWAc`J?XMfTm0i_cL?0kYOcDh@jN7:H2`MmAUcS`HWH2Uf3?i]G; 2>V^?kWcCAkl5c@XgknSTCbgHa22MfH2D]4; KZ1H` Original-Xref: usenet.stanford.edu gnu.emacs.help:186610 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:80719 Archived-At: rusi writes: > On Apr 8, 7:03 pm, "Drew Adams" wrote: >> > while I'm stepping through the calling of a function, it in turn calls >> > another function, which I don't really care about. I know what it's >> > going to return, I just want to get on with things, but the secondary >> > function is long and drawn-out and I have to hit "d" like >> > fifty times to get through it and back to the top-level function. >> > Can someone tell me how I can skip them? >> >> Use `c' to `c'ut to the `c'hase, skipping directly to the result of an >> evaluation. >> >> Use `d' to `d'ig through an evaluation step by step. >> >> Remember the `C-h m' is your friend in nearly any buffer. >> >> [Ken's reply about "instrumenting" was no doubt about using `edebug'.  I take it >> that you are instead using `debug' (which is what I use, FWIW).  IOW, I assume > > Just curious -- why do you prefer debug over edebug? > Or perhaps a better question: Whats your debug-workflow? > >> you're either calling `(debug)' in your code or doing `M-x debug-on-entry' or >> setting `debug-on-error' or `debug-on-quit' to non-nil.] > I can't answer why Drew uses debug, but I use it frequently simply because for many problems it is sufficient and I find it easier than setting up edebug. I tend to switch to edebug if the problem proves to be tricky and the problem is not revealing itself via reading the code or debug isn't giving the level of control/interaction I need. Probably the most common 'tool' I use is message. I personally don't like stepping through lines of code watching variables change value to find a problem. My preferred approach is to study the code and trace through it in my head as most of the time, I find the bugs that are the trickiest to fix are more about logic problems and errors in the algorithm. Really understanding what the code does is the key and I find studying the source to be more rewarding than stepping/tracing through lines of code with a debugger because that doesn't give a high enough/overall view of what was intended - sometimes, you need to see the forest and not the trees. Tim -- tcross (at) rapttech dot com dot au