[Rd] Am I missing something about debugging?

tshort tshort at eprisolutions.com
Wed Jan 3 03:28:06 CET 2007

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

Tom Short

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                               ross at biostat.ucsf.edu
> Dept of Epidemiology and Biostatistics           fax: (415) 514-8150
> University of California, San Francisco
> San Francisco, CA 94107-1739                     hm:  (415) 550-1062
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

View this message in context: http://www.nabble.com/Am-I-missing-something-about-debugging--tf2910389.html#a8134920
Sent from the R devel mailing list archive at Nabble.com.

More information about the R-devel mailing list