I think I am whistling in the wind, but is there a modern symbolic debugger for R programmes? I am working through some one else's code, thousands of lines, that has the occasional bug in it, and a lot in my understanding of it. I cannot make setBreakpoint or findLineNum work. I get "No source refs found.". I am starting to loose my mind! A debugger where I could set breakpoints with a little more granularity than the function level and a little more accessible than the trace function. What I ideally want is GDB for R. Does that exist? cheers Worik
On Tue, Oct 9, 2012 at 12:12 AM, Worik R <worikr at gmail.com> wrote:> I think I am whistling in the wind, but is there a modern symbolic > debugger for R programmes? > > I am working through some one else's code, thousands of lines, that > has the occasional bug in it, and a lot in my understanding of it. > > I cannot make setBreakpoint or findLineNum work. I get "No source > refs found.". I am starting to loose my mind! > > A debugger where I could set breakpoints with a little more > granularity than the function level and a little more accessible than > the trace function. What I ideally want is GDB for R. >trace("f", quote(browser()), 3) will set a breakpoint at line 3 of function f and body(f) will list the body of f showing where the browser command was added. Of course you could also edit the source of f and just insert a browser() command yourself. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/10/12 06:12, Worik R wrote:> I think I am whistling in the wind, but is there a modern symbolic debugger for R programmes? > > I am working through some one else's code, thousands of lines, that has the occasional bug in > it, and a lot in my understanding of it. > > I cannot make setBreakpoint or findLineNum work. I get "No source refs found.". I am > starting to loose my mind! > > A debugger where I could set breakpoints with a little more granularity than the function > level and a little more accessible than the trace function. What I ideally want is GDB for R. > > Does that exist?There is quite some debugging fuctionality available in ESS for emacs (http://ess.r-project.org/) and I rmrmber a presentation at useR in 2011 that there is as well in eclipse, but there you have to used,. as far as I remember, a patched version of R. So I would suggest to look into ESS for a debugger. Cheers, Rainer> > cheers Worik >-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iEYEARECAAYFAlBz1UwACgkQoYgNqgF2egokDwCeKd/87kM8P3YGRm/au783y1DX StwAn04wmEbH9P0FuaWHZ72fBK8BODJV =OMlj -----END PGP SIGNATURE-----
>> Worik R <worikr at gmail.com>>> on Tue, 9 Oct 2012 17:12:51 +1300 wrote: WR> I cannot make setBreakpoint or findLineNum work. I get "No source WR> refs found.". I am starting to loose my mind! Indeed, as Rainer suggested, check out ESS. The ess-tracebug (part of ESS) provides, among other things, source level debugging, breakpoints and versatile watch window. A bit old but still relevant documentation and screen-shots can be found here http://code.google.com/p/ess-tracebug/ Vitalie
On 12-10-09 12:12 AM, Worik R wrote:> I think I am whistling in the wind, but is there a modern symbolic > debugger for R programmes? > > I am working through some one else's code, thousands of lines, that > has the occasional bug in it, and a lot in my understanding of it. > > I cannot make setBreakpoint or findLineNum work. I get "No source > refs found.". I am starting to loose my mind!You need to source the code with source references. That is the default for source(), but not for package installation. Set env variable R_KEEP_PKG_SOURCE=yes for command line installs; option(keep.source.pkgs=TRUE) for installs from within R. Then you need to tell setBreakpoint where to look, through the "envir" arg. See the 2nd example in the help page.> A debugger where I could set breakpoints with a little more > granularity than the function level and a little more accessible than > the trace function. What I ideally want is GDB for R.I thought you said you wanted a modern debugger :-). GDB is very 80ish. I'm unaware of any debuggers that I would consider "modern", i.e. like the debuggers from the 90s, but there are a number of pre-modern choices that others have mentioned, and I don't think anyone has mentioned the debug package. Duncan Murdoch