I don't think you're missing anything with the debug() function. It needs updating.
I don't think there's any structural reason why you shouldn't be able to do the things you're talking about in R, but they haven't been implemented. Mark Bravington put together a package (called debug) that does more than debug() does, but I haven't used it much, and I don't know if it does what you want. I recently added things to the R parser to keep track of connections between R code and source files; that was partly meant as a first step towards improving the debugging facilities. I'd be happy to help anyone who wants to do the hard work, but I don't think I'll be able to work on it before next summer. (If you do decide to work on it, please let me know, just in case I do get a chance: no point duplicating effort.) Duncan Murdoch On 1/2/2007 5:08 PM, 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. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel