[R] FAQ: 8.2 How can I debug dynamically loaded code?

Douglas Bates bates at stat.wisc.edu
Fri Dec 10 19:20:44 CET 1999

Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:

> "John D. Barnett" <jbarnett at wi.mit.edu> writes:
> > I'm having some trouble following the instructions in the FAQ for
> > debugging.
> > 
> > I can run 'R -d gdb' at the command line and it works; also, I have run
> > gdb from emacs before.
> > 
> > But I can't figure out how to put the two together: I've tried following
> > the instructions in the FAQ, but I seem to be missing something.  Can
> > someone with experience tell me exactly how I should invoke gdb on R
> > from within emacs?
> Hmm. I don't usually do that, but both of the following seems to be
> somewhat in the right direction:
> C-u M-x R and then give options -d gdb (requires ESS)
> or
> M-x gdb and then give R -d gdb as startup command

A third option is to start R within ESS mode (M-x R) and load whatever
R libraries that you want, then start gdb (M-x gdb) giving
$RHOME/bin/R.X11 as the program to debug.  Use the program "ps" to
find the process number of the currently running R process then use
use the "attach" command in gdb to attach gdb to that process.

One advantage of this method is that you have separate *R* and
*gud-gdb* windows.  Within the *R* window you have all the ESS
facilities, such as object-name completion, that we know and love.

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list