Re: [Rd] Am I missing something about debugging?

From: tshort <>
Date: Wed 03 Jan 2007 - 02:28:06 GMT

Rather than using debug, I generally like using recover. When called, it shows the call stack, and you can pick what to view. Using option(error=recover) triggers it on errors. You can't step through code as when using browser(), but I find jumping to different points on the call stack to be more useful.

Tom Short
EPRI Ross Boylan wrote:
> I would like to be able to trace execution into calls below the current
> function, or to follow execution as calls return. This is roughly the
> distinction between "step" and "next" in many debuggers.
> I would also like to be able to switch to a location further up the call
> stack than the location at which I enter the debugger, to see the
> context of the current operations.
> Are there ways to do these things with the R debugger? I've studied the
> man pages and FAQ's, and looked at the debug package, but I don't see a
> way except for manually calling debug on the function that is about to
> be called if I want to descend. That's quite awkward, particularly
> since it must be manually undone (the debug package may be better on
> that score). I'm also not entirely sure that such recursion
> (essentially, debugging within the debugger) is OK.
> I tried looking up the stack with things like sys.calls(), from within
> the browser, but they operated as if I were at the top level (e.g.,
> sys.function(-1) gets an error that it can't go there). I was doing
> this in ess, and there's some chance the "can't write .Last.value" error
> (wording approximate) cause by having an old version is screwing things
> up).
> Since R is interpreted I would expect debugging to be a snap, but these
> limitations make me suspect there is something about the language design
> that makes implementing these facilities hard. For example, the browser
> as documented in the Green book has up and down functions to change the
> frame (p. 265); these are conspicuously absent in R.
> --
> Ross Boylan wk: (415) 514-8146
> 185 Berry St #5700
> Dept of Epidemiology and Biostatistics fax: (415) 514-8150
> University of California, San Francisco
> San Francisco, CA 94107-1739 hm: (415) 550-1062
> ______________________________________________
> mailing list

View this message in context:
Sent from the R devel mailing list archive at

______________________________________________ mailing list
Received on Wed Jan 03 18:48:26 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 03 Jan 2007 - 08:31:11 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.