[Rd] Am I missing something about debugging?

Ross Boylan ross at biostat.ucsf.edu
Tue Jan 2 23:08:57 CET 2007


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



More information about the R-devel mailing list