[Rd] Trap to debugger while running R in Windows

Duncan Murdoch dmurdoch at pair.com
Thu Nov 27 06:13:16 MET 2003

When debugging C or Fortran code in R, it's helpful to run R under a
debugger.  I use Insight, which is a wrapper for gdb.

One problem is that in Windows hitting break doesn't cause a trap to
gdb, so it can be hard to stop the process.

I've added a menu item to the r-devel version of Rgui (Misc|Break to
debugger) which triggers a trap to the external debugger.

Unfortunately, choosing this menu item crashes R if you're *not*
running under a debugger, so I haven't made it easy to see:  you need
to compile src/gnuwin32/rui.c with DEBUG=T in order to get it.

If anyone knows of code that traps to a debugger when one is present,
and is safely run when one is not, please let me know.

Duncan Murdoch

More information about the R-devel mailing list