Skip to content

FAQ: 8.2 How can I debug dynamically loaded code?

3 messages · John D. Barnett, Peter Dalgaard, Douglas Bates

#
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?

Thanks.

-John Barnett

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
"John D. Barnett" <jbarnett at wi.mit.edu> writes:
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
#
Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._